. ./build_common.sh
# Install directory prefix
if [ -z "$PREFIX" ]; then
- # shellcheck disable=SC2006
PREFIX=`mktempdir tcpdump_build`
echo "PREFIX set to '$PREFIX'"
fi
# these cases, please remember to remove respective exemption below to help any
# later warnings in the same matrix subset trigger an error.
-# shellcheck disable=SC2006
case `cc_id`/`os_id` in
clang-9.*/SunOS-5.11)
# (OpenIndiana)
;;
esac
-# shellcheck disable=SC2006
[ "$TCPDUMP_TAINTED" != yes ] && CFLAGS=`cc_werr_cflags`
if [ "$CMAKE" = no ]; then
# To make CI scripts maintenance simpler, copies of this file in the
# libpcap, tcpdump and tcpslice git repositories should be identical.
# Please mind that Solaris /bin/sh before 11 does not support the $()
-# command substitution syntax, hence the SC2006 directives.
+# command substitution syntax, hence the "-e SC2006" flag in Makefile.
# A poor man's mktemp(1) for OSes that don't have one (e.g. AIX 7, Solaris 9).
mktempdir_diy() {
while true; do
# /bin/sh implements $RANDOM in AIX 7, but not in Solaris before 11,
# thus use dd and od instead.
- # shellcheck disable=SC2006
mktempdir_diy_suffix=`dd if=/dev/urandom bs=4 count=1 2>/dev/null | od -t x -A n | head -1 | tr -d '\t '`
[ -z "$mktempdir_diy_suffix" ] && return 1
mktempdir_diy_path="${TMPDIR:-/tmp}/${1:?}.${mktempdir_diy_suffix}"
mktempdir() {
mktempdir_prefix=${1:-tmp}
- # shellcheck disable=SC2006
case `os_id` in
Darwin-*|FreeBSD-*|NetBSD-*)
# In these operating systems mktemp(1) always appends an implicit
# Try to make the current C compiler print its version information (usually
# multi-line) to stdout.
-# shellcheck disable=SC2006
cc_version_nocache() {
: "${CC:?}"
case `basename "$CC"` in
esac
}
-# shellcheck disable=SC2006
cc_version() {
echo "${cc_version_cached:=`cc_version_nocache`}"
}
# For the current C compiler try to print a short and uniform identification
# string (such as "gcc-9.3.0") that is convenient to use in a case statement.
-# shellcheck disable=SC2006
cc_id_nocache() {
cc_id_firstline=`cc_version | head -1`
: "${cc_id_firstline:?}"
fi
}
-# shellcheck disable=SC2006
cc_id() {
echo "${cc_id_cached:=`cc_id_nocache`}"
}
# For the current C compiler try to print CFLAGS value that tells to treat
# warnings as errors.
-# shellcheck disable=SC2006
cc_werr_cflags() {
case `cc_id` in
gcc-*|clang-*)
}
# Tell whether "gcc" is a symlink to Clang (this is the case on macOS).
-# shellcheck disable=SC2006
gcc_is_clang_in_disguise() {
case `cc_id`/`basename "${CC:?}"` in
clang-*/gcc)
return 1
}
-# shellcheck disable=SC2006
os_id() {
# OS does not change between builds or in the middle of a build, so it is
# fine to cache uname output.
}
print_so_deps() {
- # shellcheck disable=SC2006
case `os_id` in
Darwin-*)
run_after_echo otool -L "${1:?}"
}
purge_directory() {
- # shellcheck disable=SC2006
if [ "`os_id`" = SunOS-5.11 ]; then
# In Solaris 11 /bin/sh the pathname expansion of "*" always includes
# "." and "..", so the straightforward rm would always fail.
print_sysinfo
# Install directory prefix
if [ -z "$PREFIX" ]; then
- # shellcheck disable=SC2006
PREFIX=`mktempdir tcpdump_build_matrix`
echo "PREFIX set to '$PREFIX'"
export PREFIX
export CRYPTO
for SMB in $MATRIX_SMB; do
export SMB
- # shellcheck disable=SC2006
COUNT=`increment $COUNT`
echo_magenta "===== SETUP $COUNT: BUILD_LIBPCAP=$BUILD_LIBPCAP REMOTE=${REMOTE:-?} CC=$CC CMAKE=$CMAKE CRYPTO=$CRYPTO SMB=$SMB =====" >&2
# Run one build with setup environment variables: