35 lines
731 B
Bash
35 lines
731 B
Bash
# module used to provide common variable / functions
|
|
|
|
# select the appropriate quiet primitive
|
|
quiet='run_normaly'
|
|
[[ "$verbose" == "false" ]] && quiet='run_quietly vxsdk-build.log'
|
|
|
|
# Number of processor cores
|
|
[[ $(uname) == "OpenBSD" ]] && cores=$(sysctl -n hw.ncpu) || cores=$(nproc)
|
|
|
|
# Selecte make utility
|
|
[[ $(command -v gmake >/dev/null 2>&1) ]] && make_cmd=gmake || make_cmd=make
|
|
|
|
#
|
|
# Functions privided
|
|
#
|
|
|
|
run_normaly() {
|
|
bash -c "$@"
|
|
if [[ "$?" != 0 ]]; then
|
|
echo "$TAG error: command failed, abord"
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
run_quietly() {
|
|
out="$1"
|
|
shift 1
|
|
"$@" >$out 2>&1
|
|
if [[ "$?" != 0 ]]; then
|
|
>&2 echo "$TAG error: command failed, please check $(pwd)/$out o(x_x)o"
|
|
>&2 echo "$@"
|
|
exit 1
|
|
fi
|
|
}
|