Skip to content

Commit

Permalink
portable-ruby: fix more compiler toolchain references
Browse files Browse the repository at this point in the history
We already get rid of the compiler shim references in `rbconfig.rb`, but
there are still some more that may not be valid on the target system:

    $ brew ruby -e 'p RbConfig::CONFIG.select { |k, v| v.match? /gcc-(.*)-\d+/ }'
    {"RANLIB"=>"gcc-ranlib-11", "NM"=>"gcc-nm-11", "AR"=>"gcc-ar-11"}

We can replace them with `ranlib`, `nm`, and `ar`, respectively.

This should help to avoid issues like the one spotted in
Homebrew/brew#17114.
  • Loading branch information
ZhongRuoyu committed Apr 19, 2024
1 parent f0203ca commit 6db5441
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Formula/portable-ruby.rb
Expand Up @@ -104,6 +104,8 @@ def install
inreplace lib/"ruby/#{abi_version}/#{abi_arch}/rbconfig.rb" do |s|
s.gsub! ENV.cxx, "c++"
s.gsub! ENV.cc, "cc"
# Change e.g. `CONFIG["AR"] = "gcc-ar-11"` to `CONFIG["AR"] = "ar"`
s.gsub!(/(CONFIG\[".+"\] = )"gcc-(.*)-\d+"/, '\\1"\\2"')
# C++ compiler might have been disabled because we break it with [email protected] builds
s.sub!(/(CONFIG\["CXX"\] = )"false"/, '\\1"c++"')
end
Expand Down

0 comments on commit 6db5441

Please sign in to comment.