From 2f9219918357023484cde6268c50293b253a88c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Sat, 30 Aug 2014 08:43:46 +0200 Subject: [PATCH] multiout: resolve general ToDos --- .../setup-hooks/multiple-outputs.sh | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/pkgs/build-support/setup-hooks/multiple-outputs.sh b/pkgs/build-support/setup-hooks/multiple-outputs.sh index b3274c88cd7b..c84e0acd3c68 100644 --- a/pkgs/build-support/setup-hooks/multiple-outputs.sh +++ b/pkgs/build-support/setup-hooks/multiple-outputs.sh @@ -3,7 +3,6 @@ preFixupHooks+=(_multioutDocs) preFixupHooks+=(_multioutDevs) postFixupHooks+=(_multioutPropagateDev) - # Assign the first string containing nonempty variable to the variable named $1 _assignFirst() { local varName="$1" @@ -14,25 +13,29 @@ _assignFirst() { done return 1 # none found } +# Same as _assignFirst, but only if "$1" = "" +_overrideFirst() { + if [ -z "${!1}" ]; then + _assignFirst "$@" + fi +} + # Setup chains of sane default values with easy overridability. # The variables are global to be usable anywhere during the build. -# ToDo: I was unable to get rid of the double-name redundancy (I hate bash eval ways) -# ToDo: easy way of overriding from withing mkDerivation attrset +_overrideFirst outputDev "dev" "out" +_overrideFirst outputBin "bin" "out" -_assignFirst outputDev "$outputDev" "dev" "out" -_assignFirst outputBin "$outputBin" "bin" "out" - -_assignFirst outputInclude "$outputInclude" "$outputDev" +_overrideFirst outputInclude "$outputDev" # so-libs are often among the main things to keep, and so go to $out -_assignFirst outputLib "$outputLib" "lib" "out" +_overrideFirst outputLib "lib" "out" -_assignFirst outputDoc "$outputDoc" "doc" "out" +_overrideFirst outputDoc "doc" "out" # man and info pages are small and often useful to distribute with binaries -_assignFirst outputMan "$outputMan" "man" "doc" "$outputBin" -_assignFirst outputInfo "$outputInfo" "info" "doc" "$outputMan" +_overrideFirst outputMan "man" "doc" "$outputBin" +_overrideFirst outputInfo "info" "doc" "$outputMan" # Make stdenv put propagated*BuildInputs into $outputDev instead of $out propagateIntoOutput="${!outputDev}"