diff options
author | Sutou Kouhei <kou@clear-code.com> | 2021-12-11 11:16:44 +0900 |
---|---|---|
committer | Sutou Kouhei <kou@clear-code.com> | 2021-12-11 11:16:44 +0900 |
commit | 216c6f566797d424b3ae61407920381bae8080ba (patch) | |
tree | f9ec81d6a1185a468985f7640f13d5a1d58c1cee | |
parent | 584283cd083fbbce22791983cba46c650f704f54 (diff) | |
download | rake-compiler-216c6f566797d424b3ae61407920381bae8080ba.tar.gz |
Fix a regression bug
GitHub: fix GH-195
It's caused when base Ruby and cross Ruby use different
RbConfig::CONFIG["ENABLE_SHARED"]. Gem's extension directory is depend
on it. So we should use the same RbConfig::CONFIG["ENABLE_SHARED"] for
both base Ruby and cross Ruby.
Reported by Mike Dalessio. Thanks!!!
-rw-r--r-- | lib/rake/extensiontask.rb | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/rake/extensiontask.rb b/lib/rake/extensiontask.rb index 938e8e1..962d0ff 100644 --- a/lib/rake/extensiontask.rb +++ b/lib/rake/extensiontask.rb @@ -416,8 +416,21 @@ Java extension should be preferred. # genearte fake.rb for different ruby versions file "#{tmp_path}/fake.rb" => [rbconfig_file] do |t| File.open(t.name, 'w') do |f| - f.write fake_rb(for_platform, ruby_ver) - f.write File.read(t.prerequisites.first) + # Keep the original RbConfig::CONFIG["ENABLE_SHARED"] to use + # the same RubyGems extension directory. See also + # Gem::BasicSpecificaion#extenions_dir and + # Gem.extension_api_version. + # + # if RbConfig::CONFIG["ENABLE_SHARED"] == "no" + # "extensions/x86_64-linux/2.5.0-static" + # else + # "extensions/x86_64-linux/2.5.0" + # end + f.puts("require 'rbconfig'") + f.puts("original_enable_shared = RbConfig::CONFIG['ENABLE_SHARED']") + f.puts(fake_rb(for_platform, ruby_ver)) + f.puts(File.read(t.prerequisites.first)) + f.puts("RbConfig::CONFIG['ENABLE_SHARED'] = original_enable_shared") end end |