From c6fd1ceaef4a8b4bd446310d4598b194847a9ef2 Mon Sep 17 00:00:00 2001 From: dalance Date: Mon, 6 May 2019 14:34:35 +0900 Subject: [PATCH] Add HOMEBREW_ARCH --- Library/Homebrew/extend/os/linux/hardware/cpu.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Library/Homebrew/extend/os/linux/hardware/cpu.rb b/Library/Homebrew/extend/os/linux/hardware/cpu.rb index 4de99e35f7..a0530ea98a 100644 --- a/Library/Homebrew/extend/os/linux/hardware/cpu.rb +++ b/Library/Homebrew/extend/os/linux/hardware/cpu.rb @@ -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