aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/extend
diff options
context:
space:
mode:
authorWilliam Woodruff2017-09-25 23:30:42 -0400
committerGitHub2017-09-25 23:30:42 -0400
commit6098998674389638dc1831d2ee17baf54d99e6c6 (patch)
tree9d6f7a37df0993701be812b265200b1af02f6693 /Library/Homebrew/extend
parenta5893036166b9708d705a5060aa85002d5a6be16 (diff)
parentd618e574fb641de7d820208dec51bebe460cf32f (diff)
downloadbrew-6098998674389638dc1831d2ee17baf54d99e6c6.tar.bz2
Merge pull request #3139 from woodruffw/macho-use-object
mach: Avoid reopening the file for relocation
Diffstat (limited to 'Library/Homebrew/extend')
-rw-r--r--Library/Homebrew/extend/os/mac/keg_relocate.rb15
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