From: Arne Schwabe <[email protected]> FreeBSD has no /bin/bash, while macOS has an old 3.2.57 version from 2007.
Also work around the differences in readlink and different methods to get the number of cpu cores. Change-Id: I41bc0fcd475944f3c4701705a46f5a911480b283 Signed-off-by: Arne Schwabe <[email protected]> Acked-by: Gert Doering <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2018 --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2018 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering <[email protected]> diff --git a/dev-tools/run-cppcheck.sh b/dev-tools/run-cppcheck.sh index 3c71c83..58609b2 100755 --- a/dev-tools/run-cppcheck.sh +++ b/dev-tools/run-cppcheck.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -eu @@ -17,12 +17,18 @@ disable_arg="--disable=information" fi -SCRIPT_DIR=$(dirname $(readlink -e "${BASH_SOURCE[0]}")) +if [ $(uname) = "Darwin" ] || [ $(uname) = "FreeBSD" ]; then + SCRIPT_DIR=$(dirname $(readlink -f "${BASH_SOURCE[0]}")) + num_procs=$(sysctl -n hw.ncpu) +else + SCRIPT_DIR=$(dirname $(readlink -e "${BASH_SOURCE[0]}")) + num_procs=$(nprocs) +fi : ${SOURCE_DIR:=$SCRIPT_DIR/..} : ${BUILD_DIR:=$PWD} : ${INCLUDE_FLAGS:=} CPPCHECK_DIR="${BUILD_DIR}/cppcheck_build_dir" -COMMON_ARGS="-j$(nproc) ${verbosity_arg} \ +COMMON_ARGS="-j${num_procs} ${verbosity_arg} \ -DMBEDTLS_SSL_PROTO_TLS1_3 -DMBEDTLS_SSL_KEYING_MATERIAL_EXPORT \ -I./include/ -I./tests/unit_tests/openvpn/ \ -I./src/compat/ -I./src/openvpn/ -I./src/openvpnserv/ -I./src/plugins/auth-pam/ \ _______________________________________________ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
