diff --git a/ext/extmk.rb b/ext/extmk.rb index 70067d28b8..b0d84ef00f 100755 --- a/ext/extmk.rb +++ b/ext/extmk.rb @@ -417,7 +417,6 @@ elsif CONFIG['EXTSTATIC'] else $ruby = '$(topdir)/ruby' + EXEEXT end -$mflags << "BUILTRUBY=#$ruby" $ruby = [$ruby] $ruby << "-I'$(topdir)'" unless CROSS_COMPILING @@ -428,6 +427,7 @@ end topruby = $ruby $ruby = topruby.join(' ') $mflags << "ruby=#$ruby" +$builtruby = '$(topdir)/ruby' + EXEEXT # Must be an executable path MTIMES = [__FILE__, 'rbconfig.rb', srcdir+'/lib/mkmf.rb'].collect {|f| File.mtime(f)} diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 79bb96ba75..efe3419fd7 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -2076,7 +2076,11 @@ sitearch = #{CONFIG['sitearch']} ruby_version = #{RbConfig::CONFIG['ruby_version']} ruby = #{$ruby.sub(%r[\A#{Regexp.quote(RbConfig::CONFIG['bindir'])}(?=/|\z)]) {'$(bindir)'}} RUBY = $(ruby#{sep}) -BUILTRUBY = $(RUBY) +BUILTRUBY = #{if defined?($builtruby) && $builtruby + $builtruby + else + File.join('$(bindir)', CONFIG["RUBY_INSTALL_NAME"] + CONFIG['EXEEXT']) + end} ruby_headers = #{headers.join(' ')} RM = #{config_string('RM', &possible_command) || '$(RUBY) -run -e rm -- -f'} diff --git a/tool/fake.rb b/tool/fake.rb index 88709b2f23..91dfb041c4 100644 --- a/tool/fake.rb +++ b/tool/fake.rb @@ -45,6 +45,7 @@ prehook = proc do |extmk| $extout_prefix = '$(extout)$(target_prefix)/' config = RbConfig::CONFIG mkconfig = RbConfig::MAKEFILE_CONFIG + $builtruby ||= File.join(builddir, config['RUBY_INSTALL_NAME'] + config['EXEEXT']) RbConfig.fire_update!("builddir", builddir) RbConfig.fire_update!("buildlibdir", builddir) RbConfig.fire_update!("libdir", builddir)