aboutsummaryrefslogtreecommitdiff
path: root/libexec/build-num-cpus
diff options
context:
space:
mode:
Diffstat (limited to 'libexec/build-num-cpus')
-rwxr-xr-xlibexec/build-num-cpus17
1 files changed, 17 insertions, 0 deletions
diff --git a/libexec/build-num-cpus b/libexec/build-num-cpus
new file mode 100755
index 0000000..ab88f3f
--- /dev/null
+++ b/libexec/build-num-cpus
@@ -0,0 +1,17 @@
+#!/usr/bin/env build
+
+case "${CBUILD:-$(build-dumpmachine)}" in
+(*linux*) eval 'build_num_cpus() { nproc; }';;
+(*) die "unknown host '${CBUILD}'";;
+esac
+
+if test "${BUILDER_CALL_STACK}" = '__main__'; then
+ for arg; do
+ case "${arg}" in
+ (-h|-help|--help) echo 'usage: build num-cpus'; exit 0;;
+ esac
+ done
+ build_num_cpus "${@}"
+fi
+
+# vim: filetype=sh