Teach installer about prefix and cellar placeholders

This commit is contained in:
Jack Nagel 2013-12-04 22:37:57 -06:00
parent 2b5e57a4bd
commit f2aaa5f0ac
2 changed files with 8 additions and 10 deletions

View File

@ -435,17 +435,12 @@ class FormulaInstaller
end end
def fix_install_names def fix_install_names
Keg.new(f.prefix).fix_install_names(:keg_only => f.keg_only?) keg = Keg.new(f.prefix)
if @poured_bottle and f.bottle keg.fix_install_names(:keg_only => f.keg_only?)
old_prefix = f.bottle.prefix
new_prefix = HOMEBREW_PREFIX.to_s
old_cellar = f.bottle.cellar
new_cellar = HOMEBREW_CELLAR.to_s
if old_prefix != new_prefix or old_cellar != new_cellar if @poured_bottle and f.bottle
Keg.new(f.prefix).relocate_install_names \ keg.relocate_install_names Keg::PREFIX_PLACEHOLDER, HOMEBREW_PREFIX.to_s,
old_prefix, new_prefix, old_cellar, new_cellar, :keg_only => f.keg_only? Keg::CELLAR_PLACEHOLDER, HOMEBREW_CELLAR.to_s, :keg_only => f.keg_only?
end
end end
rescue Exception => e rescue Exception => e
onoe "Failed to fix install names" onoe "Failed to fix install names"

View File

@ -110,6 +110,9 @@ class Keg
"#{lib}/#{bad_name}" "#{lib}/#{bad_name}"
elsif (abs_name = find_dylib(Pathname.new(bad_name).basename)) && abs_name.exist? elsif (abs_name = find_dylib(Pathname.new(bad_name).basename)) && abs_name.exist?
abs_name.to_s abs_name.to_s
elsif bad_name.start_with? PREFIX_PLACEHOLDER, CELLAR_PLACEHOLDER
# Skip these, relocate_install_names will fix them
bad_name
else else
opoo "Could not fix #{bad_name} in #{file}" opoo "Could not fix #{bad_name} in #{file}"
bad_name bad_name