summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2017-06-08 19:00:40 +0100
committerJörg Thalheim <joerg@thalheim.io>2017-06-08 19:50:40 +0100
commite2197465c16a3c04935eb892d6485b7551dd65f5 (patch)
treebcce7ea2f201fb45e9c3f9016e4f00822f5fdb96 /pkgs/build-support
parent3cb5d52dacba10121f7a20dbbd18a856f849a3a7 (diff)
downloadnixlib-e2197465c16a3c04935eb892d6485b7551dd65f5.tar
nixlib-e2197465c16a3c04935eb892d6485b7551dd65f5.tar.gz
nixlib-e2197465c16a3c04935eb892d6485b7551dd65f5.tar.bz2
nixlib-e2197465c16a3c04935eb892d6485b7551dd65f5.tar.lz
nixlib-e2197465c16a3c04935eb892d6485b7551dd65f5.tar.xz
nixlib-e2197465c16a3c04935eb892d6485b7551dd65f5.tar.zst
nixlib-e2197465c16a3c04935eb892d6485b7551dd65f5.zip
cc-wrapper: externalize default_cxx_stdlib_compile
This value is require to get c++ std include path for libclang based tools (vim plugins in my case).
I currently extract it this with this rather command:

```
eval echo $(nix-instantiate --eval --expr 'with (import <nixpkgs>) {}; clang.default_cxx_stdlib_compile')
```

it did not trigger any recompilation on my system.
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/cc-wrapper/default.nix12
1 files changed, 6 insertions, 6 deletions
diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix
index 95c6bee3cc77..e56f1f9a7d4a 100644
--- a/pkgs/build-support/cc-wrapper/default.nix
+++ b/pkgs/build-support/cc-wrapper/default.nix
@@ -34,6 +34,9 @@ let
   binutils_bin = if nativeTools then "" else getBin binutils;
   # The wrapper scripts use 'cat' and 'grep', so we may need coreutils.
   coreutils_bin = if nativeTools then "" else getBin coreutils;
+
+  default_cxx_stdlib_compile=optionalString (stdenv.isLinux && !(cc.isGNU or false))
+    "-isystem $(echo -n ${cc.gcc}/include/c++/*) -isystem $(echo -n ${cc.gcc}/include/c++/*)/$(${cc.gcc}/bin/gcc -dumpmachine)";
 in
 
 stdenv.mkDerivation {
@@ -46,8 +49,9 @@ stdenv.mkDerivation {
   inherit cc shell libc_bin libc_dev libc_lib binutils_bin coreutils_bin;
   gnugrep_bin = if nativeTools then "" else gnugrep;
 
+
   passthru = {
-    inherit libc nativeTools nativeLibc nativePrefix isGNU isClang;
+    inherit libc nativeTools nativeLibc nativePrefix isGNU isClang default_cxx_stdlib_compile;
 
     emacsBufferSetup = pkgs: ''
       ; We should handle propagation here too
@@ -189,11 +193,7 @@ 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 ""
-      }"
+      export default_cxx_stdlib_compile="${default_cxx_stdlib_compile}"
 
       if [ -e $ccPath/gcc ]; then
         wrap gcc ${./cc-wrapper.sh} $ccPath/gcc