diff options
| author | William Woodruff | 2017-08-28 17:33:57 -0400 |
|---|---|---|
| committer | William Woodruff | 2017-09-25 17:46:23 -0400 |
| commit | d618e574fb641de7d820208dec51bebe460cf32f (patch) | |
| tree | c980489c68d44fb34f65c09afa9ae8ca9cb5e4e3 /Library/Homebrew/extend/os | |
| parent | 551e5dd94578062e0ab42bc56e0fdd106807839b (diff) | |
| download | brew-d618e574fb641de7d820208dec51bebe460cf32f.tar.bz2 | |
mach: Avoid reopening the file for relocation
This commit allows the relocation code to perform install name
and dylib ID changes without reopening the file separately.
Diffstat (limited to 'Library/Homebrew/extend/os')
| -rw-r--r-- | Library/Homebrew/extend/os/mac/keg_relocate.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/Library/Homebrew/extend/os/mac/keg_relocate.rb b/Library/Homebrew/extend/os/mac/keg_relocate.rb index 707710be6..7a1f42f8b 100644 --- a/Library/Homebrew/extend/os/mac/keg_relocate.rb +++ b/Library/Homebrew/extend/os/mac/keg_relocate.rb @@ -2,7 +2,10 @@ class Keg def fix_dynamic_linkage mach_o_files.each do |file| file.ensure_writable do - change_dylib_id(dylib_id_for(file), file) if file.dylib? + if file.dylib? + @require_relocation = true + file.change_dylib_id(dylib_id_for(file)) + end each_install_name_for(file) do |bad_name| # Don't fix absolute paths unless they are rooted in the build directory @@ -11,7 +14,9 @@ class Keg !bad_name.start_with?(HOMEBREW_TEMP.realpath.to_s) new_name = fixed_name(file, bad_name) - change_install_name(bad_name, new_name, file) unless new_name == bad_name + + @require_relocation = true + file.change_install_name(bad_name, new_name, file) end end end @@ -23,8 +28,9 @@ class Keg mach_o_files.each do |file| file.ensure_writable do if file.dylib? + @require_relocation = true id = dylib_id_for(file).sub(relocation.old_prefix, relocation.new_prefix) - change_dylib_id(id, file) + file.change_dylib_id(id) end each_install_name_for(file) do |old_name| @@ -34,7 +40,8 @@ class Keg new_name = old_name.sub(relocation.old_prefix, relocation.new_prefix) end - change_install_name(old_name, new_name, file) if new_name + @require_relocation = true + file.change_install_name(old_name, new_name) if new_name end end end |
