From 76153e9780e8dd19b70ae1ccc9b3f06f4d47971b Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Wed, 4 Dec 2013 22:37:57 -0600 Subject: [PATCH] Insert placeholders for prefix and cellar in relocatable bottles --- Library/Homebrew/cmd/bottle.rb | 22 ++++++++++++++++++---- Library/Homebrew/keg_fix_install_names.rb | 3 +++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/cmd/bottle.rb b/Library/Homebrew/cmd/bottle.rb index 40176d4c93..8331619f8a 100644 --- a/Library/Homebrew/cmd/bottle.rb +++ b/Library/Homebrew/cmd/bottle.rb @@ -124,16 +124,30 @@ module Homebrew extend self HOMEBREW_CELLAR.cd do ohai "Bottling #{filename}..." - # Use gzip, faster to compress than bzip2, faster to uncompress than bzip2 - # or an uncompressed tarball (and more bandwidth friendly). - safe_system 'tar', 'czf', bottle_path, "#{f.name}/#{f.version}" + + keg = Keg.new(f.prefix) + + keg.lock do + begin + keg.relocate_install_names prefix, Keg::PREFIX_PLACEHOLDER, + cellar, Keg::CELLAR_PLACEHOLDER, :keg_only => f.keg_only? + + # Use gzip, faster to compress than bzip2, faster to uncompress than bzip2 + # or an uncompressed tarball (and more bandwidth friendly). + safe_system 'tar', 'czf', bottle_path, "#{f.name}/#{f.version}" + ensure + keg.relocate_install_names Keg::PREFIX_PLACEHOLDER, prefix, + Keg::CELLAR_PLACEHOLDER, cellar, :keg_only => f.keg_only? + end + end + sha1 = bottle_path.sha1 relocatable = false if File.size?(bottle_path) > 1*1024*1024 ohai "Detecting if #{filename} is relocatable..." end - keg = Keg.new f.prefix + keg.lock do # Relocate bottle library references before testing for built-in # references to the Cellar e.g. Qt's QMake annoyingly does this. diff --git a/Library/Homebrew/keg_fix_install_names.rb b/Library/Homebrew/keg_fix_install_names.rb index 3c46c1a2f8..80fdd8dde1 100644 --- a/Library/Homebrew/keg_fix_install_names.rb +++ b/Library/Homebrew/keg_fix_install_names.rb @@ -1,4 +1,7 @@ class Keg + PREFIX_PLACEHOLDER = "@@HOMEBREW_PREFIX@@".freeze + CELLAR_PLACEHOLDER = "@@HOMEBREW_CELLAR@@".freeze + def fix_install_names options={} mach_o_files.each do |file| install_names_for(file, options) do |id, bad_names|