From 49c99b70cf64ccf99cd292426b3dbcaeb2e885aa Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sat, 11 Feb 2017 18:15:12 -0500 Subject: [PATCH] cross-stdenv: Only prune most overrides in the final stage Before all overrides were also pruned in the previous stage, now only gcc and binutils are, because they alone care about about the target platform. The rest of the overrides don't, so it's better to preserve them in order to avoid spurious rebuilds. --- pkgs/stdenv/adapters.nix | 4 ++++ pkgs/stdenv/cross/default.nix | 4 +--- pkgs/stdenv/darwin/default.nix | 5 ++++- pkgs/stdenv/linux/default.nix | 8 +++++--- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix index 3ffe1ab15d9..65a0bf98456 100644 --- a/pkgs/stdenv/adapters.nix +++ b/pkgs/stdenv/adapters.nix @@ -58,6 +58,10 @@ rec { # builds. makeStdenvCross = stdenv: cross: binutilsCross: gccCross: stdenv // { + # Overrides are surely not valid as packages built with this run on a + # different platform. + overrides = _: _: {}; + mkDerivation = { name ? "", buildInputs ? [], nativeBuildInputs ? [] , propagatedBuildInputs ? [], propagatedNativeBuildInputs ? [] diff --git a/pkgs/stdenv/cross/default.nix b/pkgs/stdenv/cross/default.nix index 05910d100a8..dec4b036092 100644 --- a/pkgs/stdenv/cross/default.nix +++ b/pkgs/stdenv/cross/default.nix @@ -21,9 +21,7 @@ in bootStages ++ [ selfBuild = false; # It's OK to change the built-time dependencies allowCustomOverrides = true; - stdenv = vanillaPackages.stdenv // { - overrides = _: _: {}; - }; + inherit (vanillaPackages) stdenv; }) # Run Packages diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index e80c54e0218..8a517fddad8 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -253,7 +253,7 @@ in rec { inherit gnumake gzip gnused bzip2 gawk ed xz patch bash libcxxabi libcxx ncurses libffi zlib icu llvm gmp pcre gnugrep - coreutils findutils diffutils patchutils binutils binutils-raw; + coreutils findutils diffutils patchutils; llvmPackages = super.llvmPackages // { inherit (llvmPackages) llvm clang-unwrapped; @@ -262,6 +262,9 @@ in rec { darwin = super.darwin // { inherit (darwin) dyld Libsystem cctools libiconv; }; + } // lib.optionalAttrs (super.targetPlatform == localSystem) { + # Need to get rid of these when cross-compiling. + inherit binutils binutils-raw; }; stdenvDarwin = prevStage: let pkgs = prevStage; in import ../generic rec { diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index fe685a1e77c..3a244675b3a 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -298,12 +298,14 @@ in */ overrides = self: super: { - gcc = cc; - inherit (prevStage) - gzip bzip2 xz bash binutils coreutils diffutils findutils gawk + gzip bzip2 xz bash coreutils diffutils findutils gawk glibc gnumake gnused gnutar gnugrep gnupatch patchelf attr acl paxctl zlib pcre; + } // lib.optionalAttrs (super.targetPlatform == localSystem) { + # Need to get rid of these when cross-compiling. + inherit (prevStage) binutils; + gcc = cc; }; }; })