about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-04-01 15:01:50 +0200
committerGitHub <noreply@github.com>2020-04-01 15:01:50 +0200
commit15e05d1706cc3cdc3d637e25ed83f6acbd26b59e (patch)
tree19e601293fe7794cce07ff7b9f3cae9a42693dcf
parent7eec3107fc57b9a43fc9e9edaae3315f56fd9523 (diff)
parent06f8299e7c353e592fe520ff5658b230a59f2ac6 (diff)
downloadprofani-tty-15e05d1706cc3cdc3d637e25ed83f6acbd26b59e.tar.gz
Merge pull request #1296 from wstrm/ci-without-coreutils
Fallback for nproc for systems without GNU coreutils
-rwxr-xr-xci-build.sh13
1 files changed, 12 insertions, 1 deletions
diff --git a/ci-build.sh b/ci-build.sh
index 438388b0..0a42e099 100755
--- a/ci-build.sh
+++ b/ci-build.sh
@@ -11,10 +11,21 @@ error_handler()
 
 trap error_handler ERR
 
+num_cores()
+{
+    # Check for cores, for systems with:
+    #   Line 1. Linux w/ coreutils, or...
+    #   Line 2. OpenBSD, FreeBSD, NetBSD or macOS, or...
+    #   Line 3. Fallback for Linux w/o coreutils (glibc).
+    nproc \
+        || sysctl -n hw.ncpu \
+        || getconf _NPROCESSORS_ONLN 2>/dev/null
+}
+
 ./bootstrap.sh
 
 tests=()
-MAKE="make --quiet -j$(nproc)"
+MAKE="make --quiet -j$(num_cores)"
 CC="gcc"
 
 case $(uname | tr '[:upper:]' '[:lower:]') in