stdenv: linux: simplify bootstrap by inheriting per-stage packages (#519965)

This commit is contained in:
Philip Taron 2026-06-07 12:53:02 +00:00 committed by GitHub
commit a0fc5f42c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -179,7 +179,13 @@ let
buildPlatform = localSystem;
hostPlatform = localSystem;
targetPlatform = localSystem;
inherit extraNativeBuildInputs;
# Every real (post-dummy) stage needs this hook so configure scripts
# can recognise architectures (LoongArch, RISC-V, etc.).
extraNativeBuildInputs =
extraNativeBuildInputs
++ lib.optional (
prevStage ? updateAutotoolsGnuConfigScriptsHook
) prevStage.updateAutotoolsGnuConfigScriptsHook;
inherit (stage0) initialPath;
preHook = ''
# Don't patch #!/interpreter because it leads to retained
@ -275,11 +281,7 @@ in
stageFun prevStage {
name = "bootstrap-stage1";
# Rebuild binutils to use from stage2 onwards.
overrides = self: super: {
binutils-unwrapped = super.binutils-unwrapped.override {
enableGold = false;
};
inherit (prevStage)
ccWrapperStdenv
gcc-unwrapped
@ -309,9 +311,6 @@ in
};
});
};
# `gettext` comes with obsolete config.sub/config.guess that don't recognize LoongArch64.
extraNativeBuildInputs = [ prevStage.updateAutotoolsGnuConfigScriptsHook ];
}
)
@ -342,6 +341,8 @@ in
gnum4
perl
patchelf
nukeReferences
libxcrypt
;
${localSystem.libc} = prevStage.${localSystem.libc};
gmp = super.gmp.override { cxx = false; };
@ -425,9 +426,6 @@ in
'';
});
};
# `gettext` comes with obsolete config.sub/config.guess that don't recognize LoongArch64.
extraNativeBuildInputs = [ prevStage.updateAutotoolsGnuConfigScriptsHook ];
}
)
@ -459,10 +457,10 @@ in
bison
texinfo
which
nukeReferences
autoconf269
libxcrypt
;
dejagnu = super.dejagnu.overrideAttrs (a: {
doCheck = false;
});
# Avoids infinite recursion, as this is in the build-time dependencies of libc.
libiconv = self.libcIconv prevStage.libc;
@ -529,10 +527,6 @@ in
);
};
# `gettext` comes with obsolete config.sub/config.guess that don't recognize LoongArch64.
# `libtool` comes with obsolete config.sub/config.guess that don't recognize Risc-V.
extraNativeBuildInputs = [ prevStage.updateAutotoolsGnuConfigScriptsHook ];
}
)
@ -574,6 +568,9 @@ in
libidn2
libunistring
libxcrypt
nukeReferences
autoconf269
python3Minimal
;
# We build a special copy of libgmp which doesn't use libstdc++, because
# xgcc++'s libstdc++ references the bootstrap-files (which is what
@ -603,8 +600,6 @@ in
};
extraNativeBuildInputs = [
prevStage.patchelf
# Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64.
prevStage.updateAutotoolsGnuConfigScriptsHook
];
}
)
@ -640,6 +635,7 @@ in
linuxHeaders
libidn2
libunistring
python3Minimal
;
${localSystem.libc} = prevStage.${localSystem.libc};
# Since this is the first fresh build of binutils since stage2, our own runtimeShell will be used.
@ -669,8 +665,6 @@ in
extraNativeBuildInputs = [
prevStage.patchelf
prevStage.xz
# Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64.
prevStage.updateAutotoolsGnuConfigScriptsHook
];
}
)