Merge pull request #11382 from carlocab/build-rpaths
extend/os/mac/keg_relocate: remove `RPATH`s rooted in build directory
This commit is contained in:
commit
d45832bbfc
@ -55,6 +55,14 @@ class Keg
|
|||||||
new_name = fixed_name(file, bad_name)
|
new_name = fixed_name(file, bad_name)
|
||||||
change_install_name(bad_name, new_name, file) unless new_name == bad_name
|
change_install_name(bad_name, new_name, file) unless new_name == bad_name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
each_linkage_for(file, :rpaths) do |bad_name|
|
||||||
|
# Strip rpaths rooted in the build directory
|
||||||
|
next if !bad_name.start_with?(HOMEBREW_TEMP.to_s) &&
|
||||||
|
!bad_name.start_with?(HOMEBREW_TEMP.realpath.to_s)
|
||||||
|
|
||||||
|
delete_rpath(bad_name, file)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -50,6 +50,17 @@ class Keg
|
|||||||
raise
|
raise
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def delete_rpath(rpath, file)
|
||||||
|
odebug "Deleting rpath #{rpath} in #{file}"
|
||||||
|
MachO::Tools.delete_rpath(file, rpath, strict: false)
|
||||||
|
apply_ad_hoc_signature(file)
|
||||||
|
rescue MachO::MachOError
|
||||||
|
onoe <<~EOS
|
||||||
|
Failed deleting rpath #{rpath} in #{file}
|
||||||
|
EOS
|
||||||
|
raise
|
||||||
|
end
|
||||||
|
|
||||||
def apply_ad_hoc_signature(file)
|
def apply_ad_hoc_signature(file)
|
||||||
return if MacOS.version < :big_sur
|
return if MacOS.version < :big_sur
|
||||||
return unless Hardware::CPU.arm?
|
return unless Hardware::CPU.arm?
|
||||||
|
@ -10,7 +10,7 @@ require "os/mac/architecture_list"
|
|||||||
module MachOShim
|
module MachOShim
|
||||||
extend Forwardable
|
extend Forwardable
|
||||||
|
|
||||||
delegate [:dylib_id, :rpaths, :delete_rpath] => :macho
|
delegate [:dylib_id, :rpaths] => :macho
|
||||||
|
|
||||||
def macho
|
def macho
|
||||||
@macho ||= MachO.open(to_s)
|
@macho ||= MachO.open(to_s)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user