mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +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
|
@ -2729,6 +2729,14 @@ AS_IF([test "$with_dln_a_out" != yes], [
|
||||||
: ${LDFLAGS=""}
|
: ${LDFLAGS=""}
|
||||||
: ${LIBPATHENV=DYLD_FALLBACK_LIBRARY_PATH}
|
: ${LIBPATHENV=DYLD_FALLBACK_LIBRARY_PATH}
|
||||||
: ${PRELOADENV=DYLD_INSERT_LIBRARIES}
|
: ${PRELOADENV=DYLD_INSERT_LIBRARIES}
|
||||||
|
AS_IF([test x"$enable_shared" = xyes], [
|
||||||
|
# Resolve symbols from libruby.dylib when --enable-shared
|
||||||
|
EXTDLDFLAGS='$(LIBRUBYARG_SHARED)'
|
||||||
|
], [test "x$EXTSTATIC" = x], [
|
||||||
|
# When building exts as bundles, a mach-o bundle needs to know its loader
|
||||||
|
# program to bind symbols from the ruby executable
|
||||||
|
EXTDLDFLAGS="-bundle_loader '\$(BUILTRUBY)'"
|
||||||
|
])
|
||||||
rb_cv_dlopen=yes],
|
rb_cv_dlopen=yes],
|
||||||
[aix*], [ : ${LDSHARED='$(CC)'}
|
[aix*], [ : ${LDSHARED='$(CC)'}
|
||||||
AS_IF([test "$GCC" = yes], [
|
AS_IF([test "$GCC" = yes], [
|
||||||
|
|
|
@ -20,6 +20,7 @@ TRANSSODIR = $(ENCSODIR)/trans
|
||||||
DLEXT = @DLEXT@
|
DLEXT = @DLEXT@
|
||||||
OBJEXT = @OBJEXT@
|
OBJEXT = @OBJEXT@
|
||||||
LIBEXT = @LIBEXT@
|
LIBEXT = @LIBEXT@
|
||||||
|
EXEEXT = @EXEEXT@
|
||||||
TIMESTAMPDIR = $(EXTOUT)/.timestamp
|
TIMESTAMPDIR = $(EXTOUT)/.timestamp
|
||||||
ENC_TRANS_D = $(TIMESTAMPDIR)/.enc-trans.time
|
ENC_TRANS_D = $(TIMESTAMPDIR)/.enc-trans.time
|
||||||
ENC_TRANS_SO_D = $(TIMESTAMPDIR)/.enc-trans.so.time
|
ENC_TRANS_SO_D = $(TIMESTAMPDIR)/.enc-trans.so.time
|
||||||
|
@ -33,6 +34,7 @@ RUBY_SO_NAME = @RUBY_SO_NAME@
|
||||||
LIBRUBY = @LIBRUBY@
|
LIBRUBY = @LIBRUBY@
|
||||||
LIBRUBYARG_SHARED = @LIBRUBYARG_SHARED@
|
LIBRUBYARG_SHARED = @LIBRUBYARG_SHARED@
|
||||||
LIBRUBYARG_STATIC = $(LIBRUBYARG_SHARED)
|
LIBRUBYARG_STATIC = $(LIBRUBYARG_SHARED)
|
||||||
|
BUILTRUBY = $(topdir)/miniruby$(EXEEXT)
|
||||||
|
|
||||||
empty =
|
empty =
|
||||||
AR = @AR@
|
AR = @AR@
|
||||||
|
|
|
@ -408,8 +408,10 @@ if CROSS_COMPILING
|
||||||
$ruby = $mflags.defined?("MINIRUBY") || CONFIG['MINIRUBY']
|
$ruby = $mflags.defined?("MINIRUBY") || CONFIG['MINIRUBY']
|
||||||
elsif sep = config_string('BUILD_FILE_SEPARATOR')
|
elsif sep = config_string('BUILD_FILE_SEPARATOR')
|
||||||
$ruby = "$(topdir:/=#{sep})#{sep}miniruby" + EXEEXT
|
$ruby = "$(topdir:/=#{sep})#{sep}miniruby" + EXEEXT
|
||||||
else
|
elsif CONFIG['EXTSTATIC']
|
||||||
$ruby = '$(topdir)/miniruby' + EXEEXT
|
$ruby = '$(topdir)/miniruby' + EXEEXT
|
||||||
|
else
|
||||||
|
$ruby = '$(topdir)/ruby' + EXEEXT
|
||||||
end
|
end
|
||||||
$ruby = [$ruby]
|
$ruby = [$ruby]
|
||||||
$ruby << "-I'$(topdir)'"
|
$ruby << "-I'$(topdir)'"
|
||||||
|
@ -421,6 +423,7 @@ end
|
||||||
topruby = $ruby
|
topruby = $ruby
|
||||||
$ruby = topruby.join(' ')
|
$ruby = topruby.join(' ')
|
||||||
$mflags << "ruby=#$ruby"
|
$mflags << "ruby=#$ruby"
|
||||||
|
$builtruby = '$(topdir)/miniruby' + EXEEXT # Must be an executable path
|
||||||
|
|
||||||
MTIMES = [__FILE__, 'rbconfig.rb', srcdir+'/lib/mkmf.rb'].collect {|f| File.mtime(f)}
|
MTIMES = [__FILE__, 'rbconfig.rb', srcdir+'/lib/mkmf.rb'].collect {|f| File.mtime(f)}
|
||||||
|
|
||||||
|
|
|
@ -2034,6 +2034,11 @@ sitearch = #{CONFIG['sitearch']}
|
||||||
ruby_version = #{RbConfig::CONFIG['ruby_version']}
|
ruby_version = #{RbConfig::CONFIG['ruby_version']}
|
||||||
ruby = #{$ruby.sub(%r[\A#{Regexp.quote(RbConfig::CONFIG['bindir'])}(?=/|\z)]) {'$(bindir)'}}
|
ruby = #{$ruby.sub(%r[\A#{Regexp.quote(RbConfig::CONFIG['bindir'])}(?=/|\z)]) {'$(bindir)'}}
|
||||||
RUBY = $(ruby#{sep})
|
RUBY = $(ruby#{sep})
|
||||||
|
BUILTRUBY = #{if defined?($builtruby) && $builtruby
|
||||||
|
$builtruby
|
||||||
|
else
|
||||||
|
File.join('$(bindir)', CONFIG["RUBY_INSTALL_NAME"] + CONFIG['EXEEXT'])
|
||||||
|
end}
|
||||||
ruby_headers = #{headers.join(' ')}
|
ruby_headers = #{headers.join(' ')}
|
||||||
|
|
||||||
RM = #{config_string('RM', &possible_command) || '$(RUBY) -run -e rm -- -f'}
|
RM = #{config_string('RM', &possible_command) || '$(RUBY) -run -e rm -- -f'}
|
||||||
|
|
|
@ -823,8 +823,15 @@ link_o_to_so(const char **o_files, const char *so_file)
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
char **args = form_args(7, CC_LDSHARED_ARGS, CC_CODEFLAG_ARGS,
|
# if defined(__MACH__)
|
||||||
options, o_files, CC_LIBS, CC_DLDFLAGS_ARGS, CC_LINKER_ARGS);
|
extern VALUE rb_libruby_selfpath;
|
||||||
|
const char *loader_args[] = {"-bundle_loader", StringValuePtr(rb_libruby_selfpath), NULL};
|
||||||
|
# else
|
||||||
|
const char *loader_args[] = {NULL};
|
||||||
|
# endif
|
||||||
|
|
||||||
|
char **args = form_args(8, CC_LDSHARED_ARGS, CC_CODEFLAG_ARGS,
|
||||||
|
options, o_files, loader_args, CC_LIBS, CC_DLDFLAGS_ARGS, CC_LINKER_ARGS);
|
||||||
if (args == NULL)
|
if (args == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
18
ruby.c
18
ruby.c
|
@ -28,7 +28,7 @@
|
||||||
#ifdef __hpux
|
#ifdef __hpux
|
||||||
#include <sys/pstat.h>
|
#include <sys/pstat.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(LOAD_RELATIVE) && defined(HAVE_DLADDR)
|
#if (defined(LOAD_RELATIVE) || defined(__MACH__)) && defined(HAVE_DLADDR)
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -501,7 +501,7 @@ str_conv_enc(VALUE str, rb_encoding *from, rb_encoding *to)
|
||||||
|
|
||||||
void ruby_init_loadpath(void);
|
void ruby_init_loadpath(void);
|
||||||
|
|
||||||
#if defined(LOAD_RELATIVE)
|
#if defined(LOAD_RELATIVE) || defined(__MACH__)
|
||||||
static VALUE
|
static VALUE
|
||||||
runtime_libruby_path(void)
|
runtime_libruby_path(void)
|
||||||
{
|
{
|
||||||
|
@ -577,6 +577,10 @@ runtime_libruby_path(void)
|
||||||
#define INITIAL_LOAD_PATH_MARK rb_intern_const("@gem_prelude_index")
|
#define INITIAL_LOAD_PATH_MARK rb_intern_const("@gem_prelude_index")
|
||||||
|
|
||||||
VALUE ruby_archlibdir_path, ruby_prefix_path;
|
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
|
void
|
||||||
ruby_init_loadpath(void)
|
ruby_init_loadpath(void)
|
||||||
|
@ -584,6 +588,14 @@ ruby_init_loadpath(void)
|
||||||
VALUE load_path, archlibdir = 0;
|
VALUE load_path, archlibdir = 0;
|
||||||
ID id_initial_load_path_mark;
|
ID id_initial_load_path_mark;
|
||||||
const char *paths = ruby_initial_load_paths;
|
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 LOAD_RELATIVE
|
||||||
#if !defined ENABLE_MULTIARCH
|
#if !defined ENABLE_MULTIARCH
|
||||||
# define RUBY_ARCH_PATH ""
|
# define RUBY_ARCH_PATH ""
|
||||||
|
@ -597,7 +609,7 @@ ruby_init_loadpath(void)
|
||||||
size_t baselen;
|
size_t baselen;
|
||||||
const char *p;
|
const char *p;
|
||||||
|
|
||||||
sopath = runtime_libruby_path();
|
sopath = libruby_path;
|
||||||
libpath = RSTRING_PTR(sopath);
|
libpath = RSTRING_PTR(sopath);
|
||||||
|
|
||||||
p = strrchr(libpath, '/');
|
p = strrchr(libpath, '/');
|
||||||
|
|
|
@ -43,6 +43,7 @@ prehook = proc do |extmk|
|
||||||
$extout_prefix = '$(extout)$(target_prefix)/'
|
$extout_prefix = '$(extout)$(target_prefix)/'
|
||||||
config = RbConfig::CONFIG
|
config = RbConfig::CONFIG
|
||||||
mkconfig = RbConfig::MAKEFILE_CONFIG
|
mkconfig = RbConfig::MAKEFILE_CONFIG
|
||||||
|
$builtruby ||= File.join(builddir, config['RUBY_INSTALL_NAME'] + config['EXEEXT'])
|
||||||
RbConfig.fire_update!("builddir", builddir)
|
RbConfig.fire_update!("builddir", builddir)
|
||||||
RbConfig.fire_update!("buildlibdir", builddir)
|
RbConfig.fire_update!("buildlibdir", builddir)
|
||||||
RbConfig.fire_update!("libdir", builddir)
|
RbConfig.fire_update!("libdir", builddir)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue