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() { doSubstitute() {
local src=$1 local src=$1
local dst=$2 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 # Can't use substitute() here, because replace may not have been
# built yet (in the bootstrap). # built yet (in the bootstrap).
sed \ sed \
-e "s^@out@^$out^g" \ -e "s^@out@^$out^g" \
-e "s^@shell@^$shell^g" \ -e "s^@shell@^$shell^g" \
-e "s^@libcxx@^$uselibcxx^g" \
-e "s^@clang@^$clang^g" \ -e "s^@clang@^$clang^g" \
-e "s^@clangProg@^$clangProg^g" \ -e "s^@clangProg@^$clangProg^g" \
-e "s^@binutils@^$binutils^g" \ -e "s^@binutils@^$binutils^g" \

View File

@ -52,7 +52,6 @@ if test "$nonFlagArgs" = "0"; then
dontLink=1 dontLink=1
fi fi
# Optionally filter out paths not refering to the store. # Optionally filter out paths not refering to the store.
params=("$@") params=("$@")
if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE"; then 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[@]}") params=("${rest[@]}")
fi 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. # Add the flags for the C compiler proper.
extraAfter=($NIX_CFLAGS_COMPILE) extraAfter=($NIX_CFLAGS_COMPILE)

View File

@ -7,7 +7,7 @@
{ name ? "", stdenv, nativeTools, nativeLibc, nativePrefix ? "" { name ? "", stdenv, nativeTools, nativeLibc, nativePrefix ? ""
, clang ? null, libc ? null, binutils ? null, coreutils ? null, shell ? "" , clang ? null, libc ? null, binutils ? null, coreutils ? null, shell ? ""
, zlib ? null , zlib ? null, libcxx ? null
}: }:
assert nativeTools -> nativePrefix != ""; assert nativeTools -> nativePrefix != "";
@ -33,7 +33,7 @@ stdenv.mkDerivation {
utils = ./utils.sh; utils = ./utils.sh;
addFlags = ./add-flags; addFlags = ./add-flags;
inherit nativeTools nativeLibc nativePrefix clang clangVersion; inherit nativeTools nativeLibc nativePrefix clang clangVersion libcxx;
gcc = clang.gcc; gcc = clang.gcc;
libc = if nativeLibc then null else libc; libc = if nativeLibc then null else libc;
binutils = if nativeTools then null else binutils; binutils = if nativeTools then null else binutils;