@@ -1,4 +1,7 @@
1−{ newScope, stdenv, cmake, libxml2, python2, isl, fetchurl, overrideCC, wrapCC, ccWrapperFun }:
1+{ newScope, stdenv, libstdcxxHook, cmake, libxml2, python2, isl, fetchurl
2+, overrideCC, wrapCC, ccWrapperFun, darwin
3+}:
4+
25let
36 callPackage = newScope (self // { inherit stdenv cmake libxml2 python2 isl version fetch; });
47
@@ -22,20 +25,35 @@ let
2225 inherit clang-tools-extra_src stdenv;
2326 };
2427
25− clang = wrapCC self.clang-unwrapped;
28+ clang = if stdenv.cc.isGNU then self.libstdcxxClang else self.libcxxClang;
29+
30+ libstdcxxClang = ccWrapperFun {
31+ cc = self.clang-unwrapped;
32+ /* FIXME is this right? */
33+ inherit (stdenv.cc) libc nativeTools nativeLibc;
34+ extraPackages = [ libstdcxxHook ];
35+ };
2636
2737 libcxxClang = ccWrapperFun {
2838 cc = self.clang-unwrapped;
29− isClang = true;
30− inherit (self) stdenv;
3139 /* FIXME is this right? */
3240 inherit (stdenv.cc) libc nativeTools nativeLibc;
3341 extraPackages = [ self.libcxx self.libcxxabi ];
3442 };
3543
36− stdenv = overrideCC stdenv self.clang;
44+ stdenv = stdenv.override (drv: {
45+ allowedRequisites = null;
46+ cc = self.clang;
47+ # Don't include the libc++ and libc++abi from the original stdenv.
48+ extraBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.CF;
49+ });
3750
38− libcxxStdenv = overrideCC stdenv self.libcxxClang;
51+ libcxxStdenv = stdenv.override (drv: {
52+ allowedRequisites = null;
53+ cc = self.libcxxClang;
54+ # Don't include the libc++ and libc++abi from the original stdenv.
55+ extraBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.CF;
56+ });
3957
4058 lldb = callPackage ./lldb.nix {};
4159