2005-02-21 21:42:07 +01:00
|
|
|
# This file constructs the standard build environment for the
|
|
|
|
# Linux/i686 platform. It's completely pure; that is, it relies on no
|
|
|
|
# external (non-Nix) tools, such as /usr/bin/gcc, and it contains a C
|
|
|
|
# compiler and linker that do not search in default locations,
|
|
|
|
# ensuring purity of components produced by it.
|
2016-12-16 14:22:02 +01:00
|
|
|
{ lib
|
2016-12-24 19:55:11 +01:00
|
|
|
, localSystem, crossSystem, config, overlays
|
|
|
|
|
2018-01-12 23:19:22 +01:00
|
|
|
, bootstrapFiles ?
|
|
|
|
let table = {
|
|
|
|
"glibc" = {
|
|
|
|
"i686-linux" = import ./bootstrap-files/i686.nix;
|
|
|
|
"x86_64-linux" = import ./bootstrap-files/x86_64.nix;
|
|
|
|
"armv5tel-linux" = import ./bootstrap-files/armv5tel.nix;
|
|
|
|
"armv6l-linux" = import ./bootstrap-files/armv6l.nix;
|
|
|
|
"armv7l-linux" = import ./bootstrap-files/armv7l.nix;
|
|
|
|
"aarch64-linux" = import ./bootstrap-files/aarch64.nix;
|
2017-12-05 11:27:45 +01:00
|
|
|
"mipsel-linux" = import ./bootstrap-files/loongson2f.nix;
|
2018-01-12 23:19:22 +01:00
|
|
|
};
|
|
|
|
"musl" = {
|
2018-02-12 21:14:57 +01:00
|
|
|
"aarch64-linux" = import ./bootstrap-files/aarch64-musl.nix;
|
|
|
|
"armv6l-linux" = import ./bootstrap-files/armv6l-musl.nix;
|
|
|
|
"x86_64-linux" = import ./bootstrap-files/x86_64-musl.nix;
|
2018-01-12 23:19:22 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
archLookupTable = table.${localSystem.libc}
|
|
|
|
or (abort "unsupported libc for the pure Linux stdenv");
|
|
|
|
files = archLookupTable.${localSystem.system}
|
|
|
|
or (abort "unsupported platform for the pure Linux stdenv");
|
|
|
|
in files
|
2016-03-03 13:46:21 +01:00
|
|
|
}:
|
2006-08-23 18:18:02 +02:00
|
|
|
|
2016-12-01 00:51:13 +01:00
|
|
|
assert crossSystem == null;
|
|
|
|
|
2016-12-24 16:38:56 +01:00
|
|
|
let
|
2016-12-24 19:55:11 +01:00
|
|
|
inherit (localSystem) system platform;
|
2006-08-23 18:18:02 +02:00
|
|
|
|
2009-03-25 18:34:38 +01:00
|
|
|
commonPreHook =
|
|
|
|
''
|
2016-02-29 12:10:26 +01:00
|
|
|
export NIX_ENFORCE_PURITY="''${NIX_ENFORCE_PURITY-1}"
|
2016-03-15 17:35:07 +01:00
|
|
|
export NIX_ENFORCE_NO_NATIVE="''${NIX_ENFORCE_NO_NATIVE-1}"
|
2009-03-25 18:34:38 +01:00
|
|
|
${if system == "x86_64-linux" then "NIX_LIB64_IN_SELF_RPATH=1" else ""}
|
2017-12-05 11:27:45 +01:00
|
|
|
${if system == "mipsel-linux" then "NIX_LIB32_IN_SELF_RPATH=1" else ""}
|
2009-03-25 18:34:38 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
|
2005-02-21 21:42:07 +01:00
|
|
|
# The bootstrap process proceeds in several steps.
|
|
|
|
|
2012-12-28 16:41:56 +01:00
|
|
|
|
2014-08-23 21:26:37 +02:00
|
|
|
# Create a standard environment by downloading pre-built binaries of
|
|
|
|
# coreutils, GCC, etc.
|
2005-02-22 10:55:03 +01:00
|
|
|
|
2012-12-28 16:41:56 +01:00
|
|
|
|
2009-02-01 22:44:56 +01:00
|
|
|
# Download and unpack the bootstrap tools (coreutils, GCC, Glibc, ...).
|
2018-01-11 22:09:34 +01:00
|
|
|
bootstrapTools = import (if localSystem.libc == "musl" then ./bootstrap-tools-musl else ./bootstrap-tools) { inherit system bootstrapFiles; };
|
2012-12-28 16:41:56 +01:00
|
|
|
|
2018-01-12 01:15:40 +01:00
|
|
|
getLibc = stage: stage.${localSystem.libc};
|
2012-12-28 16:41:56 +01:00
|
|
|
|
2004-11-04 13:19:32 +01:00
|
|
|
|
2009-02-01 22:44:56 +01:00
|
|
|
# This function builds the various standard environments used during
|
2014-08-23 21:26:37 +02:00
|
|
|
# the bootstrap. In all stages, we build an stdenv and the package
|
|
|
|
# set that can be built with that stdenv.
|
2016-12-24 16:07:20 +01:00
|
|
|
stageFun = prevStage:
|
2017-08-15 17:30:45 +02:00
|
|
|
{ name, overrides ? (self: super: {}), extraNativeBuildInputs ? [] }:
|
2004-11-04 13:19:32 +01:00
|
|
|
|
2014-08-23 21:26:37 +02:00
|
|
|
let
|
2014-08-24 18:08:23 +02:00
|
|
|
|
|
|
|
thisStdenv = import ../generic {
|
2018-02-01 01:00:00 +01:00
|
|
|
name = "${name}-stdenv-linux";
|
2017-07-06 03:47:48 +02:00
|
|
|
buildPlatform = localSystem;
|
|
|
|
hostPlatform = localSystem;
|
|
|
|
targetPlatform = localSystem;
|
2017-08-15 17:30:45 +02:00
|
|
|
inherit config extraNativeBuildInputs;
|
2014-08-24 18:08:23 +02:00
|
|
|
preHook =
|
|
|
|
''
|
|
|
|
# Don't patch #!/interpreter because it leads to retained
|
|
|
|
# dependencies on the bootstrapTools in the final stdenv.
|
|
|
|
dontPatchShebangs=1
|
|
|
|
${commonPreHook}
|
|
|
|
'';
|
2016-02-24 11:01:11 +01:00
|
|
|
shell = "${bootstrapTools}/bin/bash";
|
2014-09-14 19:32:58 +02:00
|
|
|
initialPath = [bootstrapTools];
|
2016-02-27 20:27:24 +01:00
|
|
|
|
|
|
|
fetchurlBoot = import ../../build-support/fetchurl/boot.nix {
|
|
|
|
inherit system;
|
2014-08-24 18:08:23 +02:00
|
|
|
};
|
2014-09-11 01:18:14 +02:00
|
|
|
|
2016-12-24 16:07:20 +01:00
|
|
|
cc = if isNull prevStage.gcc-unwrapped
|
2015-06-15 19:26:52 +02:00
|
|
|
then null
|
2015-01-09 20:22:12 +01:00
|
|
|
else lib.makeOverridable (import ../../build-support/cc-wrapper) {
|
2018-02-01 01:00:00 +01:00
|
|
|
name = "${name}-gcc-wrapper";
|
2014-09-11 01:18:14 +02:00
|
|
|
nativeTools = false;
|
2018-02-01 01:00:00 +01:00
|
|
|
propagateDoc = false;
|
2014-09-11 01:18:14 +02:00
|
|
|
nativeLibc = false;
|
2017-06-29 18:06:55 +02:00
|
|
|
buildPackages = lib.optionalAttrs (prevStage ? stdenv) {
|
|
|
|
inherit (prevStage) stdenv;
|
|
|
|
};
|
2016-12-24 16:07:20 +01:00
|
|
|
cc = prevStage.gcc-unwrapped;
|
2017-08-26 17:43:30 +02:00
|
|
|
bintools = prevStage.binutils;
|
2015-05-11 23:30:13 +02:00
|
|
|
isGNU = true;
|
2018-01-12 01:15:40 +01:00
|
|
|
libc = getLibc prevStage;
|
2017-08-26 17:43:30 +02:00
|
|
|
inherit (prevStage) coreutils gnugrep;
|
2017-09-20 17:07:52 +02:00
|
|
|
stdenvNoCC = prevStage.ccWrapperStdenv;
|
2014-09-11 01:18:14 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
extraAttrs = {
|
|
|
|
# Having the proper 'platform' in all the stdenvs allows getting proper
|
|
|
|
# linuxHeaders for example.
|
|
|
|
inherit platform;
|
|
|
|
};
|
2016-12-19 17:10:47 +01:00
|
|
|
overrides = self: super: (overrides self super) // { fetchurl = thisStdenv.fetchurlBoot; };
|
2014-08-23 20:34:01 +02:00
|
|
|
};
|
2004-11-04 13:19:32 +01:00
|
|
|
|
2016-12-16 14:22:02 +01:00
|
|
|
in {
|
2016-12-24 19:55:11 +01:00
|
|
|
inherit config overlays;
|
2016-12-16 14:22:02 +01:00
|
|
|
stdenv = thisStdenv;
|
|
|
|
};
|
2009-02-01 22:44:56 +01:00
|
|
|
|
2016-12-24 16:38:56 +01:00
|
|
|
in
|
|
|
|
|
|
|
|
[
|
|
|
|
|
|
|
|
({}: {
|
2016-12-24 16:28:40 +01:00
|
|
|
__raw = true;
|
|
|
|
|
2016-12-24 16:07:20 +01:00
|
|
|
gcc-unwrapped = null;
|
2014-09-11 01:18:14 +02:00
|
|
|
binutils = null;
|
|
|
|
coreutils = null;
|
2016-01-24 06:18:32 +01:00
|
|
|
gnugrep = null;
|
2016-12-24 16:38:56 +01:00
|
|
|
})
|
2016-12-24 16:07:20 +01:00
|
|
|
|
|
|
|
# Build a dummy stdenv with no GCC or working fetchurl. This is
|
|
|
|
# because we need a stdenv to build the GCC wrapper and fetchurl.
|
2016-12-24 16:38:56 +01:00
|
|
|
(prevStage: stageFun prevStage {
|
2018-02-01 01:00:00 +01:00
|
|
|
name = "bootstrap-stage0";
|
2012-12-28 16:41:56 +01:00
|
|
|
|
2016-12-19 17:10:47 +01:00
|
|
|
overrides = self: super: {
|
2016-12-24 16:28:40 +01:00
|
|
|
# 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;
|
2014-08-23 21:26:37 +02:00
|
|
|
# The Glibc include directory cannot have the same prefix as the
|
|
|
|
# GCC include directory, since GCC gets confused otherwise (it
|
|
|
|
# will search the Glibc headers before the GCC headers). So
|
|
|
|
# create a dummy Glibc here, which will be used in the stdenv of
|
|
|
|
# stage1.
|
2018-01-12 01:15:40 +01:00
|
|
|
${localSystem.libc} = self.stdenv.mkDerivation {
|
2018-02-01 01:00:00 +01:00
|
|
|
name = "bootstrap-stage0-${localSystem.libc}";
|
2014-08-23 21:26:37 +02:00
|
|
|
buildCommand = ''
|
|
|
|
mkdir -p $out
|
|
|
|
ln -s ${bootstrapTools}/lib $out/lib
|
2018-01-11 22:09:34 +01:00
|
|
|
'' + lib.optionalString (localSystem.libc == "glibc") ''
|
2014-08-23 21:26:37 +02:00
|
|
|
ln -s ${bootstrapTools}/include-glibc $out/include
|
2018-01-11 22:09:34 +01:00
|
|
|
'' + lib.optionalString (localSystem.libc == "musl") ''
|
|
|
|
ln -s ${bootstrapTools}/include-libc $out/include
|
2014-08-23 21:26:37 +02:00
|
|
|
'';
|
|
|
|
};
|
2016-12-24 16:07:20 +01:00
|
|
|
gcc-unwrapped = bootstrapTools;
|
2017-08-26 17:43:30 +02:00
|
|
|
binutils = import ../../build-support/bintools-wrapper {
|
2018-02-01 01:00:00 +01:00
|
|
|
name = "bootstrap-stage0-binutils-wrapper";
|
2017-08-26 17:43:30 +02:00
|
|
|
nativeTools = false;
|
|
|
|
nativeLibc = false;
|
|
|
|
buildPackages = { };
|
2018-01-12 01:15:40 +01:00
|
|
|
libc = getLibc self;
|
2017-08-26 17:43:30 +02:00
|
|
|
inherit (self) stdenvNoCC coreutils gnugrep;
|
|
|
|
bintools = bootstrapTools;
|
|
|
|
};
|
2016-12-24 16:07:20 +01:00
|
|
|
coreutils = bootstrapTools;
|
|
|
|
gnugrep = bootstrapTools;
|
2004-11-04 13:19:32 +01:00
|
|
|
};
|
2016-12-24 16:38:56 +01:00
|
|
|
})
|
2005-02-21 21:42:07 +01:00
|
|
|
|
|
|
|
|
|
|
|
# Create the first "real" standard environment. This one consists
|
2009-02-01 22:44:56 +01:00
|
|
|
# of bootstrap tools only, and a minimal Glibc to keep the GCC
|
|
|
|
# configure script happy.
|
2014-08-24 15:55:14 +02:00
|
|
|
#
|
|
|
|
# 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.
|
2016-12-24 16:38:56 +01:00
|
|
|
(prevStage: stageFun prevStage {
|
2018-02-01 01:00:00 +01:00
|
|
|
name = "bootstrap-stage1";
|
2014-09-11 01:18:14 +02:00
|
|
|
|
2014-08-23 21:26:37 +02:00
|
|
|
# Rebuild binutils to use from stage2 onwards.
|
2016-12-19 17:10:47 +01:00
|
|
|
overrides = self: super: {
|
2017-08-26 17:43:30 +02:00
|
|
|
binutils = super.binutils_nogold;
|
2016-12-24 16:28:40 +01:00
|
|
|
inherit (prevStage)
|
|
|
|
ccWrapperStdenv
|
2018-01-12 01:15:40 +01:00
|
|
|
gcc-unwrapped coreutils gnugrep;
|
|
|
|
|
|
|
|
${localSystem.libc} = getLibc prevStage;
|
2014-09-11 01:18:14 +02:00
|
|
|
|
2014-09-04 16:17:39 +02:00
|
|
|
# A threaded perl build needs glibc/libpthread_nonshared.a,
|
|
|
|
# which is not included in bootstrapTools, so disable threading.
|
|
|
|
# This is not an issue for the final stdenv, because this perl
|
|
|
|
# won't be included in the final stdenv and won't be exported to
|
|
|
|
# top-level pkgs as an override either.
|
2016-12-19 17:10:47 +01:00
|
|
|
perl = super.perl.override { enableThreading = false; };
|
2010-01-19 12:25:33 +01:00
|
|
|
};
|
2016-12-24 16:38:56 +01:00
|
|
|
})
|
2005-02-21 21:42:07 +01:00
|
|
|
|
2014-01-07 17:46:47 +01:00
|
|
|
|
2014-08-23 21:26:37 +02:00
|
|
|
# 2nd stdenv that contains our own rebuilt binutils and is used for
|
|
|
|
# compiling our own Glibc.
|
2016-12-24 16:38:56 +01:00
|
|
|
(prevStage: stageFun prevStage {
|
2018-02-01 01:00:00 +01:00
|
|
|
name = "bootstrap-stage2";
|
2014-09-11 01:18:14 +02:00
|
|
|
|
2016-12-19 17:10:47 +01:00
|
|
|
overrides = self: super: {
|
2016-12-24 16:07:20 +01:00
|
|
|
inherit (prevStage)
|
2016-12-24 16:28:40 +01:00
|
|
|
ccWrapperStdenv
|
2017-08-26 17:43:30 +02:00
|
|
|
gcc-unwrapped coreutils gnugrep
|
2016-12-24 16:07:20 +01:00
|
|
|
perl paxctl gnum4 bison;
|
2014-08-23 21:26:37 +02:00
|
|
|
# This also contains the full, dynamically linked, final Glibc.
|
2017-08-26 17:43:30 +02:00
|
|
|
binutils = prevStage.binutils.override {
|
|
|
|
# Rewrap the binutils with the new glibc, so both the next
|
|
|
|
# stage's wrappers use it.
|
2018-01-12 01:15:40 +01:00
|
|
|
libc = getLibc self;
|
2017-08-26 17:43:30 +02:00
|
|
|
};
|
2011-12-14 15:31:56 +01:00
|
|
|
};
|
2016-12-24 16:38:56 +01:00
|
|
|
})
|
2010-08-25 15:22:48 +02:00
|
|
|
|
2012-12-28 16:41:56 +01:00
|
|
|
|
2014-08-23 21:26:37 +02:00
|
|
|
# Construct a third stdenv identical to the 2nd, except that this
|
|
|
|
# one uses the rebuilt Glibc from stage2. It still uses the recent
|
|
|
|
# binutils and rest of the bootstrap tools, including GCC.
|
2016-12-24 16:38:56 +01:00
|
|
|
(prevStage: stageFun prevStage {
|
2018-02-01 01:00:00 +01:00
|
|
|
name = "bootstrap-stage3";
|
2014-09-11 01:18:14 +02:00
|
|
|
|
2016-12-19 17:10:47 +01:00
|
|
|
overrides = self: super: rec {
|
2016-12-24 16:07:20 +01:00
|
|
|
inherit (prevStage)
|
2016-12-24 16:28:40 +01:00
|
|
|
ccWrapperStdenv
|
2018-01-12 01:15:40 +01:00
|
|
|
binutils coreutils gnugrep
|
2016-12-24 16:07:20 +01:00
|
|
|
perl patchelf linuxHeaders gnum4 bison;
|
2018-01-12 01:15:40 +01:00
|
|
|
${localSystem.libc} = getLibc prevStage;
|
2011-12-14 15:31:56 +01:00
|
|
|
# Link GCC statically against GMP etc. This makes sense because
|
|
|
|
# these builds of the libraries are only used by GCC, so it
|
|
|
|
# reduces the size of the stdenv closure.
|
2016-12-19 17:10:47 +01:00
|
|
|
gmp = super.gmp.override { stdenv = self.makeStaticLibraries self.stdenv; };
|
|
|
|
mpfr = super.mpfr.override { stdenv = self.makeStaticLibraries self.stdenv; };
|
|
|
|
libmpc = super.libmpc.override { stdenv = self.makeStaticLibraries self.stdenv; };
|
2017-07-25 13:56:57 +02:00
|
|
|
isl_0_17 = super.isl_0_17.override { stdenv = self.makeStaticLibraries self.stdenv; };
|
2016-12-24 16:07:20 +01:00
|
|
|
gcc-unwrapped = super.gcc-unwrapped.override {
|
2017-07-25 13:56:57 +02:00
|
|
|
isl = isl_0_17;
|
2015-06-11 18:52:19 +02:00
|
|
|
};
|
2010-01-19 12:25:33 +01:00
|
|
|
};
|
2017-08-15 17:30:45 +02:00
|
|
|
extraNativeBuildInputs = [ prevStage.patchelf prevStage.paxctl ] ++
|
2016-03-05 01:28:23 +01:00
|
|
|
# Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64.
|
2018-05-06 20:59:50 +02:00
|
|
|
lib.optional (!localSystem.isx86) prevStage.updateAutotoolsGnuConfigScriptsHook;
|
2016-12-24 16:38:56 +01:00
|
|
|
})
|
2005-02-21 21:42:07 +01:00
|
|
|
|
2012-12-28 16:41:56 +01:00
|
|
|
|
2014-08-23 21:26:37 +02:00
|
|
|
# Construct a fourth stdenv that uses the new GCC. But coreutils is
|
|
|
|
# still from the bootstrap tools.
|
2016-12-24 16:38:56 +01:00
|
|
|
(prevStage: stageFun prevStage {
|
2018-02-01 01:00:00 +01:00
|
|
|
name = "bootstrap-stage4";
|
2014-09-11 01:18:14 +02:00
|
|
|
|
2016-12-19 17:10:47 +01:00
|
|
|
overrides = self: super: {
|
2014-09-11 01:10:49 +02:00
|
|
|
# Zlib has to be inherited and not rebuilt in this stage,
|
|
|
|
# because gcc (since JAR support) already depends on zlib, and
|
|
|
|
# then if we already have a zlib we want to use that for the
|
|
|
|
# other purposes (binutils and top-level pkgs) too.
|
2018-01-12 01:15:40 +01:00
|
|
|
inherit (prevStage) gettext gnum4 bison gmp perl zlib linuxHeaders;
|
|
|
|
${localSystem.libc} = getLibc prevStage;
|
2017-08-26 17:43:30 +02:00
|
|
|
binutils = super.binutils.override {
|
|
|
|
# Don't use stdenv's shell but our own
|
|
|
|
shell = self.bash + "/bin/bash";
|
|
|
|
# Build expand-response-params with last stage like below
|
|
|
|
buildPackages = {
|
|
|
|
inherit (prevStage) stdenv;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2015-01-09 20:22:12 +01:00
|
|
|
gcc = lib.makeOverridable (import ../../build-support/cc-wrapper) {
|
2014-09-11 01:18:14 +02:00
|
|
|
nativeTools = false;
|
|
|
|
nativeLibc = false;
|
2015-05-11 23:30:13 +02:00
|
|
|
isGNU = true;
|
2017-06-29 18:06:55 +02:00
|
|
|
buildPackages = {
|
|
|
|
inherit (prevStage) stdenv;
|
|
|
|
};
|
2016-12-24 16:07:20 +01:00
|
|
|
cc = prevStage.gcc-unwrapped;
|
2017-08-26 17:43:30 +02:00
|
|
|
bintools = self.binutils;
|
2018-01-12 01:15:40 +01:00
|
|
|
libc = getLibc self;
|
2017-08-26 17:43:30 +02:00
|
|
|
inherit (self) stdenvNoCC coreutils gnugrep;
|
2016-12-19 17:10:47 +01:00
|
|
|
shell = self.bash + "/bin/bash";
|
2014-09-11 01:18:14 +02:00
|
|
|
};
|
2010-01-19 12:25:33 +01:00
|
|
|
};
|
2017-08-15 17:30:45 +02:00
|
|
|
extraNativeBuildInputs = [ prevStage.patchelf prevStage.xz ] ++
|
2016-03-05 01:28:23 +01:00
|
|
|
# Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64.
|
2018-05-06 20:59:50 +02:00
|
|
|
lib.optional (!localSystem.isx86) prevStage.updateAutotoolsGnuConfigScriptsHook;
|
2016-12-24 16:38:56 +01:00
|
|
|
})
|
2012-12-28 16:41:56 +01:00
|
|
|
|
2014-08-23 21:26:37 +02:00
|
|
|
# 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.
|
2009-02-01 22:44:56 +01:00
|
|
|
#
|
2014-08-23 21:26:37 +02:00
|
|
|
# When updating stdenvLinux, make sure that the result has no
|
|
|
|
# dependency (`nix-store -qR') on bootstrapTools or the first
|
|
|
|
# binutils built.
|
2016-12-24 16:38:56 +01:00
|
|
|
(prevStage: {
|
2016-12-24 19:55:11 +01:00
|
|
|
inherit config overlays;
|
2016-12-24 16:38:56 +01:00
|
|
|
stdenv = import ../generic rec {
|
2018-02-01 01:00:00 +01:00
|
|
|
name = "stdenv-linux";
|
|
|
|
|
2017-07-06 03:47:48 +02:00
|
|
|
buildPlatform = localSystem;
|
|
|
|
hostPlatform = localSystem;
|
|
|
|
targetPlatform = localSystem;
|
2017-05-22 03:37:16 +02:00
|
|
|
inherit config;
|
2012-12-28 16:41:56 +01:00
|
|
|
|
2016-12-24 16:38:56 +01:00
|
|
|
preHook = ''
|
2014-01-07 13:57:42 +01:00
|
|
|
# Make "strip" produce deterministic output, by setting
|
|
|
|
# timestamps etc. to a fixed value.
|
|
|
|
commonStripFlags="--enable-deterministic-archives"
|
|
|
|
${commonPreHook}
|
|
|
|
'';
|
2012-12-28 16:41:56 +01:00
|
|
|
|
2016-12-24 16:38:56 +01:00
|
|
|
initialPath =
|
|
|
|
((import ../common-path.nix) {pkgs = prevStage;});
|
2005-02-21 21:42:07 +01:00
|
|
|
|
2017-08-15 17:30:45 +02:00
|
|
|
extraNativeBuildInputs = [ prevStage.patchelf prevStage.paxctl ] ++
|
2016-03-05 01:28:23 +01:00
|
|
|
# Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64.
|
2018-05-06 20:59:50 +02:00
|
|
|
lib.optional (!localSystem.isx86) prevStage.updateAutotoolsGnuConfigScriptsHook;
|
2012-12-28 16:41:56 +01:00
|
|
|
|
2016-12-24 16:38:56 +01:00
|
|
|
cc = prevStage.gcc;
|
2012-12-28 16:41:56 +01:00
|
|
|
|
2016-12-24 16:38:56 +01:00
|
|
|
shell = cc.shell;
|
2010-08-06 12:34:34 +02:00
|
|
|
|
2016-12-24 16:38:56 +01:00
|
|
|
inherit (prevStage.stdenv) fetchurlBoot;
|
2014-08-29 22:09:01 +02:00
|
|
|
|
2016-12-24 16:38:56 +01:00
|
|
|
extraAttrs = {
|
2018-02-09 15:43:39 +01:00
|
|
|
# TODO: remove this!
|
2016-12-24 16:38:56 +01:00
|
|
|
inherit (prevStage) glibc;
|
2018-02-09 15:43:39 +01:00
|
|
|
|
2016-12-24 16:38:56 +01:00
|
|
|
inherit platform bootstrapTools;
|
|
|
|
shellPackage = prevStage.bash;
|
|
|
|
};
|
2015-01-03 15:54:02 +01:00
|
|
|
|
2017-08-13 11:44:36 +02:00
|
|
|
# Mainly avoid reference to bootstrap tools
|
|
|
|
allowedRequisites = with prevStage; with lib;
|
|
|
|
# Simple executable tools
|
|
|
|
concatMap (p: [ (getBin p) (getLib p) ])
|
2017-08-26 17:43:30 +02:00
|
|
|
[ gzip bzip2 xz bash binutils.bintools coreutils diffutils findutils
|
|
|
|
gawk gnumake gnused gnutar gnugrep gnupatch patchelf ed paxctl
|
2018-04-01 02:00:00 +02:00
|
|
|
texinfo
|
2017-08-13 11:44:36 +02:00
|
|
|
]
|
|
|
|
# Library dependencies
|
2017-08-24 10:57:50 +02:00
|
|
|
++ map getLib (
|
|
|
|
[ attr acl zlib pcre ]
|
|
|
|
++ lib.optional (gawk.libsigsegv != null) gawk.libsigsegv
|
|
|
|
)
|
2017-08-13 11:44:36 +02:00
|
|
|
# More complicated cases
|
2018-01-12 01:15:40 +01:00
|
|
|
++ (map (x: getOutput x (getLibc prevStage)) [ "out" "dev" "bin" ] )
|
|
|
|
++ [ /*propagated from .dev*/ linuxHeaders
|
2017-08-26 17:43:30 +02:00
|
|
|
binutils gcc gcc.cc gcc.cc.lib gcc.expand-response-params
|
2017-08-13 11:44:36 +02:00
|
|
|
]
|
2018-05-06 20:59:50 +02:00
|
|
|
++ lib.optionals (!localSystem.isx86)
|
2017-08-15 08:08:12 +02:00
|
|
|
[ prevStage.updateAutotoolsGnuConfigScriptsHook prevStage.gnu-config ];
|
2016-12-24 16:38:56 +01:00
|
|
|
|
|
|
|
overrides = self: super: {
|
|
|
|
inherit (prevStage)
|
2017-02-12 00:15:12 +01:00
|
|
|
gzip bzip2 xz bash coreutils diffutils findutils gawk
|
2018-01-12 01:15:40 +01:00
|
|
|
gnumake gnused gnutar gnugrep gnupatch patchelf
|
2018-04-01 02:00:00 +02:00
|
|
|
attr acl paxctl zlib pcre texinfo;
|
2018-01-12 01:15:40 +01:00
|
|
|
${localSystem.libc} = getLibc prevStage;
|
2017-02-12 00:15:12 +01:00
|
|
|
} // lib.optionalAttrs (super.targetPlatform == localSystem) {
|
|
|
|
# Need to get rid of these when cross-compiling.
|
2018-04-03 18:50:25 +02:00
|
|
|
inherit (prevStage) binutils binutils-unwrapped;
|
2017-02-12 00:15:12 +01:00
|
|
|
gcc = cc;
|
2016-12-24 16:38:56 +01:00
|
|
|
};
|
2006-02-09 18:04:18 +01:00
|
|
|
};
|
2016-12-24 16:38:56 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
]
|