aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/formula_installer.rb
diff options
context:
space:
mode:
authorMike McQuaid2013-03-11 18:56:26 +0000
committerMike McQuaid2013-03-11 18:58:37 +0000
commit0f9910d352e460fe7d93544d91cdc1eb53a9631c (patch)
treebd424a5196ae9896a632a1686fdb9debffef4442 /Library/Homebrew/formula_installer.rb
parent258d70028f359e88b3300fdd1b8442428ef75826 (diff)
downloadbrew-0f9910d352e460fe7d93544d91cdc1eb53a9631c.tar.bz2
Relocate bottles using install_name_tool.
This has two parts: 1. Bottles are temporarily relocated on bottling and tested if that is sufficient for them to contain no longer reference the prefix or cellar. If so, they are marked as relocatable. 2. On installation if bottles are marked as relocatable they will be relocated using install_name_tool to the current prefix and cellar. Closes Homebrew/homebrew#18374.
Diffstat (limited to 'Library/Homebrew/formula_installer.rb')
-rw-r--r--Library/Homebrew/formula_installer.rb15
1 files changed, 13 insertions, 2 deletions
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index 9251fe487..767db6e63 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -96,13 +96,13 @@ class FormulaInstaller
begin
if pour_bottle?
pour
- poured_bottle = true
+ @poured_bottle = true
end
rescue
opoo "Bottle installation failed: building from source."
end
- unless poured_bottle
+ unless @poured_bottle
build
clean
end
@@ -353,6 +353,17 @@ class FormulaInstaller
def fix_install_names
Keg.new(f.prefix).fix_install_names
+ if @poured_bottle
+ 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
+ Keg.new(f.prefix).relocate_install_names \
+ old_prefix, new_prefix, old_cellar, new_cellar
+ end
+ end
rescue Exception => e
onoe "Failed to fix install names"
puts "The formula built, but you may encounter issues using it or linking other"