Arne Schwabe has uploaded this change for review. ( 
https://gerrit.openvpn.net/c/openvpn/+/2018?usp=email )


Change subject: Make run-cppcheck.sh run on FreeBSD and macOS
......................................................................

Make run-cppcheck.sh run on FreeBSD and macOS

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]>
---
M dev-tools/run-cppcheck.sh
1 file changed, 9 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/18/2018/1

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/ \

--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2018?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I41bc0fcd475944f3c4701705a46f5a911480b283
Gerrit-Change-Number: 2018
Gerrit-PatchSet: 1
Gerrit-Owner: Arne Schwabe <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
  • [Openvpn-devel] [S] Change in... Arne Schwabe (Code Review) via Openvpn-devel

Reply via email to