Skip to content

Commit

Permalink
os/mac: Delete old cctools-based relocation code.
Browse files Browse the repository at this point in the history
Disable check for $HOMEBREW_NO_RUBY_MACHO now that no alternative exists.
  • Loading branch information
woodruffw committed Sep 20, 2016
1 parent f6fef7c commit d16e4a7
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 220 deletions.
21 changes: 0 additions & 21 deletions Library/Homebrew/os/mac/cctools_keg.rb

This file was deleted.

99 changes: 0 additions & 99 deletions Library/Homebrew/os/mac/cctools_mach.rb

This file was deleted.

34 changes: 28 additions & 6 deletions Library/Homebrew/os/mac/keg.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,31 @@
class Keg
if !ENV["HOMEBREW_NO_RUBY_MACHO"]
require "os/mac/ruby_keg"
include RubyKeg
else
require "os/mac/cctools_keg"
include CctoolsKeg
def change_dylib_id(id, file)
@require_install_name_tool = 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)
@require_install_name_tool = 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

def require_install_name_tool?
@require_install_name_tool
end
end
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require "vendor/macho/macho"
require "os/mac/architecture_list"

module RubyMachO
module MachO
# @private
def macho
@macho ||= begin
Expand Down Expand Up @@ -57,4 +58,51 @@ def dynamically_linked_libraries
def dylib_id
macho.dylib_id
end

def archs
mach_data.map { |m| m.fetch :arch }.extend(ArchitectureListExtension)
end

def arch
case archs.length
when 0 then :dunno
when 1 then archs.first
else :universal
end
end

def universal?
arch == :universal
end

def i386?
arch == :i386
end

def x86_64?
arch == :x86_64
end

def ppc7400?
arch == :ppc7400
end

def ppc64?
arch == :ppc64
end

# @private
def dylib?
mach_data.any? { |m| m.fetch(:type) == :dylib }
end

# @private
def mach_o_executable?
mach_data.any? { |m| m.fetch(:type) == :executable }
end

# @private
def mach_o_bundle?
mach_data.any? { |m| m.fetch(:type) == :bundle }
end
end
12 changes: 2 additions & 10 deletions Library/Homebrew/os/mac/pathname.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
require "os/mac/shared_mach"
require "os/mac/mach"

class Pathname
if !ENV["HOMEBREW_NO_RUBY_MACHO"]
require "os/mac/ruby_mach"
include RubyMachO
else
require "os/mac/cctools_mach"
include CctoolsMachO
end

include SharedMachO
include MachO
end
33 changes: 0 additions & 33 deletions Library/Homebrew/os/mac/ruby_keg.rb

This file was deleted.

50 changes: 0 additions & 50 deletions Library/Homebrew/os/mac/shared_mach.rb

This file was deleted.

0 comments on commit d16e4a7

Please sign in to comment.