commit b77e3721f19b4e5084125eb8dc7186117004dd4b Author: Marc Weber Date: Sun Jun 13 23:53:46 2010 +0200 generic/setup.sh: add -j (+1) -l (*2) options to make depending on $NUM_CORES 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.