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"; getLib = getOutput "lib";
getDev = getOutput "dev"; 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 ***/ /*** deprecated stuff ***/

View File

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