cc-wrapper: add option to skip flags for native optimizations
This commit is contained in:
@@ -91,6 +91,20 @@ if [ "$NIX_ENFORCE_PURITY" = 1 -a -n "$NIX_STORE" ]; then
|
||||
params=("${rest[@]}")
|
||||
fi
|
||||
|
||||
|
||||
# Clear march/mtune=native -- they bring impurity.
|
||||
if [ "$NIX_ENFORCE_NO_NATIVE" = 1 ]; then
|
||||
rest=()
|
||||
for i in "${params[@]}"; do
|
||||
if [[ "$i" = -m*=native ]]; then
|
||||
skip $i
|
||||
else
|
||||
rest=("${rest[@]}" "$i")
|
||||
fi
|
||||
done
|
||||
params=("${rest[@]}")
|
||||
fi
|
||||
|
||||
if [[ "$isCpp" = 1 ]]; then
|
||||
NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE ${NIX_CXXSTDLIB_COMPILE-@default_cxx_stdlib_compile@}"
|
||||
NIX_CFLAGS_LINK="$NIX_CFLAGS_LINK $NIX_CXXSTDLIB_LINK"
|
||||
|
||||
@@ -70,6 +70,20 @@ if [ "$NIX_ENFORCE_PURITY" = 1 -a -n "$NIX_STORE" ]; then
|
||||
fi
|
||||
|
||||
|
||||
# Clear march/mtune=native -- they bring impurity.
|
||||
if [ "$NIX_ENFORCE_NO_NATIVE" = 1 ]; then
|
||||
rest=()
|
||||
for i in "${params[@]}"; do
|
||||
if [[ "$i" = -m*=native ]]; then
|
||||
skip $i
|
||||
else
|
||||
rest=("${rest[@]}" "$i")
|
||||
fi
|
||||
done
|
||||
params=("${rest[@]}")
|
||||
fi
|
||||
|
||||
|
||||
# Add the flags for the GNAT compiler proper.
|
||||
extraAfter=($NIX_GNATFLAGS_COMPILE)
|
||||
extraBefore=()
|
||||
|
||||
Reference in New Issue
Block a user