summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorPetr Rockai <me@mornfall.net>2013-09-07 11:02:32 +0200
committerPetr Rockai <me@mornfall.net>2013-11-16 13:53:48 +0100
commitdde70f937826f5a3545a6e52eed8303740237abf (patch)
tree5cfcb74f010c67886a8ef77e8fc55e2cc330c020 /pkgs
parent7c3f07f97c476111e36469a72fe91eb87942d2ac (diff)
downloadnixpkgs-dde70f937826f5a3545a6e52eed8303740237abf.tar
nixpkgs-dde70f937826f5a3545a6e52eed8303740237abf.tar.gz
nixpkgs-dde70f937826f5a3545a6e52eed8303740237abf.tar.bz2
nixpkgs-dde70f937826f5a3545a6e52eed8303740237abf.tar.lz
nixpkgs-dde70f937826f5a3545a6e52eed8303740237abf.tar.xz
nixpkgs-dde70f937826f5a3545a6e52eed8303740237abf.tar.zst
nixpkgs-dde70f937826f5a3545a6e52eed8303740237abf.zip
clang-wrapper: Optionally use libc++ instead of libstdc++.
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/build-support/clang-wrapper/builder.sh3
-rw-r--r--pkgs/build-support/clang-wrapper/clang-wrapper.sh5
-rw-r--r--pkgs/build-support/clang-wrapper/default.nix4
3 files changed, 9 insertions, 3 deletions
diff --git a/pkgs/build-support/clang-wrapper/builder.sh b/pkgs/build-support/clang-wrapper/builder.sh
index 9f1542e0411..3f90b9d32bd 100644
--- a/pkgs/build-support/clang-wrapper/builder.sh
+++ b/pkgs/build-support/clang-wrapper/builder.sh
@@ -58,11 +58,14 @@ fi
 doSubstitute() {
     local src=$1
     local dst=$2
+    local uselibcxx=
+    if test -n "$libcxx" && echo $dst | fgrep ++; then uselibcxx=$libcxx; fi
     # Can't use substitute() here, because replace may not have been
     # built yet (in the bootstrap).
     sed \
         -e "s^@out@^$out^g" \
         -e "s^@shell@^$shell^g" \
+        -e "s^@libcxx@^$uselibcxx^g" \
         -e "s^@clang@^$clang^g" \
         -e "s^@clangProg@^$clangProg^g" \
         -e "s^@binutils@^$binutils^g" \
diff --git a/pkgs/build-support/clang-wrapper/clang-wrapper.sh b/pkgs/build-support/clang-wrapper/clang-wrapper.sh
index 4f710856868..84067844cad 100644
--- a/pkgs/build-support/clang-wrapper/clang-wrapper.sh
+++ b/pkgs/build-support/clang-wrapper/clang-wrapper.sh
@@ -52,7 +52,6 @@ if test "$nonFlagArgs" = "0"; then
     dontLink=1
 fi
 
-
 # Optionally filter out paths not refering to the store.
 params=("$@")
 if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE"; then
@@ -79,6 +78,10 @@ if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE"; then
     params=("${rest[@]}")
 fi
 
+if test -n "@libcxx@"; then
+    NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -isystem@libcxx@/include/c++/v1 -stdlib=libc++"
+    NIX_CFLAGS_LINK="$NIX_CFLAGS_LINK -L@libcxx@/lib -stdlib=libc++ -lc++abi"
+fi
 
 # Add the flags for the C compiler proper.
 extraAfter=($NIX_CFLAGS_COMPILE)
diff --git a/pkgs/build-support/clang-wrapper/default.nix b/pkgs/build-support/clang-wrapper/default.nix
index 9f560d0d2fb..1b2a02fa86a 100644
--- a/pkgs/build-support/clang-wrapper/default.nix
+++ b/pkgs/build-support/clang-wrapper/default.nix
@@ -7,7 +7,7 @@
 
 { name ? "", stdenv, nativeTools, nativeLibc, nativePrefix ? ""
 , clang ? null, libc ? null, binutils ? null, coreutils ? null, shell ? ""
-, zlib ? null
+, zlib ? null, libcxx ? null
 }:
 
 assert nativeTools -> nativePrefix != "";
@@ -33,7 +33,7 @@ stdenv.mkDerivation {
   utils = ./utils.sh;
   addFlags = ./add-flags;
   
-  inherit nativeTools nativeLibc nativePrefix clang clangVersion;
+  inherit nativeTools nativeLibc nativePrefix clang clangVersion libcxx;
   gcc = clang.gcc;
   libc = if nativeLibc then null else libc;
   binutils = if nativeTools then null else binutils;