Skip to content
Snippets Groups Projects
Unverified Commit 89aeaffd authored by Carlo Cabrera's avatar Carlo Cabrera Committed by GitHub
Browse files

Merge pull request #11608 from carlocab/runtime-arch

superenv: handle formulae with runtime CPU detection
parents b2478dcd 0404da7b
No related branches found
No related tags found
No related merge requests found
......@@ -91,10 +91,11 @@ module Superenv
# g - Enable "-stdlib=libc++" for clang.
# h - Enable "-stdlib=libstdc++" for clang.
# K - Don't strip -arch <arch>, -m32, or -m64
# d - Don't strip -march=<target>. Use only in formulae that
# have runtime detection of CPU features.
# w - Pass -no_weak_imports to the linker
#
# These flags will also be present:
# s - apply fix for sed's Unicode support
# a - apply fix for apr-1-config path
end
alias generic_setup_build_environment setup_build_environment
......@@ -314,6 +315,11 @@ module Superenv
append_to_cccfg "K"
end
sig { void }
def runtime_cpu_detection
append_to_cccfg "d"
end
sig { void }
def cxx11
append_to_cccfg "x"
......
......@@ -173,10 +173,12 @@ class Cmd
case arg
when /^-g\d?$/, /^-gstabs\d+/, "-gstabs+", /^-ggdb\d?/,
/^-march=.+/, /^-mtune=.+/, /^-mcpu=.+/,
/^-O[0-9zs]?$/, "-fast", "-no-cpp-precomp",
"-pedantic", "-pedantic-errors", "-Wno-long-double",
/^-mtune=.+/, /^-mcpu=.+/, /^-O[0-9zs]?$/,
"-fast", "-no-cpp-precomp", "-pedantic",
"-pedantic-errors", "-Wno-long-double",
"-Wno-unused-but-set-variable"
when /^-march=.+/
args << arg if runtime_cpu_detection?
when "-fopenmp", "-lgomp", "-mno-fused-madd", "-fforce-addr", "-fno-defer-pop",
"-mno-dynamic-no-pic", "-fearly-inlining", /^-f(?:no-)?inline-functions-called-once/,
/^-finline-limit/, /^-f(?:no-)?check-new/, "-fno-delete-null-pointer-checks",
......@@ -283,7 +285,7 @@ class Cmd
args << "-pipe"
args << "-w" unless configure?
args << "-#{ENV["HOMEBREW_OPTIMIZATION_LEVEL"]}"
args.concat(optflags)
args.concat(optflags) unless runtime_cpu_detection?
args.concat(archflags)
args << "-std=#{@arg0}" if /c[89]9/.match?(@arg0)
args
......@@ -385,6 +387,10 @@ class Cmd
config.include?("K")
end
def runtime_cpu_detection?
config.include?("d")
end
def no_weak_imports?
config.include?("w")
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment