]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
make.sh: Improve CPU core count detection
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 8 Jul 2026 13:50:26 +0000 (13:50 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 8 Jul 2026 13:50:26 +0000 (13:50 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
make.sh

diff --git a/make.sh b/make.sh
index b060bfbdf862a300f36eb446931a02022f753b06..48e6d90cd128551d4d6061883437f13381ef30d5 100755 (executable)
--- a/make.sh
+++ b/make.sh
@@ -152,7 +152,12 @@ find_base() {
 }
 
 system_processors() {
-       getconf _NPROCESSORS_ONLN 2>/dev/null || echo "1"
+       # On some systems, the build system might run in a CPU affinity group
+       # which means that some CPUs are not available to be used. getconf will
+       # however report the total number which launches more processes than
+       # we want. nproc gets this right (without --all) so we will prefer
+       # nproc, but fall back to getconf.
+       nproc 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null || echo "1"
 }
 
 system_memory() {