[Nix-dev] [PATCH 1/2] 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

Marc Weber marco-oweber at gmx.de
Tue Jun 8 02:25:58 CEST 2010


make all make invokations use runMake
---
 pkgs/stdenv/generic/setup.sh |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh
index 5e2fc7b..a9f4d4d 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"
-- 
1.6.6.2




More information about the nix-dev mailing list