wrapCC, wrapBintools: move expand-response-params bootstrapping out
The cc and bintools wrapper contained ad hoc bootstrapping logic for expand-response-params (which was callPackage-ed in a let binding). This lead to the strange situation that the bootstrapping logic related to expand-response-params is split between the wrapper derivations (where it is duplicated) and the actual stdenv bootstrapping. To clean this up, the wrappers simply should take expand-response-params as an ordinary input: They need an adjacent expand-response-params (i.e. one that runs on their host platform), but don't care about the how. Providing this is only problematic during stdenv bootstrapping where we have to pull it from the previous stage at times.
This commit is contained in:
parent
b2a568906a
commit
7be562d046
5 changed files with 25 additions and 33 deletions
|
@ -29,7 +29,7 @@
|
|||
, isGNU ? bintools.isGNU or false
|
||||
, isLLVM ? bintools.isLLVM or false
|
||||
, isCCTools ? bintools.isCCTools or false
|
||||
, buildPackages ? {}
|
||||
, expand-response-params
|
||||
, targetPackages ? {}
|
||||
, useMacosReexportHack ? false
|
||||
, wrapGas ? false
|
||||
|
@ -132,10 +132,6 @@ let
|
|||
else if hasSuffix "pc-gnu" targetPlatform.config then "ld.so.1"
|
||||
else "";
|
||||
|
||||
expand-response-params =
|
||||
optionalString (buildPackages ? stdenv && buildPackages.stdenv.hasCC && buildPackages.stdenv.cc != "/dev/null")
|
||||
(import ../expand-response-params { inherit (buildPackages) stdenv; });
|
||||
|
||||
in
|
||||
|
||||
stdenvNoCC.mkDerivation {
|
||||
|
@ -419,6 +415,7 @@ stdenvNoCC.mkDerivation {
|
|||
|
||||
env = {
|
||||
# for substitution in utils.bash
|
||||
# TODO(@sternenseemann): invent something cleaner than passing in "" in case of absence
|
||||
expandResponseParams = "${expand-response-params}/bin/expand-response-params";
|
||||
# TODO(@sternenseemann): rename env var via stdenv rebuild
|
||||
shell = (getBin runtimeShell + runtimeShell.shellPath or "");
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
, extraTools ? [], extraPackages ? [], extraBuildCommands ? ""
|
||||
, nixSupport ? {}
|
||||
, isGNU ? false, isClang ? cc.isClang or false, isCcache ? cc.isCcache or false, gnugrep ? null
|
||||
, buildPackages ? {}
|
||||
, expand-response-params
|
||||
, libcxx ? null
|
||||
|
||||
# Whether or not to add `-B` and `-L` to `nix-support/cc-{c,ld}flags`
|
||||
|
@ -113,9 +113,6 @@ let
|
|||
# unstable implementation detail, however.
|
||||
suffixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config;
|
||||
|
||||
expand-response-params =
|
||||
optionalString ((buildPackages.stdenv.hasCC or false) && buildPackages.stdenv.cc != "/dev/null") (import ../expand-response-params { inherit (buildPackages) stdenv; });
|
||||
|
||||
useGccForLibs = useCcForLibs
|
||||
&& libcxx == null
|
||||
&& !targetPlatform.isDarwin
|
||||
|
@ -298,6 +295,9 @@ stdenvNoCC.mkDerivation {
|
|||
'(${concatStringsSep " " (map (pkg: "\"${pkg}\"") pkgs)}))
|
||||
'';
|
||||
|
||||
# Expose expand-response-params we are /actually/ using. In stdenv
|
||||
# bootstrapping, expand-response-params usually comes from an earlier stage,
|
||||
# so it is important to expose this for reference checking.
|
||||
inherit expand-response-params;
|
||||
|
||||
inherit nixSupport;
|
||||
|
@ -739,6 +739,7 @@ stdenvNoCC.mkDerivation {
|
|||
inherit isClang;
|
||||
|
||||
# for substitution in utils.bash
|
||||
# TODO(@sternenseemann): invent something cleaner than passing in "" in case of absence
|
||||
expandResponseParams = "${expand-response-params}/bin/expand-response-params";
|
||||
# TODO(@sternenseemann): rename env var via stdenv rebuild
|
||||
shell = getBin runtimeShell + runtimeShell.shellPath or "";
|
||||
|
|
|
@ -76,9 +76,9 @@ let
|
|||
nativeTools = false;
|
||||
nativeLibc = false;
|
||||
|
||||
buildPackages = lib.optionalAttrs (prevStage ? stdenv) {
|
||||
inherit (prevStage) stdenv;
|
||||
};
|
||||
expand-response-params = lib.optionalString
|
||||
(prevStage.stdenv.hasCC or false && prevStage.stdenv.cc != "/dev/null")
|
||||
prevStage.expand-response-params;
|
||||
|
||||
extraPackages = [
|
||||
prevStage.llvmPackages.compiler-rt
|
||||
|
@ -254,7 +254,7 @@ in
|
|||
nativeTools = false;
|
||||
nativeLibc = false;
|
||||
|
||||
buildPackages = { };
|
||||
expand-response-params = "";
|
||||
libc = selfDarwin.Libsystem;
|
||||
|
||||
inherit lib;
|
||||
|
@ -841,9 +841,7 @@ in
|
|||
|
||||
# Rewrap binutils so it uses the rebuilt Libsystem.
|
||||
binutils = superDarwin.binutils.override {
|
||||
buildPackages = {
|
||||
inherit (prevStage) stdenv;
|
||||
};
|
||||
inherit (prevStage) expand-response-params;
|
||||
libc = selfDarwin.Libsystem;
|
||||
} // {
|
||||
passthru = { inherit (prevStage.bintools.passthru) isFromBootstrapFiles; };
|
||||
|
@ -1048,9 +1046,7 @@ in
|
|||
};
|
||||
|
||||
binutils = superDarwin.binutils.override {
|
||||
buildPackages = {
|
||||
inherit (prevStage) stdenv;
|
||||
};
|
||||
inherit (prevStage) expand-response-params;
|
||||
|
||||
bintools = selfDarwin.binutils-unwrapped;
|
||||
libc = selfDarwin.Libsystem;
|
||||
|
@ -1087,9 +1083,7 @@ in
|
|||
nativeTools = false;
|
||||
nativeLibc = false;
|
||||
|
||||
buildPackages = {
|
||||
inherit (prevStage) stdenv;
|
||||
};
|
||||
inherit (prevStage) expand-response-params;
|
||||
|
||||
extraPackages = [
|
||||
self.llvmPackages.compiler-rt
|
||||
|
|
|
@ -185,9 +185,9 @@ let
|
|||
name = "${name}-gcc-wrapper";
|
||||
nativeTools = false;
|
||||
nativeLibc = false;
|
||||
buildPackages = lib.optionalAttrs (prevStage ? stdenv) {
|
||||
inherit (prevStage) stdenv;
|
||||
};
|
||||
expand-response-params = lib.optionalString
|
||||
(prevStage.stdenv.hasCC or false && prevStage.stdenv.cc != "/dev/null")
|
||||
prevStage.expand-response-params;
|
||||
cc = prevStage.gcc-unwrapped;
|
||||
bintools = prevStage.binutils;
|
||||
isGNU = true;
|
||||
|
@ -261,7 +261,7 @@ in
|
|||
name = "bootstrap-stage0-binutils-wrapper";
|
||||
nativeTools = false;
|
||||
nativeLibc = false;
|
||||
buildPackages = { };
|
||||
expand-response-params = "";
|
||||
libc = getLibc self;
|
||||
inherit lib;
|
||||
inherit (self) stdenvNoCC coreutils gnugrep;
|
||||
|
@ -557,9 +557,7 @@ in
|
|||
# Since this is the first fresh build of binutils since stage2, our own runtimeShell will be used.
|
||||
binutils = super.binutils.override {
|
||||
# Build expand-response-params with last stage like below
|
||||
buildPackages = {
|
||||
inherit (prevStage) stdenv;
|
||||
};
|
||||
inherit (prevStage) expand-response-params;
|
||||
};
|
||||
|
||||
# To allow users' overrides inhibit dependencies too heavy for
|
||||
|
@ -570,9 +568,7 @@ in
|
|||
nativeTools = false;
|
||||
nativeLibc = false;
|
||||
isGNU = true;
|
||||
buildPackages = {
|
||||
inherit (prevStage) stdenv;
|
||||
};
|
||||
inherit (prevStage) expand-response-params;
|
||||
cc = prevStage.gcc-unwrapped;
|
||||
bintools = self.binutils;
|
||||
libc = getLibc self;
|
||||
|
@ -654,7 +650,9 @@ in
|
|||
# More complicated cases
|
||||
++ (map (x: getOutput x (getLibc prevStage)) [ "out" "dev" "bin" ] )
|
||||
++ [ linuxHeaders # propagated from .dev
|
||||
binutils gcc gcc.cc gcc.cc.lib gcc.expand-response-params gcc.cc.libgcc glibc.passthru.libgcc
|
||||
binutils gcc gcc.cc gcc.cc.lib
|
||||
gcc.expand-response-params # != (prevStage.)expand-response-params
|
||||
gcc.cc.libgcc glibc.passthru.libgcc
|
||||
]
|
||||
++ lib.optionals (localSystem.libc == "musl") [ fortify-headers ]
|
||||
++ [ prevStage.updateAutotoolsGnuConfigScriptsHook prevStage.gnu-config ]
|
||||
|
|
|
@ -656,6 +656,8 @@ with pkgs;
|
|||
|
||||
evhz = callPackage ../tools/misc/evhz { };
|
||||
|
||||
expand-response-params = callPackage ../build-support/expand-response-params { };
|
||||
|
||||
expressvpn = callPackage ../applications/networking/expressvpn { };
|
||||
|
||||
faq = callPackage ../development/tools/faq { };
|
||||
|
|
Loading…
Reference in a new issue