From 1de786446366bc5b821c8eaa323e5ca11154d2f1 Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Sun, 9 May 2021 22:01:13 +0200 Subject: [PATCH] build_engine/editor.sh: Use sysctl on OpenBSD to get number of cores. --- build_editor.sh | 8 ++++++-- build_engine.sh | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/build_editor.sh b/build_editor.sh index 1545f994..5aab6187 100755 --- a/build_editor.sh +++ b/build_editor.sh @@ -14,8 +14,12 @@ COMPILE_SYS=$(uname) # Check how many cores/processors we should use for building if ! [ -x "$(command -v nproc)" ]; then - # nproc doesn't exist, so make a safe assumption of having at least 1 - BUILD_PROC=1 + # check if we're on OpenBSD then + if ! [ -x "$(command -v sysctl)" ]; then + BUILD_PROC=1 + else + BUILD_PROC=$(sysctl -n hw.ncpu) + fi else BUILD_PROC=$(nproc) fi diff --git a/build_engine.sh b/build_engine.sh index 66a520a3..f6fbc39b 100755 --- a/build_engine.sh +++ b/build_engine.sh @@ -8,8 +8,12 @@ COMPILE_SYS=$(uname) # Check how many cores/processors we should use for building if ! [ -x "$(command -v nproc)" ]; then - # nproc doesn't exist, so make a safe assumption of having at least 1 - BUILD_PROC=1 + # check if we're on OpenBSD then + if ! [ -x "$(command -v sysctl)" ]; then + BUILD_PROC=1 + else + BUILD_PROC=$(sysctl -n hw.ncpu) + fi else BUILD_PROC=$(nproc) fi