diff options
| author | ilovezfs | 2017-09-08 12:38:00 -0700 |
|---|---|---|
| committer | GitHub | 2017-09-08 12:38:00 -0700 |
| commit | 914378cf2ef8104a4659772945e5f77945ea16cd (patch) | |
| tree | a9761c962fc627f7f194244fe8372b7b2e33cd8c /Library/Homebrew | |
| parent | a77a1f949ad84f37e9c5bc500a6d1d735ed65fb8 (diff) | |
| parent | a4c5e64da426a15e673c348e7083b6705f3875e6 (diff) | |
| download | brew-914378cf2ef8104a4659772945e5f77945ea16cd.tar.bz2 | |
Merge pull request #3138 from Homebrew/revert-3101-macho-use-object
Revert "mach: Avoid reopening the file for relocation"
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/extend/os/mac/keg_relocate.rb | 8 | ||||
| -rw-r--r-- | Library/Homebrew/os/mac.rb | 1 | ||||
| -rw-r--r-- | Library/Homebrew/os/mac/keg.rb | 29 | ||||
| -rw-r--r-- | Library/Homebrew/os/mac/mach.rb | 28 |
4 files changed, 34 insertions, 32 deletions
diff --git a/Library/Homebrew/extend/os/mac/keg_relocate.rb b/Library/Homebrew/extend/os/mac/keg_relocate.rb index 7031bea1e..707710be6 100644 --- a/Library/Homebrew/extend/os/mac/keg_relocate.rb +++ b/Library/Homebrew/extend/os/mac/keg_relocate.rb @@ -2,7 +2,7 @@ class Keg def fix_dynamic_linkage mach_o_files.each do |file| file.ensure_writable do - file.change_dylib_id(dylib_id_for(file)) if file.dylib? + change_dylib_id(dylib_id_for(file), file) if file.dylib? each_install_name_for(file) do |bad_name| # Don't fix absolute paths unless they are rooted in the build directory @@ -11,7 +11,7 @@ class Keg !bad_name.start_with?(HOMEBREW_TEMP.realpath.to_s) new_name = fixed_name(file, bad_name) - file.change_install_name(bad_name, new_name, file) + change_install_name(bad_name, new_name, file) unless new_name == bad_name end end end @@ -24,7 +24,7 @@ class Keg file.ensure_writable do if file.dylib? id = dylib_id_for(file).sub(relocation.old_prefix, relocation.new_prefix) - file.change_dylib_id(id) + change_dylib_id(id, file) end each_install_name_for(file) do |old_name| @@ -34,7 +34,7 @@ class Keg new_name = old_name.sub(relocation.old_prefix, relocation.new_prefix) end - file.change_install_name(old_name, new_name) if new_name + change_install_name(old_name, new_name, file) if new_name end end end diff --git a/Library/Homebrew/os/mac.rb b/Library/Homebrew/os/mac.rb index b2a3109f1..5074665fc 100644 --- a/Library/Homebrew/os/mac.rb +++ b/Library/Homebrew/os/mac.rb @@ -5,6 +5,7 @@ require "os/mac/xcode" require "os/mac/xquartz" require "os/mac/pathname" require "os/mac/sdk" +require "os/mac/keg" module OS module Mac diff --git a/Library/Homebrew/os/mac/keg.rb b/Library/Homebrew/os/mac/keg.rb new file mode 100644 index 000000000..6caadb1d7 --- /dev/null +++ b/Library/Homebrew/os/mac/keg.rb @@ -0,0 +1,29 @@ +class Keg + def change_dylib_id(id, file) + return if file.dylib_id == id + @require_relocation = true + puts "Changing dylib ID of #{file}\n from #{file.dylib_id}\n to #{id}" if ARGV.debug? + MachO::Tools.change_dylib_id(file, id, strict: false) + rescue MachO::MachOError + onoe <<-EOS.undent + Failed changing dylib ID of #{file} + from #{file.dylib_id} + to #{id} + EOS + raise + end + + def change_install_name(old, new, file) + return if old == new + @require_relocation = true + puts "Changing install name in #{file}\n from #{old}\n to #{new}" if ARGV.debug? + MachO::Tools.change_install_name(file, old, new, strict: false) + rescue MachO::MachOError + onoe <<-EOS.undent + Failed changing install name in #{file} + from #{old} + to #{new} + EOS + raise + end +end diff --git a/Library/Homebrew/os/mac/mach.rb b/Library/Homebrew/os/mac/mach.rb index 2d066392f..9b53c4979 100644 --- a/Library/Homebrew/os/mac/mach.rb +++ b/Library/Homebrew/os/mac/mach.rb @@ -61,34 +61,6 @@ module MachOShim macho.dylib_id end - def change_dylib_id(id) - return if dylib_id == id - @require_relocation = true - puts "Changing dylib ID of #{self}\n from #{dylib_id}\n to #{id}" if ARGV.debug? - macho.change_dylib_id(id, strict: false) - rescue MachO::MachOError - onoe <<-EOS.undent - Failed changing dylib ID of #{self} - from #{file.dylib_id} - to #{id} - EOS - raise - end - - def change_install_name(old, new) - return if old == new - @require_relocation = true - puts "Changing install name in #{self}\n from #{old}\n to #{new}" if ARGV.debug? - macho.change_install_name(old, new, strict: false) - rescue MachO::MachOError - onoe <<-EOS.undent - Failed changing install name in #{self} - from #{old} - to #{new} - EOS - raise - end - def archs mach_data.map { |m| m.fetch :arch }.extend(ArchitectureListExtension) end |
