os/mac: Flush RPATHs from Mach-Os when possible
This commit is contained in:
parent
2e2dea6131
commit
54aca0d14f
@ -69,6 +69,15 @@ class Keg
|
||||
new_name = fixed_name(file, bad_name)
|
||||
change_install_name(bad_name, new_name, file) unless new_name == bad_name
|
||||
end
|
||||
|
||||
# If none of the install names reference RPATH(s), then we can safely
|
||||
# remove all RPATHs from the file.
|
||||
if file.dynamically_linked_libraries.none? { |lib| lib.start_with?("@rpath") }
|
||||
# Note: This could probably be made more efficient by reverse-sorting
|
||||
# the RPATHs by offset and calling MachOFile#delete_command
|
||||
# with repopulate: false.
|
||||
file.rpaths.each { |r| file.delete_rpath(r) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -64,6 +64,10 @@ module MachOShim
|
||||
macho.rpaths
|
||||
end
|
||||
|
||||
def delete_rpath(rpath)
|
||||
macho.delete_rpath(rpath)
|
||||
end
|
||||
|
||||
def archs
|
||||
mach_data.map { |m| m.fetch :arch }.extend(ArchitectureListExtension)
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user