diff options
| author | Jack Nagel | 2013-12-14 09:35:57 -0600 |
|---|---|---|
| committer | Jack Nagel | 2013-12-14 09:35:57 -0600 |
| commit | acb89948edc5d331d9d7db270afc119d1e12c92e (patch) | |
| tree | 20294a473498fc240569dc7ffba23a2528c7d5e8 /Library/Homebrew/keg_fix_install_names.rb | |
| parent | 619a6225c00cc20b71a1a40585785a9f27bf3870 (diff) | |
| download | homebrew-acb89948edc5d331d9d7db270afc119d1e12c92e.tar.bz2 | |
keg: factor out dylib id calculation
Diffstat (limited to 'Library/Homebrew/keg_fix_install_names.rb')
| -rw-r--r-- | Library/Homebrew/keg_fix_install_names.rb | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Library/Homebrew/keg_fix_install_names.rb b/Library/Homebrew/keg_fix_install_names.rb index 1eb2e5737..0b17547c7 100644 --- a/Library/Homebrew/keg_fix_install_names.rb +++ b/Library/Homebrew/keg_fix_install_names.rb @@ -127,23 +127,26 @@ class Keg install_names.shift # first line is fluff install_names.map!{ |s| OTOOL_RX =~ s && $1 } - # Bundles and executables do not have an ID - id = install_names.shift if file.dylib? + # For dylibs, the next line is the ID + install_names.shift if file.dylib? install_names.compact! install_names.reject!{ |fn| fn =~ /^@(loader_|executable_|r)path/ } install_names.reject!{ |fn| reject_proc.call(fn) } + yield dylib_id_for(file, options), install_names + end + + def dylib_id_for file, options={} # the shortpath ensures that library upgrades don’t break installed tools relative_path = Pathname.new(file).relative_path_from(self) shortpath = HOMEBREW_PREFIX.join(relative_path) - id = if shortpath.exist? and not options[:keg_only] + + if shortpath.exist? and not options[:keg_only] shortpath else "#{HOMEBREW_PREFIX}/opt/#{fname}/#{relative_path}" end - - yield id, install_names end def find_dylib name |
