Merge pull request #5429 from MikeMcQuaid/nehalem-sierra-bottles
hardware: use Nehalem flags on >= Sierra.
This commit is contained in:
commit
1a78cc77d4
@ -233,6 +233,9 @@ module Superenv
|
|||||||
if ARGV.build_bottle?
|
if ARGV.build_bottle?
|
||||||
arch = ARGV.bottle_arch || Hardware.oldest_cpu
|
arch = ARGV.bottle_arch || Hardware.oldest_cpu
|
||||||
Hardware::CPU.optimization_flags.fetch(arch)
|
Hardware::CPU.optimization_flags.fetch(arch)
|
||||||
|
# If the CPU doesn't support SSE4, we cannot trust -march=native or
|
||||||
|
# -march=<cpu family> to do the right thing because we might be running
|
||||||
|
# in a VM or on a Hackintosh.
|
||||||
elsif Hardware::CPU.intel? && !Hardware::CPU.sse4?
|
elsif Hardware::CPU.intel? && !Hardware::CPU.sse4?
|
||||||
Hardware::CPU.optimization_flags.fetch(Hardware.oldest_cpu)
|
Hardware::CPU.optimization_flags.fetch(Hardware.oldest_cpu)
|
||||||
elsif ![:gcc_4_0, :gcc_4_2].include?(compiler)
|
elsif ![:gcc_4_0, :gcc_4_2].include?(compiler)
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
if OS.mac?
|
if OS.mac?
|
||||||
|
require "extend/os/mac/hardware"
|
||||||
require "extend/os/mac/hardware/cpu"
|
require "extend/os/mac/hardware/cpu"
|
||||||
elsif OS.linux?
|
elsif OS.linux?
|
||||||
require "extend/os/linux/hardware/cpu"
|
require "extend/os/linux/hardware/cpu"
|
||||||
|
|||||||
9
Library/Homebrew/extend/os/mac/hardware.rb
Normal file
9
Library/Homebrew/extend/os/mac/hardware.rb
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
module Hardware
|
||||||
|
def self.oldest_cpu
|
||||||
|
if MacOS.version >= :sierra
|
||||||
|
:nehalem
|
||||||
|
else
|
||||||
|
generic_oldest_cpu
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -7,10 +7,11 @@ module Hardware
|
|||||||
|
|
||||||
class << self
|
class << self
|
||||||
OPTIMIZATION_FLAGS = {
|
OPTIMIZATION_FLAGS = {
|
||||||
core2: "-march=core2",
|
nehalem: "-march=nehalem -msse4.2",
|
||||||
core: "-march=prescott",
|
core2: "-march=core2",
|
||||||
armv6: "-march=armv6",
|
core: "-march=prescott",
|
||||||
armv8: "-march=armv8-a",
|
armv6: "-march=armv6",
|
||||||
|
armv8: "-march=armv8-a",
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
def optimization_flags
|
def optimization_flags
|
||||||
@ -130,35 +131,38 @@ module Hardware
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.cores_as_words
|
class << self
|
||||||
case Hardware::CPU.cores
|
def cores_as_words
|
||||||
when 1 then "single"
|
case Hardware::CPU.cores
|
||||||
when 2 then "dual"
|
when 1 then "single"
|
||||||
when 4 then "quad"
|
when 2 then "dual"
|
||||||
when 6 then "hexa"
|
when 4 then "quad"
|
||||||
when 8 then "octa"
|
when 6 then "hexa"
|
||||||
when 12 then "dodeca"
|
when 8 then "octa"
|
||||||
else
|
when 12 then "dodeca"
|
||||||
Hardware::CPU.cores
|
else
|
||||||
|
Hardware::CPU.cores
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def self.oldest_cpu
|
def oldest_cpu
|
||||||
if Hardware::CPU.intel?
|
if Hardware::CPU.intel?
|
||||||
if Hardware::CPU.is_64_bit?
|
if Hardware::CPU.is_64_bit?
|
||||||
:core2
|
:core2
|
||||||
|
else
|
||||||
|
:core
|
||||||
|
end
|
||||||
|
elsif Hardware::CPU.arm?
|
||||||
|
if Hardware::CPU.is_64_bit?
|
||||||
|
:armv8
|
||||||
|
else
|
||||||
|
:armv6
|
||||||
|
end
|
||||||
else
|
else
|
||||||
:core
|
Hardware::CPU.family
|
||||||
end
|
end
|
||||||
elsif Hardware::CPU.arm?
|
|
||||||
if Hardware::CPU.is_64_bit?
|
|
||||||
:armv8
|
|
||||||
else
|
|
||||||
:armv6
|
|
||||||
end
|
|
||||||
else
|
|
||||||
Hardware::CPU.family
|
|
||||||
end
|
end
|
||||||
|
alias generic_oldest_cpu oldest_cpu
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user