keg_relocate (linux): prepend gcc/lib/current to RPATH when needed

This should help keep bottles that require GCC working when
Homebrew/homebrew-core#106755 is merged.

This only works on freshly-poured bottles. Previously installed bottles
will still break on systems with a host GCC older than GCC 11.
This commit is contained in:
Carlo Cabrera 2022-08-02 11:02:47 +08:00
parent 4baff3eec1
commit 53fdb64113
No known key found for this signature in database
GPG Key ID: C74D447FC549A1D0

View File

@ -32,6 +32,7 @@ class Keg
lib_path = "#{new_prefix}/lib"
rpath << lib_path unless rpath.include? lib_path
rpath.prepend HOMEBREW_PREFIX/"opt/gcc/lib/current" if rpath.any? { |rp| rp.match?(%r{lib/gcc/\d+$}) }
rpath.join(":")
end