Use Hardware::CPU module
This commit is contained in:
parent
dc454aad92
commit
50db35e5d3
@ -84,7 +84,7 @@ def bottle_tag
|
|||||||
when 10.8, 10.7, 10.5
|
when 10.8, 10.7, 10.5
|
||||||
MacOS.cat
|
MacOS.cat
|
||||||
when 10.6
|
when 10.6
|
||||||
Hardware.is_64_bit? ? :snow_leopard : :snow_leopard_32
|
Hardware::CPU.is_64_bit? ? :snow_leopard : :snow_leopard_32
|
||||||
else
|
else
|
||||||
Hardware::CPU.type == :ppc ? Hardware::CPU.family : MacOS.cat
|
Hardware::CPU.type == :ppc ? Hardware::CPU.family : MacOS.cat
|
||||||
end
|
end
|
||||||
|
@ -23,7 +23,7 @@ module Homebrew extend self
|
|||||||
end
|
end
|
||||||
|
|
||||||
def check_ppc
|
def check_ppc
|
||||||
case Hardware.cpu_type when :ppc, :dunno
|
case Hardware::CPU.type when :ppc, :dunno
|
||||||
abort <<-EOS.undent
|
abort <<-EOS.undent
|
||||||
Sorry, Homebrew does not support your computer's CPU architecture.
|
Sorry, Homebrew does not support your computer's CPU architecture.
|
||||||
For PPC support, see: https://github.com/mistydemeo/tigerbrew
|
For PPC support, see: https://github.com/mistydemeo/tigerbrew
|
||||||
|
@ -299,7 +299,7 @@ module HomebrewEnvExtension
|
|||||||
|
|
||||||
unless compiler == :clang
|
unless compiler == :clang
|
||||||
# Can't mix "-march" for a 32-bit CPU with "-arch x86_64"
|
# Can't mix "-march" for a 32-bit CPU with "-arch x86_64"
|
||||||
replace_in_cflags(/-march=\S*/, '-Xarch_i386 \0') if Hardware.is_32_bit?
|
replace_in_cflags(/-march=\S*/, '-Xarch_i386 \0') if Hardware::CPU.is_32_bit?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -372,7 +372,7 @@ module HomebrewEnvExtension
|
|||||||
if self['HOMEBREW_MAKE_JOBS'].to_i > 0
|
if self['HOMEBREW_MAKE_JOBS'].to_i > 0
|
||||||
self['HOMEBREW_MAKE_JOBS'].to_i
|
self['HOMEBREW_MAKE_JOBS'].to_i
|
||||||
else
|
else
|
||||||
Hardware.processor_count
|
Hardware::CPU.cores
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -37,12 +37,12 @@ class Hardware
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.cores_as_words
|
def self.cores_as_words
|
||||||
case Hardware.processor_count
|
case Hardware::CPU.cores
|
||||||
when 1 then 'single'
|
when 1 then 'single'
|
||||||
when 2 then 'dual'
|
when 2 then 'dual'
|
||||||
when 4 then 'quad'
|
when 4 then 'quad'
|
||||||
else
|
else
|
||||||
Hardware.processor_count
|
Hardware::CPU.cores
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ module MacOS extend self
|
|||||||
end
|
end
|
||||||
|
|
||||||
def prefer_64_bit?
|
def prefer_64_bit?
|
||||||
Hardware.is_64_bit? and version != :leopard
|
Hardware::CPU.is_64_bit? and version != :leopard
|
||||||
end
|
end
|
||||||
|
|
||||||
STANDARD_COMPILERS = {
|
STANDARD_COMPILERS = {
|
||||||
|
@ -196,7 +196,7 @@ class << ENV
|
|||||||
|
|
||||||
def determine_make_jobs
|
def determine_make_jobs
|
||||||
if (j = ENV['HOMEBREW_MAKE_JOBS'].to_i) < 1
|
if (j = ENV['HOMEBREW_MAKE_JOBS'].to_i) < 1
|
||||||
Hardware.processor_count
|
Hardware::CPU.cores
|
||||||
else
|
else
|
||||||
j
|
j
|
||||||
end
|
end
|
||||||
|
@ -22,13 +22,13 @@ class BottleTagTests < Test::Unit::TestCase
|
|||||||
|
|
||||||
def test_cat_snow_leopard_32
|
def test_cat_snow_leopard_32
|
||||||
MacOS.stubs(:version).returns(MacOS::Version.new(10.6))
|
MacOS.stubs(:version).returns(MacOS::Version.new(10.6))
|
||||||
Hardware.stubs(:is_64_bit?).returns(false)
|
Hardware::CPU.stubs(:is_64_bit?).returns(false)
|
||||||
assert_equal :snow_leopard_32, bottle_tag
|
assert_equal :snow_leopard_32, bottle_tag
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_cat_snow_leopard_64
|
def test_cat_snow_leopard_64
|
||||||
MacOS.stubs(:version).returns(MacOS::Version.new(10.6))
|
MacOS.stubs(:version).returns(MacOS::Version.new(10.6))
|
||||||
Hardware.stubs(:is_64_bit?).returns(true)
|
Hardware::CPU.stubs(:is_64_bit?).returns(true)
|
||||||
assert_equal :snow_leopard, bottle_tag
|
assert_equal :snow_leopard, bottle_tag
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ class HardwareTests < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_hardware_intel_family
|
def test_hardware_intel_family
|
||||||
if Hardware.cpu_type == :intel
|
if Hardware::CPU.type == :intel
|
||||||
assert [:core, :core2, :penryn, :nehalem,
|
assert [:core, :core2, :penryn, :nehalem,
|
||||||
:arrandale, :sandybridge, :ivybridge].include?(Hardware::CPU.family)
|
:arrandale, :sandybridge, :ivybridge].include?(Hardware::CPU.family)
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user