stdenv.mkDerivation: Use chooseDevOutputs

This commit is contained in:
Tuomas Tynkkynen 2016-01-24 00:18:38 +02:00
parent 3243c4f272
commit 5326e85f3d
2 changed files with 15 additions and 9 deletions

View File

@ -454,6 +454,8 @@ rec {
getLib = getOutput "lib";
getDev = getOutput "dev";
/* Pick the outputs of packages to place in buildInputs */
chooseDevOutputs = drvs: builtins.map (drv: if drv.outputUnspecified or false then drv.dev or drv else drv) drvs;
/*** deprecated stuff ***/

View File

@ -158,9 +158,13 @@ let
outputs ++
(if separateDebugInfo then assert result.isLinux; [ "debug" ] else []);
buildInputs' = buildInputs ++
buildInputs' = lib.chooseDevOutputs buildInputs ++
(if separateDebugInfo then [ ../../build-support/setup-hooks/separate-debug-info.sh ] else []);
nativeBuildInputs' = lib.chooseDevOutputs nativeBuildInputs;
propagatedBuildInputs' = lib.chooseDevOutputs propagatedBuildInputs;
propagatedNativeBuildInputs' = lib.chooseDevOutputs propagatedNativeBuildInputs;
in
# Throw an error if trying to evaluate an non-valid derivation
@ -176,13 +180,13 @@ let
"sandboxProfile" "propagatedSandboxProfile"])
// (let
computedSandboxProfile =
lib.concatMap (input: input.__propagatedSandboxProfile or []) (extraBuildInputs ++ buildInputs ++ nativeBuildInputs);
lib.concatMap (input: input.__propagatedSandboxProfile or []) (extraBuildInputs ++ buildInputs' ++ nativeBuildInputs');
computedPropagatedSandboxProfile =
lib.concatMap (input: input.__propagatedSandboxProfile or []) (propagatedBuildInputs ++ propagatedNativeBuildInputs);
lib.concatMap (input: input.__propagatedSandboxProfile or []) (propagatedBuildInputs' ++ propagatedNativeBuildInputs');
computedImpureHostDeps =
lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) (extraBuildInputs ++ buildInputs ++ nativeBuildInputs));
lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) (extraBuildInputs ++ buildInputs' ++ nativeBuildInputs'));
computedPropagatedImpureHostDeps =
lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) (propagatedBuildInputs ++ propagatedNativeBuildInputs));
lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) (propagatedBuildInputs' ++ propagatedNativeBuildInputs'));
in
{
builder = attrs.realBuilder or shell;
@ -194,17 +198,17 @@ let
# Inputs built by the cross compiler.
buildInputs = if crossConfig != null then buildInputs' else [];
propagatedBuildInputs = if crossConfig != null then propagatedBuildInputs else [];
propagatedBuildInputs = if crossConfig != null then propagatedBuildInputs' else [];
# Inputs built by the usual native compiler.
nativeBuildInputs = nativeBuildInputs
nativeBuildInputs = nativeBuildInputs'
++ lib.optionals (crossConfig == null) buildInputs'
++ lib.optional
(result.isCygwin
|| (crossConfig != null && lib.hasSuffix "mingw32" crossConfig))
../../build-support/setup-hooks/win-dll-link.sh
;
propagatedNativeBuildInputs = propagatedNativeBuildInputs ++
(if crossConfig == null then propagatedBuildInputs else []);
propagatedNativeBuildInputs = propagatedNativeBuildInputs' ++
(if crossConfig == null then propagatedBuildInputs' else []);
} // ifDarwin {
# TODO: remove lib.unique once nix has a list canonicalization primitive
__sandboxProfile =