diff options
| author | William Woodruff | 2016-01-26 11:57:58 -0500 |
|---|---|---|
| committer | Mike McQuaid | 2016-02-03 21:24:21 +0000 |
| commit | 35e2209c10ffcf6a666ac4a8051a1f20801895ea (patch) | |
| tree | 9cabf6df35a5ba84f0ff7f64d256603c1aaf6c91 /Library | |
| parent | 0d094ac8efeab285d788d640e4a9f1ebff3bdff7 (diff) | |
| download | brew-35e2209c10ffcf6a666ac4a8051a1f20801895ea.tar.bz2 | |
architecture_list: add new module.
remove old mach.rb, replace with cctools_mach.rb and prune ELF case
move ArchitectureListExtension to separate file ELF support is
maintained in Linuxbrew
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/os/mac/architecture_list.rb | 52 | ||||
| -rw-r--r-- | Library/Homebrew/os/mac/cctools_mach.rb (renamed from Library/Homebrew/os/mac/mach.rb) | 57 |
2 files changed, 54 insertions, 55 deletions
diff --git a/Library/Homebrew/os/mac/architecture_list.rb b/Library/Homebrew/os/mac/architecture_list.rb new file mode 100644 index 000000000..809a27077 --- /dev/null +++ b/Library/Homebrew/os/mac/architecture_list.rb @@ -0,0 +1,52 @@ +module ArchitectureListExtension + # @private + def fat? + length > 1 + end + + # @private + def intel_universal? + intersects_all?(Hardware::CPU::INTEL_32BIT_ARCHS, Hardware::CPU::INTEL_64BIT_ARCHS) + end + + # @private + def ppc_universal? + intersects_all?(Hardware::CPU::PPC_32BIT_ARCHS, Hardware::CPU::PPC_64BIT_ARCHS) + end + + # Old-style 32-bit PPC/Intel universal, e.g. ppc7400 and i386 + # @private + def cross_universal? + intersects_all?(Hardware::CPU::PPC_32BIT_ARCHS, Hardware::CPU::INTEL_32BIT_ARCHS) + end + + # @private + def universal? + intel_universal? || ppc_universal? || cross_universal? + end + + def ppc? + (Hardware::CPU::PPC_32BIT_ARCHS+Hardware::CPU::PPC_64BIT_ARCHS).any? { |a| self.include? a } + end + + # @private + def remove_ppc! + (Hardware::CPU::PPC_32BIT_ARCHS+Hardware::CPU::PPC_64BIT_ARCHS).each { |a| delete a } + end + + def as_arch_flags + collect { |a| "-arch #{a}" }.join(" ") + end + + def as_cmake_arch_flags + join(";") + end + + protected + + def intersects_all?(*set) + set.all? do |archset| + archset.any? { |a| self.include? a } + end + end +end diff --git a/Library/Homebrew/os/mac/mach.rb b/Library/Homebrew/os/mac/cctools_mach.rb index b2060e375..60f12a7ee 100644 --- a/Library/Homebrew/os/mac/mach.rb +++ b/Library/Homebrew/os/mac/cctools_mach.rb @@ -1,57 +1,6 @@ -module ArchitectureListExtension - # @private - def fat? - length > 1 - end - - # @private - def intel_universal? - intersects_all?(Hardware::CPU::INTEL_32BIT_ARCHS, Hardware::CPU::INTEL_64BIT_ARCHS) - end - - # @private - def ppc_universal? - intersects_all?(Hardware::CPU::PPC_32BIT_ARCHS, Hardware::CPU::PPC_64BIT_ARCHS) - end - - # Old-style 32-bit PPC/Intel universal, e.g. ppc7400 and i386 - # @private - def cross_universal? - intersects_all?(Hardware::CPU::PPC_32BIT_ARCHS, Hardware::CPU::INTEL_32BIT_ARCHS) - end - - # @private - def universal? - intel_universal? || ppc_universal? || cross_universal? - end - - def ppc? - (Hardware::CPU::PPC_32BIT_ARCHS+Hardware::CPU::PPC_64BIT_ARCHS).any? { |a| self.include? a } - end - - # @private - def remove_ppc! - (Hardware::CPU::PPC_32BIT_ARCHS+Hardware::CPU::PPC_64BIT_ARCHS).each { |a| delete a } - end - - def as_arch_flags - collect { |a| "-arch #{a}" }.join(" ") - end - - def as_cmake_arch_flags - join(";") - end - - protected - - def intersects_all?(*set) - set.all? do |archset| - archset.any? { |a| self.include? a } - end - end -end +require "os/mac/architecture_list" -module MachO +module CctoolsMachO # @private OTOOL_RX = /\t(.*) \(compatibility version (?:\d+\.)*\d+, current version (?:\d+\.)*\d+\)/ @@ -77,8 +26,6 @@ module MachO end when 0xcefaedfe, 0xcffaedfe, 0xfeedface, 0xfeedfacf # Single arch offsets << 0 - when 0x7f454c46 # ELF - mach_data << { :arch => :x86_64, :type => :executable } else raise "Not a Mach-O binary." end |
