[Nix-dev] [PATCH 2/2] generic/setup.sh: add -j (+1) -l (*2) options to make depending on $NUM_CORES
Marc Weber
marco-oweber at gmx.de
Tue Jun 8 02:25:59 CEST 2010
---
pkgs/stdenv/generic/setup.sh | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh
index a9f4d4d..685c0ec 100644
--- a/pkgs/stdenv/generic/setup.sh
+++ b/pkgs/stdenv/generic/setup.sh
@@ -79,9 +79,19 @@ cmd(){
}
runMake(){
- cmd make ${makefile:+-f $makefile} "$@"
+ local optout=NO_PARALLEL_BUILD_${curPhase}
+ [ -n "${!optout}" ] || \
+ local j="$makeFlagsParallelBuild"
+ cmd make ${makefile:+-f $makefile} "$@" $j
}
+######################################################################
+# parallel builds: opt-out
+# - in a phase: set NO_PARALLEL_BUILD_${PHASE_NAME}
+# - for this build: pass NUM_CORES=1 to the builder
+if [ "$NUM_CORES" -gt 1 ]; then
+ makeFlagsParallelBuild="-j $(( $NUM_CORES + 1 )) -l $(( 2 * $NUM_CORES ))"
+fi
######################################################################
# Initialisation.
--
1.6.6.2
More information about the nix-dev
mailing list