blob: 37d6c6b37a99c975cb475fc88f602c0c8b9e2194 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#!/usr/bin/env build
# FIXME maybe we should rely on a list of possible commands and go through them
# all (nproc,lscpu,etc..) instead of attempting to guess based on the OS?
case "${CBUILD:-$(build-dumpmachine)}" in
(*linux*) eval 'build_num_cpus() { nproc; }';;
# Default to returning 1 CPU if we do not know how to handle the platform.
(*) eval 'build_num_cpus() { echo 1; }';;
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
|