stdenv-linux: Prevent dependency on bootstrap-tools in the final binutils

Binutils nowadays contains ld.gold, which depends on libstdc++.  So it
needs to be built with the new GCC rather than the one from
bootstrap-tools.

Issue #1469.
This commit is contained in:
Eelco Dolstra 2014-01-07 17:46:47 +01:00
parent 10ab227126
commit 860c681fb3

View File

@ -7,7 +7,7 @@
# The function defaults are for easy testing. # The function defaults are for easy testing.
{ system ? builtins.currentSystem { system ? builtins.currentSystem
, allPackages ? import ../../top-level/all-packages.nix , allPackages ? import ../../top-level/all-packages.nix
, platform ? null, config }: , platform ? null, config ? {} }:
rec { rec {
@ -166,12 +166,14 @@ rec {
bootStdenv = stdenvLinuxBoot1; bootStdenv = stdenvLinuxBoot1;
}; };
binutils1 = stdenvLinuxBoot1Pkgs.binutils.override { gold = false; };
# 3) 2nd stdenv that we will use to build only the glibc.
# 3) 2nd stdenv that we will use to build only Glibc.
stdenvLinuxBoot2 = stdenvBootFun { stdenvLinuxBoot2 = stdenvBootFun {
gcc = wrapGCC { gcc = wrapGCC {
libc = bootstrapGlibc; libc = bootstrapGlibc;
binutils = stdenvLinuxBoot1Pkgs.binutils; binutils = binutils1;
coreutils = bootstrapTools; coreutils = bootstrapTools;
}; };
overrides = pkgs: { overrides = pkgs: {
@ -182,7 +184,7 @@ rec {
# 4) These are the packages that we can build with the 2nd # 4) These are the packages that we can build with the 2nd
# stdenv. We only need Glibc (in step 5). # stdenv.
stdenvLinuxBoot2Pkgs = allPackages { stdenvLinuxBoot2Pkgs = allPackages {
inherit system platform; inherit system platform;
bootStdenv = stdenvLinuxBoot2; bootStdenv = stdenvLinuxBoot2;
@ -194,12 +196,12 @@ rec {
stdenvLinuxGlibc = stdenvLinuxBoot2Pkgs.glibc; stdenvLinuxGlibc = stdenvLinuxBoot2Pkgs.glibc;
# 6) Construct a third stdenv identical to the 2nd, except that # 6) Construct a third stdenv identical to the 2nd, except that this
# this one uses the Glibc built in step 3. It still uses # one uses the Glibc built in step 5. It still uses the recent
# the recent binutils and rest of the bootstrap tools, including GCC. # binutils and rest of the bootstrap tools, including GCC.
stdenvLinuxBoot3 = stdenvBootFun { stdenvLinuxBoot3 = stdenvBootFun {
gcc = wrapGCC { gcc = wrapGCC {
binutils = stdenvLinuxBoot1Pkgs.binutils; binutils = binutils1;
coreutils = bootstrapTools; coreutils = bootstrapTools;
libc = stdenvLinuxGlibc; libc = stdenvLinuxGlibc;
}; };
@ -231,12 +233,11 @@ rec {
# 8) Construct a fourth stdenv identical to the second, except that # 8) Construct a fourth stdenv identical to the second, except that
# this one uses the dynamically linked GCC and Binutils from step # this one uses the new GCC from step 7. The other tools
# 5. The other tools (e.g. coreutils) are still from the # (e.g. coreutils) are still from the bootstrap tools.
# bootstrap tools.
stdenvLinuxBoot4 = stdenvBootFun { stdenvLinuxBoot4 = stdenvBootFun {
gcc = wrapGCC rec { gcc = wrapGCC rec {
inherit (stdenvLinuxBoot3Pkgs) binutils; binutils = binutils1;
coreutils = bootstrapTools; coreutils = bootstrapTools;
libc = stdenvLinuxGlibc; libc = stdenvLinuxGlibc;
gcc = stdenvLinuxBoot3Pkgs.gcc.gcc; gcc = stdenvLinuxBoot3Pkgs.gcc.gcc;
@ -258,9 +259,9 @@ rec {
}; };
# 10) Construct the final stdenv. It uses the Glibc, GCC and # 10) Construct the final stdenv. It uses the Glibc and GCC, and
# Binutils built above, and adds in dynamically linked versions # adds in a new binutils that doesn't depend on bootstrap-tools,
# of all other tools. # as well as dynamically linked versions of all other tools.
# #
# When updating stdenvLinux, make sure that the result has no # When updating stdenvLinux, make sure that the result has no
# dependency (`nix-store -qR') on bootstrapTools or the # dependency (`nix-store -qR') on bootstrapTools or the
@ -281,8 +282,7 @@ rec {
++ [stdenvLinuxBoot4Pkgs.patchelf]; ++ [stdenvLinuxBoot4Pkgs.patchelf];
gcc = wrapGCC rec { gcc = wrapGCC rec {
inherit (stdenvLinuxBoot3Pkgs) binutils; inherit (stdenvLinuxBoot4Pkgs) binutils coreutils;
inherit (stdenvLinuxBoot4Pkgs) coreutils;
libc = stdenvLinuxGlibc; libc = stdenvLinuxGlibc;
gcc = stdenvLinuxBoot4.gcc.gcc; gcc = stdenvLinuxBoot4.gcc.gcc;
shell = stdenvLinuxBoot4Pkgs.bash + "/bin/bash"; shell = stdenvLinuxBoot4Pkgs.bash + "/bin/bash";