Refactor stages to only ever refer to the previous stage

This commit doesn't change the outhash (or drvhash) of the stdenv.
This commit is contained in:
Gergely Risko 2014-08-24 15:55:14 +02:00
parent 49e5837780
commit ea65229f70

View File

@ -140,6 +140,13 @@ rec {
# Create the first "real" standard environment. This one consists # Create the first "real" standard environment. This one consists
# of bootstrap tools only, and a minimal Glibc to keep the GCC # of bootstrap tools only, and a minimal Glibc to keep the GCC
# configure script happy. # configure script happy.
#
# For clarity, we only use the previous stage when specifying these
# stages. So stageN should only ever have references for stage{N-1}.
#
# If we ever need to use a package from more than one stage back, we
# simply re-export those packages in the middle stage(s) using the
# overrides attribute and the inherit syntax.
stage1 = stageFun { stage1 = stageFun {
gcc = wrapGCC { gcc = wrapGCC {
gcc = bootstrapTools; gcc = bootstrapTools;
@ -151,6 +158,7 @@ rec {
# Rebuild binutils to use from stage2 onwards. # Rebuild binutils to use from stage2 onwards.
overrides = pkgs: { overrides = pkgs: {
binutils = pkgs.binutils.override { gold = false; }; binutils = pkgs.binutils.override { gold = false; };
inherit (stage0.pkgs) glibc;
}; };
}; };
@ -160,13 +168,13 @@ rec {
stage2 = stageFun { stage2 = stageFun {
gcc = wrapGCC { gcc = wrapGCC {
gcc = bootstrapTools; gcc = bootstrapTools;
libc = stage0.pkgs.glibc; libc = stage1.pkgs.glibc;
binutils = stage1.pkgs.binutils; binutils = stage1.pkgs.binutils;
coreutils = bootstrapTools; coreutils = bootstrapTools;
name = "bootstrap-gcc-wrapper"; name = "bootstrap-gcc-wrapper";
}; };
overrides = pkgs: { overrides = pkgs: {
inherit (stage1.pkgs) perl; inherit (stage1.pkgs) perl binutils paxctl;
# This also contains the full, dynamically linked, final Glibc. # This also contains the full, dynamically linked, final Glibc.
}; };
}; };
@ -179,12 +187,12 @@ rec {
gcc = wrapGCC { gcc = wrapGCC {
gcc = bootstrapTools; gcc = bootstrapTools;
libc = stage2.pkgs.glibc; libc = stage2.pkgs.glibc;
binutils = stage1.pkgs.binutils; binutils = stage2.pkgs.binutils;
coreutils = bootstrapTools; coreutils = bootstrapTools;
name = "bootstrap-gcc-wrapper"; name = "bootstrap-gcc-wrapper";
}; };
overrides = pkgs: { overrides = pkgs: {
inherit (stage2.pkgs) glibc perl; inherit (stage2.pkgs) binutils glibc perl;
# Link GCC statically against GMP etc. This makes sense because # Link GCC statically against GMP etc. This makes sense because
# these builds of the libraries are only used by GCC, so it # these builds of the libraries are only used by GCC, so it
# reduces the size of the stdenv closure. # reduces the size of the stdenv closure.
@ -198,7 +206,7 @@ rec {
extraAttrs = { extraAttrs = {
glibc = stage2.pkgs.glibc; # Required by gcc47 build glibc = stage2.pkgs.glibc; # Required by gcc47 build
}; };
extraPath = [ stage1.pkgs.paxctl ]; extraPath = [ stage2.pkgs.paxctl ];
}; };
@ -207,15 +215,14 @@ rec {
stage4 = stageFun { stage4 = stageFun {
gcc = wrapGCC { gcc = wrapGCC {
gcc = stage3.pkgs.gcc.gcc; gcc = stage3.pkgs.gcc.gcc;
libc = stage2.pkgs.glibc; libc = stage3.pkgs.glibc;
binutils = stage1.pkgs.binutils; binutils = stage3.pkgs.binutils;
coreutils = bootstrapTools; coreutils = bootstrapTools;
name = ""; name = "";
}; };
extraPath = [ stage3.pkgs.xz ]; extraPath = [ stage3.pkgs.xz ];
overrides = pkgs: { overrides = pkgs: {
inherit (stage1.pkgs) perl; inherit (stage3.pkgs) gettext gnum4 gmp perl glibc;
inherit (stage3.pkgs) gettext gnum4 gmp glibc;
}; };
}; };
@ -261,11 +268,9 @@ rec {
overrides = pkgs: { overrides = pkgs: {
inherit gcc; inherit gcc;
inherit (stage3.pkgs) glibc;
inherit (stage4.pkgs) binutils;
inherit (stage4.pkgs) inherit (stage4.pkgs)
gzip bzip2 xz bash coreutils diffutils findutils gawk gzip bzip2 xz bash binutils coreutils diffutils findutils gawk
gnumake gnused gnutar gnugrep gnupatch patchelf glibc gnumake gnused gnutar gnugrep gnupatch patchelf
attr acl paxctl; attr acl paxctl;
}; };
}; };