top-level: Introduce targetPackages and a "double link fold"

Each bootstrapping stage ought to just depend on the previous stage, but
poorly-written compilers break this elegence. This provides an easy-enough
way to depend on the next stage: targetPackages. PLEASE DO NOT USE IT
UNLESS YOU MUST!

I'm hoping someday in a pleasant future I can revert this commit :)
This commit is contained in:
John Ericson
2017-04-23 14:01:12 -04:00
parent d59e4fbb75
commit 863d79b364
4 changed files with 52 additions and 6 deletions
+10
View File
@@ -50,6 +50,14 @@
# us to avoid expensive splicing.
buildPackages
, # The package set used in the next stage. If null, `__targetPackages` will be
# defined internally as the final produced package set itself, just like with
# `buildPackages` and for the same reasons.
#
# THIS IS A HACK for compilers that don't think critically about cross-
# compilation. Please do *not* use unless you really know what you are doing.
__targetPackages
, # The standard environment to use for building packages.
stdenv
@@ -88,6 +96,8 @@ let
stdenvBootstappingAndPlatforms = self: super: {
buildPackages = (if buildPackages == null then self else buildPackages)
// { recurseForDerivations = false; };
__targetPackages = (if __targetPackages == null then self else __targetPackages)
// { recurseForDerivations = false; };
inherit stdenv
buildPlatform hostPlatform targetPlatform;
};