relocate_install_names: rewrite cellar names before prefix names

The cellar may overlap with the prefix, so if we replace the prefix
first, we will end up with paths like "@@HOMEBREW_PREFIX@@/Cellar"
instead of "@@HOMEBREW_CELLAR@@", which will break on installations
where the cellar and prefix are disjoint.
This commit is contained in:
Jack Nagel 2013-12-04 22:37:57 -06:00
parent 98cc0b3022
commit 94ebe8e747

View File

@ -18,6 +18,15 @@ class Keg
def relocate_install_names old_prefix, new_prefix, old_cellar, new_cellar, options={}
mach_o_files.each do |file|
install_names_for(file, options, relocate_reject_proc(old_cellar)) do |id, old_cellar_names|
file.ensure_writable do
old_cellar_names.each do |old_cellar_name|
new_cellar_name = old_cellar_name.to_s.gsub old_cellar, new_cellar
change_install_name(old_cellar_name, new_cellar_name, file)
end
end
end
install_names_for(file, options, relocate_reject_proc(old_prefix)) do |id, old_prefix_names|
file.ensure_writable do
new_prefix_id = id.to_s.gsub old_prefix, new_prefix
@ -29,15 +38,6 @@ class Keg
end
end
end
install_names_for(file, options, relocate_reject_proc(old_cellar)) do |id, old_cellar_names|
file.ensure_writable do
old_cellar_names.each do |old_cellar_name|
new_cellar_name = old_cellar_name.to_s.gsub old_cellar, new_cellar
change_install_name(old_cellar_name, new_cellar_name, file)
end
end
end
end
# Search for pkgconfig .pc files and relocate references to the cellar