From 4f1075c40b37600efdaf033568870bba8528b2d9 Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Tue, 15 Jun 2010 19:00:48 +0000 Subject: [PATCH] generic/setup.sh: remove duplication: - add generic showCommand function which prints a command before running it - add runMake which is using that function passing the makefile if set make all make invokations use runMake svn path=/nixpkgs/branches/stdenv-updates/; revision=22282 --- pkgs/stdenv/generic/setup.sh | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 5e2fc7b24dbe..a9f4d4dc357d 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -73,6 +73,15 @@ addToSearchPath() { addToSearchPathWithCustomDelimiter "${PATH_DELIMITER}" "$@" } +cmd(){ + echo "cmd: $@" + "$@" +} + +runMake(){ + cmd make ${makefile:+-f $makefile} "$@" +} + ###################################################################### # Initialisation. @@ -601,9 +610,7 @@ buildPhase() { return fi - echo "make flags: $makeFlags ${makeFlagsArray[@]} $buildFlags ${buildFlagsArray[@]}" - make ${makefile:+-f $makefile} \ - $makeFlags "${makeFlagsArray[@]}" \ + runMake $makeFlags "${makeFlagsArray[@]}" \ $buildFlags "${buildFlagsArray[@]}" runHook postBuild @@ -613,9 +620,7 @@ buildPhase() { checkPhase() { runHook preCheck - echo "check flags: $makeFlags ${makeFlagsArray[@]} $checkFlags ${checkFlagsArray[@]}" - make ${makefile:+-f $makefile} \ - $makeFlags "${makeFlagsArray[@]}" \ + runMake $makeFlags "${makeFlagsArray[@]}" \ $checkFlags "${checkFlagsArray[@]}" ${checkTarget:-check} runHook postCheck @@ -663,8 +668,7 @@ installPhase() { ensureDir "$prefix" installTargets=${installTargets:-install} - echo "install flags: $installTargets $makeFlags ${makeFlagsArray[@]} $installFlags ${installFlagsArray[@]}" - make ${makefile:+-f $makefile} $installTargets \ + runMake $installTargets \ $makeFlags "${makeFlagsArray[@]}" \ $installFlags "${installFlagsArray[@]}" @@ -740,8 +744,7 @@ fixupPhase() { distPhase() { runHook preDist - echo "dist flags: $distFlags ${distFlagsArray[@]}" - make ${makefile:+-f $makefile} $distFlags "${distFlagsArray[@]}" ${distTarget:-dist} + runMake $distFlags "${distFlagsArray[@]}" ${distTarget:-dist} if test "$dontCopyDist" != 1; then ensureDir "$out/tarballs"