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