diff options
| author | Jack Nagel | 2013-12-14 09:35:57 -0600 |
|---|---|---|
| committer | Jack Nagel | 2013-12-14 09:35:57 -0600 |
| commit | fab1edb889ab0f2f86d9dcf1e67c7ce4390cd8ff (patch) | |
| tree | 005c48aad237a1ce7e5ed31d3774463d61fdcba5 /Library | |
| parent | acb89948edc5d331d9d7db270afc119d1e12c92e (diff) | |
| download | homebrew-fab1edb889ab0f2f86d9dcf1e67c7ce4390cd8ff.tar.bz2 | |
keg: decouple dylib id changes from install name changes
The dylib id calculation does not use any information gathered in
install_names_for, so we can pull the logic out completely and only
yield the install names.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/keg_fix_install_names.rb | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/Library/Homebrew/keg_fix_install_names.rb b/Library/Homebrew/keg_fix_install_names.rb index 0b17547c7..e23c162e3 100644 --- a/Library/Homebrew/keg_fix_install_names.rb +++ b/Library/Homebrew/keg_fix_install_names.rb @@ -4,10 +4,10 @@ class Keg def fix_install_names options={} mach_o_files.each do |file| - install_names_for(file, options) do |id, bad_names| - file.ensure_writable do - change_dylib_id(id, file) if file.dylib? + file.ensure_writable do + change_dylib_id(dylib_id_for(file, options), file) if file.dylib? + install_names_for(file) do |bad_names| bad_names.each do |bad_name| new_name = fixed_name(file, bad_name) unless new_name == bad_name @@ -22,16 +22,19 @@ class Keg def relocate_install_names old_prefix, new_prefix, old_cellar, new_cellar, options={} mach_o_files.each do |file| file.ensure_writable do - install_names_for(file, options, relocate_reject_proc(old_cellar)) do |id, old_cellar_names| + if file.dylib? + id = dylib_id_for(file, options).sub(old_prefix, new_prefix) + change_dylib_id(id, file) + end + + install_names_for(file, relocate_reject_proc(old_cellar)) do |old_cellar_names| old_cellar_names.each do |old_cellar_name| new_cellar_name = old_cellar_name.sub(old_cellar, new_cellar) change_install_name(old_cellar_name, new_cellar_name, file) end end - install_names_for(file, options, relocate_reject_proc(old_prefix)) do |id, old_prefix_names| - change_dylib_id(id.sub(old_prefix, new_prefix), file) if file.dylib? - + install_names_for(file, relocate_reject_proc(old_prefix)) do |old_prefix_names| old_prefix_names.each do |old_prefix_name| new_prefix_name = old_prefix_name.sub(old_prefix, new_prefix) change_install_name(old_prefix_name, new_prefix_name, file) @@ -120,7 +123,7 @@ class Keg Proc.new { |fn| not fn.start_with?(path) } end - def install_names_for file, options, reject_proc=default_reject_proc + def install_names_for file, reject_proc=default_reject_proc 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" @@ -134,7 +137,7 @@ class Keg 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 + yield install_names end def dylib_id_for file, options={} |
