forked from mirrors/nixpkgs
cc-wrapper: add option to skip flags for native optimizations
This commit is contained in:
parent
89693e71b9
commit
0c6db0ca48
|
@ -91,6 +91,20 @@ if [ "$NIX_ENFORCE_PURITY" = 1 -a -n "$NIX_STORE" ]; then
|
||||||
params=("${rest[@]}")
|
params=("${rest[@]}")
|
||||||
fi
|
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
|
if [[ "$isCpp" = 1 ]]; then
|
||||||
NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE ${NIX_CXXSTDLIB_COMPILE-@default_cxx_stdlib_compile@}"
|
NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE ${NIX_CXXSTDLIB_COMPILE-@default_cxx_stdlib_compile@}"
|
||||||
NIX_CFLAGS_LINK="$NIX_CFLAGS_LINK $NIX_CXXSTDLIB_LINK"
|
NIX_CFLAGS_LINK="$NIX_CFLAGS_LINK $NIX_CXXSTDLIB_LINK"
|
||||||
|
|
|
@ -70,6 +70,20 @@ if [ "$NIX_ENFORCE_PURITY" = 1 -a -n "$NIX_STORE" ]; then
|
||||||
fi
|
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.
|
# Add the flags for the GNAT compiler proper.
|
||||||
extraAfter=($NIX_GNATFLAGS_COMPILE)
|
extraAfter=($NIX_GNATFLAGS_COMPILE)
|
||||||
extraBefore=()
|
extraBefore=()
|
||||||
|
|
|
@ -25,7 +25,6 @@ stdenv.mkDerivation rec {
|
||||||
''
|
''
|
||||||
sed -i GNUmakefile \
|
sed -i GNUmakefile \
|
||||||
-e 's|-march=native|${marchflags} -fPIC|g' \
|
-e 's|-march=native|${marchflags} -fPIC|g' \
|
||||||
-e 's|-mtune=native||g' \
|
|
||||||
-e '/^CXXFLAGS =/s|-g ||'
|
-e '/^CXXFLAGS =/s|-g ||'
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
|
@ -11,15 +11,6 @@ diff -rupN higan_v095-source.orig/GNUmakefile higan_v095-source/GNUmakefile
|
||||||
objects := libco
|
objects := libco
|
||||||
|
|
||||||
# profile-guided optimization mode
|
# profile-guided optimization mode
|
||||||
@@ -43,7 +44,7 @@ ifeq ($(platform),windows)
|
|
||||||
else ifeq ($(platform),macosx)
|
|
||||||
flags += -march=native
|
|
||||||
else ifeq ($(platform),linux)
|
|
||||||
- flags += -march=native -fopenmp
|
|
||||||
+ flags += -fopenmp
|
|
||||||
link += -fopenmp
|
|
||||||
link += -Wl,-export-dynamic
|
|
||||||
link += -lX11 -lXext -ldl
|
|
||||||
diff -rupN higan_v095-source.orig/icarus/GNUmakefile higan_v095-source/icarus/GNUmakefile
|
diff -rupN higan_v095-source.orig/icarus/GNUmakefile higan_v095-source/icarus/GNUmakefile
|
||||||
--- higan_v095-source.orig/icarus/GNUmakefile 2015-11-04 10:28:26.186486119 +0100
|
--- higan_v095-source.orig/icarus/GNUmakefile 2015-11-04 10:28:26.186486119 +0100
|
||||||
+++ higan_v095-source/icarus/GNUmakefile 2015-11-04 10:28:48.755059317 +0100
|
+++ higan_v095-source/icarus/GNUmakefile 2015-11-04 10:28:48.755059317 +0100
|
||||||
|
|
|
@ -26,6 +26,7 @@ in rec {
|
||||||
|
|
||||||
commonPreHook = ''
|
commonPreHook = ''
|
||||||
export NIX_ENFORCE_PURITY="''${NIX_ENFORCE_PURITY-1}"
|
export NIX_ENFORCE_PURITY="''${NIX_ENFORCE_PURITY-1}"
|
||||||
|
export NIX_ENFORCE_NO_NATIVE="''${NIX_ENFORCE_NO_NATIVE-1}"
|
||||||
export NIX_IGNORE_LD_THROUGH_GCC=1
|
export NIX_IGNORE_LD_THROUGH_GCC=1
|
||||||
stripAllFlags=" " # the Darwin "strip" command doesn't know "-s"
|
stripAllFlags=" " # the Darwin "strip" command doesn't know "-s"
|
||||||
export MACOSX_DEPLOYMENT_TARGET=10.7
|
export MACOSX_DEPLOYMENT_TARGET=10.7
|
||||||
|
|
|
@ -23,6 +23,7 @@ rec {
|
||||||
commonPreHook =
|
commonPreHook =
|
||||||
''
|
''
|
||||||
export NIX_ENFORCE_PURITY="''${NIX_ENFORCE_PURITY-1}"
|
export NIX_ENFORCE_PURITY="''${NIX_ENFORCE_PURITY-1}"
|
||||||
|
export NIX_ENFORCE_NO_NATIVE="''${NIX_ENFORCE_NO_NATIVE-1}"
|
||||||
${if system == "x86_64-linux" then "NIX_LIB64_IN_SELF_RPATH=1" else ""}
|
${if system == "x86_64-linux" then "NIX_LIB64_IN_SELF_RPATH=1" else ""}
|
||||||
${if system == "mips64el-linux" then "NIX_LIB32_IN_SELF_RPATH=1" else ""}
|
${if system == "mips64el-linux" then "NIX_LIB32_IN_SELF_RPATH=1" else ""}
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -16,6 +16,7 @@ rec {
|
||||||
# Disable purity tests; it's allowed (even needed) to link to
|
# Disable purity tests; it's allowed (even needed) to link to
|
||||||
# libraries outside the Nix store (like the C library).
|
# libraries outside the Nix store (like the C library).
|
||||||
export NIX_ENFORCE_PURITY=
|
export NIX_ENFORCE_PURITY=
|
||||||
|
export NIX_ENFORCE_NO_NATIVE="''${NIX_ENFORCE_NO_NATIVE-1}"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
prehookFreeBSD = ''
|
prehookFreeBSD = ''
|
||||||
|
|
|
@ -6,6 +6,7 @@ import ../generic rec {
|
||||||
preHook =
|
preHook =
|
||||||
''
|
''
|
||||||
export NIX_ENFORCE_PURITY="''${NIX_ENFORCE_PURITY-1}"
|
export NIX_ENFORCE_PURITY="''${NIX_ENFORCE_PURITY-1}"
|
||||||
|
export NIX_ENFORCE_NO_NATIVE="''${NIX_ENFORCE_NO_NATIVE-1}"
|
||||||
export NIX_IGNORE_LD_THROUGH_GCC=1
|
export NIX_IGNORE_LD_THROUGH_GCC=1
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
|
@ -13,11 +13,6 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake ];
|
nativeBuildInputs = [ cmake ];
|
||||||
|
|
||||||
postPatch = ''
|
|
||||||
substituteInPlace {.,pfcquirks}/CMakeLists.txt \
|
|
||||||
--replace "-march=native" ""
|
|
||||||
'';
|
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
|
|
|
@ -13,12 +13,6 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
buildInputs = [ pkgconfig autoconf automake openssl libgsf gmp ];
|
buildInputs = [ pkgconfig autoconf automake openssl libgsf gmp ];
|
||||||
|
|
||||||
patchPhase = ''
|
|
||||||
substituteInPlace Makefile.in \
|
|
||||||
--replace '-march=native' "" \
|
|
||||||
--replace '-mtune=native' ""
|
|
||||||
'';
|
|
||||||
|
|
||||||
installPhase =
|
installPhase =
|
||||||
''
|
''
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
|
|
Loading…
Reference in a new issue