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