From e5a3f232563139fdf15660d54aeaec112ffc2349 Mon Sep 17 00:00:00 2001 From: Alan Wu Date: Fri, 29 Jul 2022 13:54:27 -0400 Subject: Use $(bindir) for path to executable in mkmf For the macOS -bundle_loader linker option, we need a path to the Ruby exectuable. $(RUBY) is not necessarily a path since it could be a command line invocation. That happens during build with runruby.rb and can happen post installation if the user passes the --ruby option to a extconf.rb. Use $(bindir) to locate the executable instead. Before installation, $(bindir) doesn't exist, so we need to be able to override $(BUILTRUBY) in such situations so test-spec and bundled extensions could build. Use a new mkmf global, $builtruby, to do this; set it in fake.rb and in extmk.rb. Our build system is quite complex... --- lib/mkmf.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib') 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'} -- cgit v1.2.3