diff --git a/pkgs/build-support/clang-wrapper/builder.sh b/pkgs/build-support/clang-wrapper/builder.sh index 2dec6c59933..6a8ea6370df 100644 --- a/pkgs/build-support/clang-wrapper/builder.sh +++ b/pkgs/build-support/clang-wrapper/builder.sh @@ -70,17 +70,11 @@ fi doSubstitute() { local src=$1 local dst=$2 - local uselibcxx= - local uselibcxxabi= - if test -n "$libcxx" && echo $dst | fgrep ++; then uselibcxx=$libcxx; fi - if test -n "$libcxxabi" && echo $dst | fgrep ++; then uselibcxxabi=$libcxxabi; 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^@libcxxabi@^$uselibcxxabi^g" \ -e "s^@clang@^$clang^g" \ -e "s^@clangProg@^$clangProg^g" \ -e "s^@binutils@^$binutils^g" \ @@ -151,3 +145,5 @@ cp -p $utils $out/nix-support/utils.sh if test -z "$nativeTools"; then echo $clang $binutils $libc > $out/nix-support/propagated-user-env-packages fi + +echo $extraPackages > $out/nix-support/propagated-native-build-inputs diff --git a/pkgs/build-support/clang-wrapper/clang-wrapper.sh b/pkgs/build-support/clang-wrapper/clang-wrapper.sh index bad257fd9b0..c375fc951c0 100644 --- a/pkgs/build-support/clang-wrapper/clang-wrapper.sh +++ b/pkgs/build-support/clang-wrapper/clang-wrapper.sh @@ -79,11 +79,6 @@ if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE"; then NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE --sysroot=/var/empty" 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++ -L@libcxxabi@/lib" -fi - # Add the flags for the C compiler proper. extraAfter=($NIX_CFLAGS_COMPILE) extraBefore=() diff --git a/pkgs/build-support/clang-wrapper/default.nix b/pkgs/build-support/clang-wrapper/default.nix index e61c07ca9d2..c49bc4c0893 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, libcxx ? null +, zlib ? null, extraPackages ? [] }: assert nativeTools -> nativePrefix != ""; @@ -35,9 +35,7 @@ stdenv.mkDerivation { utils = ../gcc-wrapper/utils.sh; addFlags = ./add-flags; - inherit nativeTools nativeLibc nativePrefix clang clangVersion libcxx; - - libcxxabi = libcxx.abi or null; + inherit nativeTools nativeLibc nativePrefix clang clangVersion extraPackages; gcc = clang.gcc; libc = if nativeLibc then null else libc; diff --git a/pkgs/development/libraries/libc++/default.nix b/pkgs/development/libraries/libc++/default.nix index 71705d47d12..ae4b9d825e8 100644 --- a/pkgs/development/libraries/libc++/default.nix +++ b/pkgs/development/libraries/libc++/default.nix @@ -29,6 +29,8 @@ stdenv.mkDerivation rec { # Remove a Makefile that causes many retained dependencies. postInstall = "rm $out/include/c++/v1/Makefile"; + setupHook = ./setup-hook.sh; + meta = { homepage = http://libcxx.llvm.org/; description = "A new implementation of the C++ standard library, targeting C++11"; diff --git a/pkgs/development/libraries/libc++/setup-hook.sh b/pkgs/development/libraries/libc++/setup-hook.sh new file mode 100644 index 00000000000..e2b1b10e8a3 --- /dev/null +++ b/pkgs/development/libraries/libc++/setup-hook.sh @@ -0,0 +1,2 @@ +NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -isystem @out@/include/c++/v1 -stdlib=libc++" +NIX_CFLAGS_LINK="$NIX_CFLAGS_LINK -stdlib=libc++" diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index 6ab83aae188..08d9e713494 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -28,11 +28,12 @@ import ../generic rec { nativeTools = false; nativeLibc = true; inherit stdenv; - libcxx = if haveLibCxx then pkgs.libcxx.override { - libcxxabi = pkgs.libcxxabi.override { - libunwind = pkgs.libunwindNative; - }; - } else null; + extraPackages = + stdenv.lib.optional haveLibCxx (pkgs.libcxx.override { + libcxxabi = pkgs.libcxxabi.override { + libunwind = pkgs.libunwindNative; + }; + }); binutils = import ../../build-support/native-darwin-cctools-wrapper {inherit stdenv;}; clang = if useClang33 then pkgs.clang_33.clang else pkgs.clang.clang; coreutils = pkgs.coreutils;