linux stdenv: Remove stray use of stage0 to bootstrap more elegantly

This commit is contained in:
John Ericson 2016-12-24 07:28:40 -08:00
parent 6a45e911c4
commit b10f415c21

View File

@ -75,7 +75,7 @@ rec {
libc = prevStage.glibc; libc = prevStage.glibc;
inherit (prevStage) binutils coreutils gnugrep; inherit (prevStage) binutils coreutils gnugrep;
name = name; name = name;
stdenv = stage0.stdenv; stdenv = prevStage.ccWrapperStdenv;
}; };
extraAttrs = { extraAttrs = {
@ -95,7 +95,9 @@ rec {
stdenv = thisStdenv; stdenv = thisStdenv;
}; };
baseCase = { baseCase = {}: {
__raw = true;
gcc-unwrapped = null; gcc-unwrapped = null;
glibc = null; glibc = null;
binutils = null; binutils = null;
@ -105,10 +107,15 @@ rec {
# Build a dummy stdenv with no GCC or working fetchurl. This is # Build a dummy stdenv with no GCC or working fetchurl. This is
# because we need a stdenv to build the GCC wrapper and fetchurl. # because we need a stdenv to build the GCC wrapper and fetchurl.
stage0 = stageFun baseCase { stage0 = prevStage: stageFun prevStage {
name = null; name = null;
overrides = self: super: { overrides = self: super: {
# We thread stage0's stdenv through under this name so downstream stages
# can use it for wrapping gcc too. This way, downstream stages don't need
# to refer to this stage directly, which violates the principle that each
# stage should only access the stage that came before it.
ccWrapperStdenv = self.stdenv;
# The Glibc include directory cannot have the same prefix as the # The Glibc include directory cannot have the same prefix as the
# GCC include directory, since GCC gets confused otherwise (it # GCC include directory, since GCC gets confused otherwise (it
# will search the Glibc headers before the GCC headers). So # will search the Glibc headers before the GCC headers). So
@ -146,7 +153,9 @@ rec {
# Rebuild binutils to use from stage2 onwards. # Rebuild binutils to use from stage2 onwards.
overrides = self: super: { overrides = self: super: {
binutils = super.binutils.override { gold = false; }; binutils = super.binutils.override { gold = false; };
inherit (prevStage) glibc gcc-unwrapped coreutils gnugrep; inherit (prevStage)
ccWrapperStdenv
glibc gcc-unwrapped coreutils gnugrep;
# A threaded perl build needs glibc/libpthread_nonshared.a, # A threaded perl build needs glibc/libpthread_nonshared.a,
# which is not included in bootstrapTools, so disable threading. # which is not included in bootstrapTools, so disable threading.
@ -165,6 +174,7 @@ rec {
overrides = self: super: { overrides = self: super: {
inherit (prevStage) inherit (prevStage)
ccWrapperStdenv
binutils gcc-unwrapped coreutils gnugrep binutils gcc-unwrapped coreutils gnugrep
perl paxctl gnum4 bison; perl paxctl gnum4 bison;
# This also contains the full, dynamically linked, final Glibc. # This also contains the full, dynamically linked, final Glibc.
@ -180,6 +190,7 @@ rec {
overrides = self: super: rec { overrides = self: super: rec {
inherit (prevStage) inherit (prevStage)
ccWrapperStdenv
binutils glibc coreutils gnugrep binutils glibc coreutils gnugrep
perl patchelf linuxHeaders gnum4 bison; perl patchelf linuxHeaders gnum4 bison;
# Link GCC statically against GMP etc. This makes sense because # Link GCC statically against GMP etc. This makes sense because
@ -278,7 +289,8 @@ rec {
}; };
stagesLinux = [ stagesLinux = [
({}: stage0) baseCase
stage0
stage1 stage1
stage2 stage2
stage3 stage3