clang-wrapper: Optionally use libc++ instead of libstdc++.

This commit is contained in:
Petr Rockai 2013-09-07 11:02:32 +02:00
parent 7c3f07f97c
commit dde70f9378
3 changed files with 9 additions and 3 deletions

View file

@ -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" \

View file

@ -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)

View file

@ -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;