diff options
| -rw-r--r-- | Library/Formula/libspotify.rb | 11 | ||||
| -rw-r--r-- | Library/Formula/notmuch.rb | 2 | ||||
| -rw-r--r-- | Library/Formula/v8.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/keg_fix_install_names.rb | 41 |
4 files changed, 31 insertions, 25 deletions
diff --git a/Library/Formula/libspotify.rb b/Library/Formula/libspotify.rb index 649c084a7..5df2b203c 100644 --- a/Library/Formula/libspotify.rb +++ b/Library/Formula/libspotify.rb @@ -12,13 +12,10 @@ class Libspotify < Formula doc.install %w(ChangeLog README LICENSE licenses.xhtml examples) man3.install Dir['man3/*'] - cd lib - ln_s "libspotify.12.1.51.dylib", "libspotify.dylib" - ln_s "libspotify.12.1.51.dylib", "libspotify.12.dylib" - - system "install_name_tool", "-id", - "#{HOMEBREW_PREFIX}/lib/libspotify.12.1.51.dylib", - "libspotify.dylib" + lib.cd do + ln_s "libspotify.12.1.51.dylib", "libspotify.dylib" + ln_s "libspotify.12.1.51.dylib", "libspotify.12.dylib" + end (lib+'pkgconfig/libspotify.pc').write pc_content end diff --git a/Library/Formula/notmuch.rb b/Library/Formula/notmuch.rb index 139bcc9a6..58961c2cd 100644 --- a/Library/Formula/notmuch.rb +++ b/Library/Formula/notmuch.rb @@ -13,7 +13,5 @@ class Notmuch < Formula # requires a newer emacs than OS X provides, so disable the bindings system "./configure", "--prefix=#{prefix}", "--without-emacs" system "make install" - system "install_name_tool", "-change", "libnotmuch.2.dylib", - "#{lib}/libnotmuch.2.dylib", "#{bin}/notmuch" end end diff --git a/Library/Formula/v8.rb b/Library/Formula/v8.rb index 14102ed67..9870eba77 100644 --- a/Library/Formula/v8.rb +++ b/Library/Formula/v8.rb @@ -25,7 +25,5 @@ class V8 < Formula prefix.install 'include' lib.install 'libv8.dylib' bin.install 'shell' => 'v8' - - system "install_name_tool", "-change", "libv8.dylib", "#{lib}/libv8.dylib", "#{bin}/v8" end end diff --git a/Library/Homebrew/keg_fix_install_names.rb b/Library/Homebrew/keg_fix_install_names.rb index 75e1def22..09cda1866 100644 --- a/Library/Homebrew/keg_fix_install_names.rb +++ b/Library/Homebrew/keg_fix_install_names.rb @@ -6,19 +6,17 @@ class Keg system MacOS.locate("install_name_tool"), "-id", id, file if file.dylib? bad_names.each do |bad_name| - new_name = bad_name - new_name = Pathname.new(bad_name).basename unless (file.parent + new_name).exist? - - # First check to see if the dylib is present in the current - # directory, so we can skip the more expensive search. - if (file.parent + new_name).exist? - system MacOS.locate("install_name_tool"), "-change", bad_name, "@loader_path/#{new_name}", file + # 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. + if file.dylib? or file.mach_o_bundle? and (file.parent + bad_name).exist? + system MacOS.locate("install_name_tool"), "-change", bad_name, "@loader_path/#{bad_name}", file + elsif file.mach_o_executable? and (lib/bad_name).exist? + system MacOS.locate("install_name_tool"), "-change", bad_name, "#{lib}/#{bad_name}", file else - # Otherwise, try and locate the appropriate dylib by walking - # the entire 'lib' tree recursively. - abs_name = (self+'lib').find do |pn| - break pn if pn.basename == Pathname.new(new_name) - end + # Otherwise, try and locate the dylib by walking the entire + # lib tree recursively. + abs_name = find_dylib(Pathname.new(bad_name).basename) if abs_name and abs_name.exist? system MacOS.locate("install_name_tool"), "-change", bad_name, abs_name, file @@ -36,6 +34,8 @@ class Keg OTOOL_RX = /\t(.*) \(compatibility version (\d+\.)*\d+, current version (\d+\.)*\d+\)/ + def lib; join 'lib' end + def bad_install_names_for file ENV['HOMEBREW_MACH_O_FILE'] = file.to_s # solves all shell escaping problems install_names = `#{MacOS.locate("otool")} -L "$HOMEBREW_MACH_O_FILE"`.split "\n" @@ -43,8 +43,8 @@ class Keg install_names.shift # first line is fluff install_names.map!{ |s| OTOOL_RX =~ s && $1 } - # Bundles don't have an ID - id = install_names.shift unless file.mach_o_bundle? + # Bundles and executables do not have an ID + id = install_names.shift if file.dylib? install_names.compact! install_names.reject!{ |fn| fn =~ /^@(loader|executable)_path/ } @@ -67,6 +67,12 @@ class Keg yield id, install_names end + def find_dylib name + (join 'lib').find do |pn| + break pn if pn.basename == Pathname.new(name) + end + end + def mach_o_files mach_o_files = [] if (lib = join 'lib').directory? @@ -75,6 +81,13 @@ class Keg mach_o_files << pn if pn.dylib? or pn.mach_o_bundle? end end + + if (bin = join 'bin').directory? + bin.find do |pn| + next if pn.symlink? or pn.directory? + mach_o_files << pn if pn.mach_o_executable? + end + end mach_o_files end end |
