aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2016-07-16 21:05:07 +0100
committerMike McQuaid2016-07-27 15:05:42 -0600
commit892a3239bc4b382ed2c1b714396650f28096da2e (patch)
treebc763d44bab04f7365a10cf5ec52202c5108f27a /Library
parent270b0ec78301a93f88815f1cee8eaf492a586727 (diff)
downloadbrew-892a3239bc4b382ed2c1b714396650f28096da2e.tar.bz2
hardware: more porting to generic layer.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/hardware.rb15
-rw-r--r--Library/Homebrew/test/test_hardware.rb4
2 files changed, 15 insertions, 4 deletions
diff --git a/Library/Homebrew/hardware.rb b/Library/Homebrew/hardware.rb
index c705c5e50..5447854a6 100644
--- a/Library/Homebrew/hardware.rb
+++ b/Library/Homebrew/hardware.rb
@@ -28,7 +28,11 @@ module Hardware
end
def type
- :dunno
+ case RUBY_PLATFORM
+ when /x86_64/, /i\d86/ then :intel
+ when /ppc\d+/ then :ppc
+ else :dunno
+ end
end
def family
@@ -40,7 +44,14 @@ module Hardware
end
def bits
- 64
+ case RUBY_PLATFORM
+ when /x86_64/, /ppc64/ then 64
+ when /i\d86/, /ppc/ then 32
+ end
+ end
+
+ def sse4?
+ RUBY_PLATFORM.to_s.include?("x86_64")
end
def is_32_bit?
diff --git a/Library/Homebrew/test/test_hardware.rb b/Library/Homebrew/test/test_hardware.rb
index d38c74df6..56d0980fa 100644
--- a/Library/Homebrew/test/test_hardware.rb
+++ b/Library/Homebrew/test/test_hardware.rb
@@ -3,11 +3,11 @@ require "hardware"
class HardwareTests < Homebrew::TestCase
def test_hardware_cpu_type
- assert_includes [:intel, :ppc], Hardware::CPU.type
+ assert_includes [:intel, :ppc, :dunno], Hardware::CPU.type
end
def test_hardware_intel_family
- families = [:core, :core2, :penryn, :nehalem, :arrandale, :sandybridge, :ivybridge, :haswell, :broadwell, :skylake]
+ families = [:core, :core2, :penryn, :nehalem, :arrandale, :sandybridge, :ivybridge, :haswell, :broadwell, :skylake, :dunno]
assert_includes families, Hardware::CPU.family
end if Hardware::CPU.intel?
end