From 3422bee58590d6627779b492a989bb285516a179 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Mon, 2 Jan 2023 12:21:02 +0000 Subject: [PATCH] build: use `$CIRRUS_CPU` to determine cpu count on CI related https://github.com/cirruslabs/cirrus-ci-docs/issues/1115 --- contrib/build_tools_util.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/contrib/build_tools_util.sh b/contrib/build_tools_util.sh index 1741761b4..cc2a0cb8c 100755 --- a/contrib/build_tools_util.sh +++ b/contrib/build_tools_util.sh @@ -129,7 +129,13 @@ if [ -n "$GCC_TRIPLET_BUILD" ] ; then fi export GCC_STRIP_BINARIES="${GCC_STRIP_BINARIES:-0}" -export CPU_COUNT="$(nproc 2> /dev/null || sysctl -n hw.ncpu)" + +if [ -n "$CIRRUS_CPU" ] ; then + # special-case for CI. see https://github.com/cirruslabs/cirrus-ci-docs/issues/1115 + export CPU_COUNT="$CIRRUS_CPU" +else + export CPU_COUNT="$(nproc 2> /dev/null || sysctl -n hw.ncpu)" +fi info "Found $CPU_COUNT CPUs, which we might use for building."