mac/keg_relocate: Delete loader_paths

Fix the call to expand_rpath.
This commit is contained in:
William Woodruff 2019-03-10 21:29:59 -04:00
parent a8c4136e9e
commit 82dd5011e2
No known key found for this signature in database
GPG Key ID: 600D68320BE45ACC

View File

@ -95,6 +95,14 @@ class Keg
bad_name
end
def expand_loader_path(file, bad_name)
suffix = bad_name.sub(/^@loader_path/, "")
# Note: Weak dylibs are allowed to not exist on disk, so
# we don't check for existence & complain here.
file.parent/suffix
end
# If file is a dylib or bundle itself, look for the dylib named by
# bad_name relative to the lib directory, so that we can skip the more
# expensive recursive search if possible.
@ -104,11 +112,13 @@ class Keg
elsif bad_name.start_with? CELLAR_PLACEHOLDER
bad_name.sub(CELLAR_PLACEHOLDER, HOMEBREW_CELLAR)
elsif (file.dylib? || file.mach_o_bundle?) && (file.parent + bad_name).exist?
"@loader_path/#{bad_name}"
file.parent/bad_name
elsif file.mach_o_executable? && (lib + bad_name).exist?
"#{lib}/#{bad_name}"
elsif bad_name.start_with?("@rpath") && ENV["HOMEBREW_RELOCATE_RPATHS"]
expand_rpath bad_name
elsif bad_name.start_with?("@rpath") && ENV["HOMEBREW_RELOCATE_METAVARS"]
expand_rpath file, bad_name
elsif bad_name.start_with?("@loader_path") && ENV["HOMEBREW_RELOCATE_METAVARS"]
expand_loader_path file, bad_name
elsif (abs_name = find_dylib(bad_name)) && abs_name.exist?
abs_name.to_s
else
@ -119,7 +129,7 @@ class Keg
def each_install_name_for(file, &block)
dylibs = file.dynamically_linked_libraries
dylibs.reject! { |fn| fn =~ /^@(loader_|executable_)path/ }
dylibs.reject! { |fn| fn =~ /^@executable_path/ }
dylibs.each(&block)
end