aboutsummaryrefslogtreecommitdiff
path: root/build.sh
diff options
context:
space:
mode:
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh19
1 files changed, 16 insertions, 3 deletions
diff --git a/build.sh b/build.sh
index 642f5ca..e4da0b7 100755
--- a/build.sh
+++ b/build.sh
@@ -43,10 +43,23 @@ NODE=${NODE-${NISSY_BUILD_NODE:-"node"}}
43# The default value is 16. 43# The default value is 16.
44THREADS=${THREADS-${NISSY_BUILD_THREADS}} 44THREADS=${THREADS-${NISSY_BUILD_THREADS}}
45 45
46portable_nproc() {
47 OS="$(uname -s)"
48 case "$OS" in
49 "Linux")
50 nproc
51 ;;
52 "Darwin" | "*BSD")
53 sysctl -n hw.ncpu
54 ;;
55 *)
56 echo "32" # A safe, large default
57 ;;
58 esac
59}
60
46detectthreads() { 61detectthreads() {
47 # TODO: detect based on system 62 echo "$(portable_nproc)"
48 # Is 'getconf NPROCESSORD_ONLN' portable? Is it threads or cores?
49 echo "16"
50} 63}
51 64
52[ -z "$THREADS" ] && THREADS="$(detectthreads)" 65[ -z "$THREADS" ] && THREADS="$(detectthreads)"

Generated with cgit - Back to sebastiano.tronto.net