Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libstdc++: add setup-hook #28998

Merged
merged 2 commits into from
Sep 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pkgs/development/compilers/gcc/libstdc++-hook.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export NIX_CXXSTDLIB_COMPILE+="-isystem $(echo -n @gcc@/include/c++/*) -isystem $(echo -n @gcc@/include/c++/*)/$(@gcc@/bin/gcc -dumpmachine)"
export NIX_CXXSTDLIB_LINK=" -stdlib=libstdc++"
14 changes: 12 additions & 2 deletions pkgs/development/compilers/llvm/4/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{ lowPrio, newScope, stdenv, cmake, libxml2, python2, isl, fetchurl, overrideCC, wrapCC, darwin, ccWrapperFun }:
{ lowPrio, newScope, stdenv, targetPlatform, cmake, libstdcxxHook
, libxml2, python2, isl, fetchurl, overrideCC, wrapCC, ccWrapperFun
, darwin
}:

let
callPackage = newScope (self // { inherit stdenv cmake libxml2 python2 isl release_version version fetch; });

Expand Down Expand Up @@ -46,7 +50,12 @@ let
extraPackages = [ self.libcxx self.libcxxabi ];
};

stdenv = overrideCC stdenv self.clang;
stdenv = stdenv.override (drv: {
allowedRequisites = null;
cc = self.clang;
# Use the gcc libstdc++ when targeting linux.
extraBuildInputs = if stdenv.cc.isGNU then [ libstdcxxHook ] else drv.extraBuildInputs;
});

libcxxStdenv = overrideCC stdenv self.libcxxClang;

Expand All @@ -58,4 +67,5 @@ let

libcxxabi = callPackage ./libc++abi.nix {};
};

in self
4 changes: 4 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5354,6 +5354,10 @@ with pkgs;

gccApple = throw "gccApple is no longer supported";

libstdcxxHook = makeSetupHook
{ substitutions = { gcc = gcc-unwrapped; }; }
../development/compilers/gcc/libstdc++-hook.sh;

# Can't just overrideCC, because then the stdenv-cross mkDerivation will be
# thrown away. TODO: find a better solution for this.
crossLibcStdenv = buildPackages.makeStdenvCross {
Expand Down