os/mac/keg: add change_rpath method

This commit is contained in:
Carlo Cabrera 2021-05-05 21:37:02 +01:00 committed by cnnrmnn
parent 52f905fa2a
commit a8cbc14ca3

View File

@ -34,6 +34,22 @@ class Keg
raise
end
def change_rpath(old, new, file)
return if old == new
@require_relocation = true
odebug "Changing rpath in #{file}\n from #{old}\n to #{new}"
MachO::Tools.change_rpath(file, old, new, strict: false)
apply_ad_hoc_signature(file)
rescue MachO::MachOError
onoe <<~EOS
Failed changing rpath in #{file}
from #{old}
to #{new}
EOS
raise
end
def apply_ad_hoc_signature(file)
return if MacOS.version < :big_sur
return unless Hardware::CPU.arm?