about summary refs log tree commit diff
path: root/pkgs/build-support/cc-wrapper
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2015-03-06 19:04:43 +0000
committerShea Levy <shea@shealevy.com>2015-03-06 19:04:43 +0000
commitf91dea4c0be410c52d8131d6a1237f04b1b8da71 (patch)
treeab8d89141d478e9b92528c1efcd6507855ad0852 /pkgs/build-support/cc-wrapper
parent6b53021205cba1074ecddcdd269feb7bad9b34a9 (diff)
downloadnixlib-f91dea4c0be410c52d8131d6a1237f04b1b8da71.tar
nixlib-f91dea4c0be410c52d8131d6a1237f04b1b8da71.tar.gz
nixlib-f91dea4c0be410c52d8131d6a1237f04b1b8da71.tar.bz2
nixlib-f91dea4c0be410c52d8131d6a1237f04b1b8da71.tar.lz
nixlib-f91dea4c0be410c52d8131d6a1237f04b1b8da71.tar.xz
nixlib-f91dea4c0be410c52d8131d6a1237f04b1b8da71.tar.zst
nixlib-f91dea4c0be410c52d8131d6a1237f04b1b8da71.zip
cc-wrapper: Set default system include flags for non-gcc c++ on Linux
Without this, clang can't find libstdc++. This needs to happen in the wrapper
so that the libc++ setup hook can still override it
Diffstat (limited to 'pkgs/build-support/cc-wrapper')
-rw-r--r--pkgs/build-support/cc-wrapper/cc-wrapper.sh4
-rw-r--r--pkgs/build-support/cc-wrapper/default.nix6
2 files changed, 8 insertions, 2 deletions
diff --git a/pkgs/build-support/cc-wrapper/cc-wrapper.sh b/pkgs/build-support/cc-wrapper/cc-wrapper.sh
index 548b19106457..e374e1656a47 100644
--- a/pkgs/build-support/cc-wrapper/cc-wrapper.sh
+++ b/pkgs/build-support/cc-wrapper/cc-wrapper.sh
@@ -80,8 +80,8 @@ if [ "$NIX_ENFORCE_PURITY" = 1 -a -n "$NIX_STORE" ]; then
 fi
 
 if [[ "@prog@" = *++ ]]; then
-    if  echo "$@" | grep -qvw -- -nostdlib; then
-        NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE $NIX_CXXSTDLIB_COMPILE"
+    if  echo "$@" | grep -qv -- -nostdlib; then
+        NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE ${NIX_CXXSTDLIB_COMPILE-@default_cxx_stdlib_compile@}"
         NIX_CFLAGS_LINK="$NIX_CFLAGS_LINK $NIX_CXXSTDLIB_LINK"
     fi
 fi
diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix
index ac33a0b083c2..df43da58e3ec 100644
--- a/pkgs/build-support/cc-wrapper/default.nix
+++ b/pkgs/build-support/cc-wrapper/default.nix
@@ -169,6 +169,12 @@ stdenv.mkDerivation {
 
       export real_cc=cc
       export real_cxx=c++
+      export default_cxx_stdlib_compile="${
+        if stdenv.isLinux && !(cc.isGNU or false)
+          then "-isystem $(echo -n ${cc.gcc}/include/c++/*) -isystem $(echo -n ${cc.gcc}/include/c++/*)/$(${cc.gcc}/bin/gcc -dumpmachine)"
+          else ""
+      }"
+
       if [ -e $ccPath/gcc ]; then
         wrap gcc ${./cc-wrapper.sh} $ccPath/gcc
         ln -s gcc $out/bin/cc