cross-stdenv: Inline useless bindings and reindent
Semantics should be unchanged
This commit is contained in:
parent
09401d44eb
commit
1c0365bd88
@ -56,61 +56,59 @@ 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 // {
|
||||
|
||||
# *BuildInputs exists temporarily as another name for
|
||||
# *HostInputs.
|
||||
mkDerivation =
|
||||
{ name ? "", buildInputs ? [], nativeBuildInputs ? []
|
||||
, propagatedBuildInputs ? [], propagatedNativeBuildInputs ? []
|
||||
, selfNativeBuildInput ? false, ...
|
||||
} @ args:
|
||||
|
||||
# In nixpkgs, sometimes 'null' gets in as a buildInputs element,
|
||||
# and we handle that through isAttrs.
|
||||
nativeBuildInputsDrvs = nativeBuildInputs;
|
||||
buildInputsDrvs = buildInputs;
|
||||
propagatedBuildInputsDrvs = propagatedBuildInputs;
|
||||
propagatedNativeBuildInputsDrvs = propagatedNativeBuildInputs;
|
||||
let
|
||||
# *BuildInputs exists temporarily as another name for
|
||||
# *HostInputs.
|
||||
|
||||
# The base stdenv already knows that nativeBuildInputs and
|
||||
# buildInputs should be built with the usual gcc-wrapper
|
||||
# And the same for propagatedBuildInputs.
|
||||
nativeDrv = stdenv.mkDerivation args;
|
||||
# The base stdenv already knows that nativeBuildInputs and
|
||||
# buildInputs should be built with the usual gcc-wrapper
|
||||
# And the same for propagatedBuildInputs.
|
||||
nativeDrv = stdenv.mkDerivation args;
|
||||
|
||||
# Temporary expression until the cross_renaming, to handle the
|
||||
# case of pkgconfig given as buildInput, but to be used as
|
||||
# nativeBuildInput.
|
||||
hostAsNativeDrv = drv:
|
||||
builtins.unsafeDiscardStringContext drv.nativeDrv.drvPath
|
||||
== builtins.unsafeDiscardStringContext drv.crossDrv.drvPath;
|
||||
buildInputsNotNull = stdenv.lib.filter
|
||||
(drv: builtins.isAttrs drv && drv ? nativeDrv) buildInputs;
|
||||
nativeInputsFromBuildInputs = stdenv.lib.filter hostAsNativeDrv buildInputsNotNull;
|
||||
# Temporary expression until the cross_renaming, to handle the
|
||||
# case of pkgconfig given as buildInput, but to be used as
|
||||
# nativeBuildInput.
|
||||
hostAsNativeDrv = drv:
|
||||
builtins.unsafeDiscardStringContext drv.nativeDrv.drvPath
|
||||
== builtins.unsafeDiscardStringContext drv.crossDrv.drvPath;
|
||||
buildInputsNotNull = stdenv.lib.filter
|
||||
(drv: builtins.isAttrs drv && drv ? nativeDrv) buildInputs;
|
||||
nativeInputsFromBuildInputs = stdenv.lib.filter hostAsNativeDrv buildInputsNotNull;
|
||||
in
|
||||
stdenv.mkDerivation (args // {
|
||||
name = name + "-" + cross.config;
|
||||
nativeBuildInputs = nativeBuildInputs
|
||||
++ nativeInputsFromBuildInputs
|
||||
++ [ gccCross binutilsCross ]
|
||||
++ stdenv.lib.optional selfNativeBuildInput nativeDrv
|
||||
# without proper `file` command, libtool sometimes fails
|
||||
# to recognize 64-bit DLLs
|
||||
++ stdenv.lib.optional (cross.config == "x86_64-w64-mingw32") pkgs.file
|
||||
;
|
||||
|
||||
in stdenv.mkDerivation (args // {
|
||||
name = name + "-" + cross.config;
|
||||
nativeBuildInputs = nativeBuildInputsDrvs
|
||||
++ nativeInputsFromBuildInputs
|
||||
++ [ gccCross binutilsCross ]
|
||||
++ stdenv.lib.optional selfNativeBuildInput nativeDrv
|
||||
# without proper `file` command, libtool sometimes fails
|
||||
# to recognize 64-bit DLLs
|
||||
++ stdenv.lib.optional (cross.config == "x86_64-w64-mingw32") pkgs.file
|
||||
;
|
||||
# Cross-linking dynamic libraries, every buildInput should
|
||||
# be propagated because ld needs the -rpath-link to find
|
||||
# any library needed to link the program dynamically at
|
||||
# loader time. ld(1) explains it.
|
||||
buildInputs = [];
|
||||
propagatedBuildInputs = propagatedBuildInputs ++ buildInputs;
|
||||
propagatedNativeBuildInputs = propagatedNativeBuildInputs;
|
||||
|
||||
# Cross-linking dynamic libraries, every buildInput should
|
||||
# be propagated because ld needs the -rpath-link to find
|
||||
# any library needed to link the program dynamically at
|
||||
# loader time. ld(1) explains it.
|
||||
buildInputs = [];
|
||||
propagatedBuildInputs = propagatedBuildInputsDrvs ++ buildInputsDrvs;
|
||||
propagatedNativeBuildInputs = propagatedNativeBuildInputsDrvs;
|
||||
crossConfig = cross.config;
|
||||
} // args.crossAttrs or {});
|
||||
|
||||
crossConfig = cross.config;
|
||||
} // args.crossAttrs or {});
|
||||
} // {
|
||||
inherit gccCross binutilsCross;
|
||||
ccCross = gccCross;
|
||||
};
|
||||
inherit gccCross binutilsCross;
|
||||
ccCross = gccCross;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/* Modify a stdenv so that the specified attributes are added to
|
||||
|
Loading…
Reference in New Issue
Block a user