mirror of
https://github.com/ruby/ruby.git
synced 2025-08-16 05:59:00 +02:00
Co-authored-by: Yuta Saito <kateinoigakukun@gmail.com>
This commit is contained in:
parent
c9c2245c0a
commit
31bc55dc90
7 changed files with 44 additions and 6 deletions
18
ruby.c
18
ruby.c
|
@ -28,7 +28,7 @@
|
|||
#ifdef __hpux
|
||||
#include <sys/pstat.h>
|
||||
#endif
|
||||
#if defined(LOAD_RELATIVE) && defined(HAVE_DLADDR)
|
||||
#if (defined(LOAD_RELATIVE) || defined(__MACH__)) && defined(HAVE_DLADDR)
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
|
@ -501,7 +501,7 @@ str_conv_enc(VALUE str, rb_encoding *from, rb_encoding *to)
|
|||
|
||||
void ruby_init_loadpath(void);
|
||||
|
||||
#if defined(LOAD_RELATIVE)
|
||||
#if defined(LOAD_RELATIVE) || defined(__MACH__)
|
||||
static VALUE
|
||||
runtime_libruby_path(void)
|
||||
{
|
||||
|
@ -577,6 +577,10 @@ runtime_libruby_path(void)
|
|||
#define INITIAL_LOAD_PATH_MARK rb_intern_const("@gem_prelude_index")
|
||||
|
||||
VALUE ruby_archlibdir_path, ruby_prefix_path;
|
||||
#if defined(__MACH__)
|
||||
// A path to libruby.dylib itself or where it's statically linked to.
|
||||
VALUE rb_libruby_selfpath;
|
||||
#endif
|
||||
|
||||
void
|
||||
ruby_init_loadpath(void)
|
||||
|
@ -584,6 +588,14 @@ ruby_init_loadpath(void)
|
|||
VALUE load_path, archlibdir = 0;
|
||||
ID id_initial_load_path_mark;
|
||||
const char *paths = ruby_initial_load_paths;
|
||||
#if defined(LOAD_RELATIVE) || defined(__MACH__)
|
||||
VALUE libruby_path = runtime_libruby_path();
|
||||
# if defined(__MACH__)
|
||||
rb_libruby_selfpath = libruby_path;
|
||||
rb_gc_register_address(&rb_libruby_selfpath);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined LOAD_RELATIVE
|
||||
#if !defined ENABLE_MULTIARCH
|
||||
# define RUBY_ARCH_PATH ""
|
||||
|
@ -597,7 +609,7 @@ ruby_init_loadpath(void)
|
|||
size_t baselen;
|
||||
const char *p;
|
||||
|
||||
sopath = runtime_libruby_path();
|
||||
sopath = libruby_path;
|
||||
libpath = RSTRING_PTR(sopath);
|
||||
|
||||
p = strrchr(libpath, '/');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue