From 46514076540597a8af783938a538ddebf2b2e446 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sun, 24 Dec 2017 22:00:58 -0500 Subject: [PATCH] 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. --- .../compilers/llvm/3.7/default.nix | 4 ---- .../compilers/llvm/3.8/default.nix | 4 ---- .../compilers/llvm/3.9/default.nix | 4 ---- pkgs/development/compilers/llvm/4/default.nix | 4 ---- pkgs/development/compilers/llvm/5/default.nix | 4 ---- pkgs/stdenv/darwin/default.nix | 20 ++++++++++++++----- 6 files changed, 15 insertions(+), 25 deletions(-) diff --git a/pkgs/development/compilers/llvm/3.7/default.nix b/pkgs/development/compilers/llvm/3.7/default.nix index 35af978216c6..5cac04c044de 100644 --- a/pkgs/development/compilers/llvm/3.7/default.nix +++ b/pkgs/development/compilers/llvm/3.7/default.nix @@ -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 {}; diff --git a/pkgs/development/compilers/llvm/3.8/default.nix b/pkgs/development/compilers/llvm/3.8/default.nix index bd79db012a63..a660d4aea5fd 100644 --- a/pkgs/development/compilers/llvm/3.8/default.nix +++ b/pkgs/development/compilers/llvm/3.8/default.nix @@ -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 {}; diff --git a/pkgs/development/compilers/llvm/3.9/default.nix b/pkgs/development/compilers/llvm/3.9/default.nix index 5ce51bc9c122..c58adc3f92da 100644 --- a/pkgs/development/compilers/llvm/3.9/default.nix +++ b/pkgs/development/compilers/llvm/3.9/default.nix @@ -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 {}; diff --git a/pkgs/development/compilers/llvm/4/default.nix b/pkgs/development/compilers/llvm/4/default.nix index fa61a6c22e71..5a44cb868253 100644 --- a/pkgs/development/compilers/llvm/4/default.nix +++ b/pkgs/development/compilers/llvm/4/default.nix @@ -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 {}; diff --git a/pkgs/development/compilers/llvm/5/default.nix b/pkgs/development/compilers/llvm/5/default.nix index 9891f3090ac1..d2a73b6035f2 100644 --- a/pkgs/development/compilers/llvm/5/default.nix +++ b/pkgs/development/compilers/llvm/5/default.nix @@ -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 {}; diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index d202186c29b2..2542d2428859 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -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;