Merge pull request #6098 from dalance/homebrew_arch

Add HOMEBREW_ARCH environment variable
This commit is contained in:
Mike McQuaid 2019-05-06 09:58:06 +01:00 committed by GitHub
commit 4025eadc2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,20 @@
module Hardware
class CPU
class << self
native_arch = (ENV["HOMEBREW_ARCH"] || "native").freeze
OPTIMIZATION_FLAGS_LINUX = {
native: "-march=#{native_arch}",
nehalem: "-march=nehalem",
core2: "-march=core2",
core: "-march=prescott",
armv6: "-march=armv6",
armv8: "-march=armv8-a",
}.freeze
def optimization_flags
OPTIMIZATION_FLAGS_LINUX
end
def cpuinfo
@cpuinfo ||= File.read("/proc/cpuinfo")
end