Pull effective arch detection into a method
This commit is contained in:
parent
f0b75b2869
commit
e0f86a1a86
@ -301,17 +301,19 @@ module Stdenv
|
|||||||
remove flags, %r{-mssse3}
|
remove flags, %r{-mssse3}
|
||||||
remove flags, %r{-msse4(\.\d)?}
|
remove flags, %r{-msse4(\.\d)?}
|
||||||
append flags, xarch unless xarch.empty?
|
append flags, xarch unless xarch.empty?
|
||||||
|
append flags, map.fetch(effective_arch, default)
|
||||||
|
end
|
||||||
|
|
||||||
|
def effective_arch
|
||||||
if ARGV.build_bottle?
|
if ARGV.build_bottle?
|
||||||
arch = ARGV.bottle_arch || Hardware.oldest_cpu
|
ARGV.bottle_arch || Hardware.oldest_cpu
|
||||||
append flags, Hardware::CPU.optimization_flags.fetch(arch)
|
|
||||||
elsif Hardware::CPU.intel? && !Hardware::CPU.sse4?
|
elsif Hardware::CPU.intel? && !Hardware::CPU.sse4?
|
||||||
# If the CPU doesn't support SSE4, we cannot trust -march=native or
|
# 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
|
# -march=<cpu family> to do the right thing because we might be running
|
||||||
# in a VM or on a Hackintosh.
|
# in a VM or on a Hackintosh.
|
||||||
append flags, Hardware::CPU.optimization_flags.fetch(Hardware.oldest_cpu)
|
Hardware.oldest_cpu
|
||||||
else
|
else
|
||||||
append flags, map.fetch(Hardware::CPU.family, default)
|
Hardware::CPU.family
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user