3
0
Fork 0
forked from mirrors/nixpkgs

darwin stdenv: Make stdenv.cc, not stdenv, bring in libcxx

stdenvNoCC should not inject any C++ standard library, just as it
doesn't inject any C standard library. stdenv still does, but only
indirectly through stdenv.cc. Wrapped clangs can be simplified now that
they don't need to worry about clobbering CoreFoundation when replacing
the C++ standard library implementation.

This generally-good cleanup should assist with debugging some C++
failures in #26805.
This commit is contained in:
John Ericson 2017-12-24 22:00:58 -05:00
parent dc906952be
commit 4651407654
6 changed files with 15 additions and 25 deletions

View file

@ -44,15 +44,11 @@ let
stdenv = stdenv.override (drv: {
allowedRequisites = null;
cc = self.clang;
# Don't include the libc++ and libc++abi from the original stdenv.
extraBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.CF;
});
libcxxStdenv = stdenv.override (drv: {
allowedRequisites = null;
cc = self.libcxxClang;
# Don't include the libc++ and libc++abi from the original stdenv.
extraBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.CF;
});
lldb = callPackage ./lldb.nix {};

View file

@ -41,15 +41,11 @@ let
stdenv = stdenv.override (drv: {
allowedRequisites = null;
cc = self.clang;
# Don't include the libc++ and libc++abi from the original stdenv.
extraBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.CF;
});
libcxxStdenv = stdenv.override (drv: {
allowedRequisites = null;
cc = self.libcxxClang;
# Don't include the libc++ and libc++abi from the original stdenv.
extraBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.CF;
});
lldb = callPackage ./lldb.nix {};

View file

@ -41,15 +41,11 @@ let
stdenv = stdenv.override (drv: {
allowedRequisites = null;
cc = self.clang;
# Don't include the libc++ and libc++abi from the original stdenv.
extraBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.CF;
});
libcxxStdenv = stdenv.override (drv: {
allowedRequisites = null;
cc = self.libcxxClang;
# Don't include the libc++ and libc++abi from the original stdenv.
extraBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.CF;
});
lldb = callPackage ./lldb.nix {};

View file

@ -56,15 +56,11 @@ let
stdenv = stdenv.override (drv: {
allowedRequisites = null;
cc = self.clang;
# Don't include the libc++ and libc++abi from the original stdenv.
extraBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.CF;
});
libcxxStdenv = stdenv.override (drv: {
allowedRequisites = null;
cc = self.libcxxClang;
# Don't include the libc++ and libc++abi from the original stdenv.
extraBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.CF;
});
lld = callPackage ./lld.nix {};

View file

@ -56,15 +56,11 @@ let
stdenv = stdenv.override (drv: {
allowedRequisites = null;
cc = self.clang;
# Don't include the libc++ and libc++abi from the original stdenv.
extraBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.CF;
});
libcxxStdenv = stdenv.override (drv: {
allowedRequisites = null;
cc = self.libcxxClang;
# Don't include the libc++ and libc++abi from the original stdenv.
extraBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.CF;
});
lld = callPackage ./lld.nix {};

View file

@ -58,6 +58,7 @@ in rec {
extraPreHook ? "",
extraNativeBuildInputs,
extraBuildInputs,
libcxx,
allowedRequisites ? null}:
let
buildPackages = lib.optionalAttrs (last ? stdenv) {
@ -82,6 +83,8 @@ in rec {
inherit shell;
inherit (last) stdenvNoCC;
extraPackages = lib.optional (libcxx != null) libcxx;
nativeTools = false;
nativeLibc = false;
inherit buildPackages coreutils gnugrep bintools;
@ -176,6 +179,7 @@ in rec {
extraNativeBuildInputs = [];
extraBuildInputs = [];
libcxx = null;
};
stage1 = prevStage: let
@ -183,7 +187,8 @@ in rec {
in with prevStage; stageFun 1 prevStage {
extraPreHook = "export NIX_CFLAGS_COMPILE+=\" -F${bootstrapTools}/Library/Frameworks\"";
extraNativeBuildInputs = [];
extraBuildInputs = [ pkgs.libcxx ];
extraBuildInputs = [ ];
libcxx = pkgs.libcxx;
allowedRequisites =
[ bootstrapTools ] ++ (with pkgs; [ libcxx libcxxabi ]) ++ [ pkgs.darwin.Libsystem ];
@ -210,7 +215,8 @@ in rec {
'';
extraNativeBuildInputs = [ pkgs.xz ];
extraBuildInputs = with pkgs; [ darwin.CF libcxx ];
extraBuildInputs = [ pkgs.darwin.CF ];
libcxx = pkgs.libcxx;
allowedRequisites =
[ bootstrapTools ] ++
@ -242,7 +248,8 @@ in rec {
# and instead goes by $PATH, which happens to contain bootstrapTools. So it goes and
# patches our shebangs back to point at bootstrapTools. This makes sure bash comes first.
extraNativeBuildInputs = with pkgs; [ xz pkgs.bash ];
extraBuildInputs = with pkgs; [ darwin.CF libcxx ];
extraBuildInputs = [ pkgs.darwin.CF ];
libcxx = pkgs.libcxx;
extraPreHook = ''
export PATH=${pkgs.bash}/bin:$PATH
@ -277,7 +284,9 @@ in rec {
in with prevStage; stageFun 4 prevStage {
shell = "${pkgs.bash}/bin/bash";
extraNativeBuildInputs = with pkgs; [ xz pkgs.bash ];
extraBuildInputs = with pkgs; [ darwin.CF libcxx ];
extraBuildInputs = [ pkgs.darwin.CF ];
libcxx = pkgs.libcxx;
extraPreHook = ''
export PATH_LOCALE=${pkgs.darwin.locale}/share/locale
'';
@ -347,10 +356,11 @@ in rec {
cc = pkgs.llvmPackages.clang-unwrapped;
bintools = pkgs.darwin.binutils;
libc = pkgs.darwin.Libsystem;
extraPackages = [ pkgs.libcxx ];
};
extraNativeBuildInputs = [];
extraBuildInputs = with pkgs; [ darwin.CF libcxx ];
extraBuildInputs = [ pkgs.darwin.CF ];
extraAttrs = {
inherit platform bootstrapTools;