git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #28998 from LnL7/libstdcxx-hook

libstdc++: add setup-hook

commit0adb83e2a2b4140a97d90ddcc0c801808e3f4af8 authorDaiderd Jordan <daiderd@gmail.com> dateTue 5 Sep 2017, 21:40 (9 years ago) parent402e6ac9072220
3 files changed+18−2
pkgs/development/compilers/gcc/libstdc++-hook.sh+2 pkgs/development/compilers/llvm/4/default.nix+12−2 pkgs/top-level/all-packages.nix+4
pkgs/development/compilers/gcc/libstdc++-hook.shnew file+2
@@ -0,0 +1,2 @@
1+export NIX_CXXSTDLIB_COMPILE+="-isystem $(echo -n @gcc@/include/c++/*) -isystem $(echo -n @gcc@/include/c++/*)/$(@gcc@/bin/gcc -dumpmachine)"
2+export NIX_CXXSTDLIB_LINK=" -stdlib=libstdc++"
pkgs/development/compilers/llvm/4/default.nix+12−2
@@ -1,4 +1,8 @@
1−{ lowPrio, newScope, stdenv, cmake, libxml2, python2, isl, fetchurl, overrideCC, wrapCC, darwin, ccWrapperFun }:
1+{ lowPrio, newScope, stdenv, targetPlatform, cmake, libstdcxxHook
2+, libxml2, python2, isl, fetchurl, overrideCC, wrapCC, ccWrapperFun
3+, darwin
4+}:
5+
26let
37 callPackage = newScope (self // { inherit stdenv cmake libxml2 python2 isl release_version version fetch; });
48
@@ -46,7 +50,12 @@ let
4650 extraPackages = [ self.libcxx self.libcxxabi ];
4751 };
4852
49− stdenv = overrideCC stdenv self.clang;
53+ stdenv = stdenv.override (drv: {
54+ allowedRequisites = null;
55+ cc = self.clang;
56+ # Use the gcc libstdc++ when targeting linux.
57+ extraBuildInputs = if stdenv.cc.isGNU then [ libstdcxxHook ] else drv.extraBuildInputs;
58+ });
5059
5160 libcxxStdenv = overrideCC stdenv self.libcxxClang;
5261
@@ -58,4 +67,5 @@ let
5867
5968 libcxxabi = callPackage ./libc++abi.nix {};
6069 };
70+
6171in self
pkgs/top-level/all-packages.nix+4
@@ -5360,6 +5360,10 @@ with pkgs;
53605360
53615361 gccApple = throw "gccApple is no longer supported";
53625362
5363+ libstdcxxHook = makeSetupHook
5364+ { substitutions = { gcc = gcc-unwrapped; }; }
5365+ ../development/compilers/gcc/libstdc++-hook.sh;
5366+
53635367 # Can't just overrideCC, because then the stdenv-cross mkDerivation will be
53645368 # thrown away. TODO: find a better solution for this.
53655369 crossLibcStdenv = buildPackages.makeStdenvCross {