cross-stdenv: Inline useless bindings and reindent

Semantics should be unchanged
This commit is contained in:
John Ericson 2017-01-15 16:47:53 -05:00
parent 09401d44eb
commit 1c0365bd88

View File

@ -56,21 +56,18 @@ rec {
# Return a modified stdenv that adds a cross compiler to the
# builds.
makeStdenvCross = stdenv: cross: binutilsCross: gccCross: stdenv //
{ mkDerivation = {name ? "", buildInputs ? [], nativeBuildInputs ? [],
propagatedBuildInputs ? [], propagatedNativeBuildInputs ? [],
selfNativeBuildInput ? false, ...}@args: let
makeStdenvCross = stdenv: cross: binutilsCross: gccCross: stdenv // {
mkDerivation =
{ name ? "", buildInputs ? [], nativeBuildInputs ? []
, propagatedBuildInputs ? [], propagatedNativeBuildInputs ? []
, selfNativeBuildInput ? false, ...
} @ args:
let
# *BuildInputs exists temporarily as another name for
# *HostInputs.
# In nixpkgs, sometimes 'null' gets in as a buildInputs element,
# and we handle that through isAttrs.
nativeBuildInputsDrvs = nativeBuildInputs;
buildInputsDrvs = buildInputs;
propagatedBuildInputsDrvs = propagatedBuildInputs;
propagatedNativeBuildInputsDrvs = propagatedNativeBuildInputs;
# The base stdenv already knows that nativeBuildInputs and
# buildInputs should be built with the usual gcc-wrapper
# And the same for propagatedBuildInputs.
@ -85,10 +82,10 @@ rec {
buildInputsNotNull = stdenv.lib.filter
(drv: builtins.isAttrs drv && drv ? nativeDrv) buildInputs;
nativeInputsFromBuildInputs = stdenv.lib.filter hostAsNativeDrv buildInputsNotNull;
in stdenv.mkDerivation (args // {
in
stdenv.mkDerivation (args // {
name = name + "-" + cross.config;
nativeBuildInputs = nativeBuildInputsDrvs
nativeBuildInputs = nativeBuildInputs
++ nativeInputsFromBuildInputs
++ [ gccCross binutilsCross ]
++ stdenv.lib.optional selfNativeBuildInput nativeDrv
@ -102,14 +99,15 @@ rec {
# any library needed to link the program dynamically at
# loader time. ld(1) explains it.
buildInputs = [];
propagatedBuildInputs = propagatedBuildInputsDrvs ++ buildInputsDrvs;
propagatedNativeBuildInputs = propagatedNativeBuildInputsDrvs;
propagatedBuildInputs = propagatedBuildInputs ++ buildInputs;
propagatedNativeBuildInputs = propagatedNativeBuildInputs;
crossConfig = cross.config;
} // args.crossAttrs or {});
} // {
inherit gccCross binutilsCross;
ccCross = gccCross;
};