os/mac/keg_relocate: avoid changing to an already existing rpath
Doing `change_rpath(old, new, file)` will error if `new` is already an rpath for `file`. When this happens, `old` is no longer needed, so we can delete it. Fixes a build failure at shivammathur/homebrew-php#1848.
This commit is contained in:
parent
8bfe579e8a
commit
27032e002f
@ -62,7 +62,15 @@ class Keg
|
|||||||
else
|
else
|
||||||
new_name = opt_name_for(bad_name)
|
new_name = opt_name_for(bad_name)
|
||||||
loader_name = loader_name_for(file, new_name)
|
loader_name = loader_name_for(file, new_name)
|
||||||
change_rpath(bad_name, loader_name, file) if loader_name != bad_name
|
next if loader_name == bad_name
|
||||||
|
|
||||||
|
if file.rpaths(resolve_variable_references: false).include?(loader_name)
|
||||||
|
# The wanted loader_name is already an rpath, so the existing bad_name is not needed.
|
||||||
|
# Attempting to change bad_name to an already existing rpath will produce an error.
|
||||||
|
delete_rpath(bad_name, file)
|
||||||
|
else
|
||||||
|
change_rpath(bad_name, loader_name, file)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user