std: use HOMEBREW_ARCH env var on Linux

Unlike macOS, Linux installations can be installed/deployed on a
variety of hardware. The HOMEBREW_ARCH environment variable
allows the end user to set a custom -march=... option for the
compiler. If the variable is not set, it defaults to "native".

This only applies on Linux; on macOS, behavior remains unchanged.
This commit is contained in:
Caleb Xu 2018-09-05 16:06:11 -04:00
parent 88bf60d589
commit 90c25bf913

View File

@ -7,7 +7,8 @@ module Stdenv
# @private
SAFE_CFLAGS_FLAGS = "-w -pipe".freeze
DEFAULT_FLAGS = "-march=core2 -msse4".freeze
HOMEBREW_ARCH = (ENV["HOMEBREW_ARCH"] || "native").freeze
DEFAULT_FLAGS = (OS.mac? ? "-march=core2 -msse4" : "-march=#{HOMEBREW_ARCH}").freeze
# @private
def setup_build_environment(formula = nil)