Переглянути джерело

Adds option to specify the amount of parallel make jobs for build.sh.

If the value is not specified by the user explicitly, the value is chosen to be
equal to the number of CPUs/cores in the users machine.
Stefan Laudemann 9 роки тому
батько
коміт
67906b5f8a
2 змінених файлів з 6 додано та 3 видалено
  1. 1 0
      ReadMe.md
  2. 5 3
      build.sh

+ 1 - 0
ReadMe.md

@@ -18,6 +18,7 @@ Rufe `build.sh` auf und übergebe folgende Umgebungsvariablen:
 * **BRANCH** ist der Name des Firmware-Branches (also /stable/, /testing/ oder /experimental/)
 * **VERSION** wird die Versions-Nr. der neuen Firmware (kann bei BRANCH=experimental) weggelassen werden
 * **BROKEN** falls "1", erzeuge ebenfalls Firmware-Images für ungetestete Plattformen (default: "0")
+* **MAKEJOBS** spezifiziert die Anzahl der parallel laufenden Compiler-Prozesse (falls nicht angegeben, wird ein Prozess pro CPU/Kern gestartet)
 
 ```bash
 # Baut eine testing-Firmware auf Basis von Gluon 2014.4

+ 5 - 3
build.sh

@@ -10,6 +10,7 @@
 # VERSION   = the version tag (can only be empty if BRANCH=experimental)
 # BUILD_TS  = build timestamp (format: %Y-%m-%d %H:%M:%S)
 # BROKEN    = 0 (default) or 1, build the untested hardware model firmwares, too
+# MAKEJOBS  = number of compiler processes running in parallel (default: number of CPUs/Cores)
 #
 
 if [ "_$BRANCH" == "_" ]; then
@@ -81,21 +82,22 @@ if [ "$BRANCH" != "experimental" ]; then
 fi
 
 ### PREPARE
+[ -n "${MAKEJOBS}" ] || MAKEJOBS=$(grep -c "^processor" /proc/cpuinfo)
 progress "Preparing the build environment (make update) ..."
 make update
 [ "$?" -eq "0" ] || abort "Failed to update the build environment, mimimi."
 
 ### BUILD TOOLCHAIN
 progress "Building toolchain if necessary (this is not possible on a fresh build) ..."
-faketime "$BUILD_TS" make toolchain -j 1
+faketime "$BUILD_TS" make toolchain -j ${MAKEJOBS}
 
 ### BUILD FIRMWARE
 progress "Building the firmware - please stand by!"
 [ "_$BROKEN" == "_" ] && export BROKEN=0
 if [ "$BRANCH" != "experimental" ]; then
-	GLUON_BRANCH=$BRANCH GLUON_RELEASE=$VERSION BROKEN=$BROKEN faketime "$BUILD_TS" make -j 4
+	GLUON_BRANCH=$BRANCH GLUON_RELEASE=$VERSION BROKEN=$BROKEN faketime "$BUILD_TS" make -j ${MAKEJOBS}
 else
-	GLUON_BRANCH=experimental BROKEN=$BROKEN faketime "$BUILD_TS" make -j 4
+	GLUON_BRANCH=experimental faketime "$BUILD_TS" make -j ${MAKEJOBS}
 fi
 
 [ "$?" -eq "0" ] || abort "Failed to build the firmware, mimimi."