3 # This script executes the matrix loops, exclude tests and cleaning.
4 # It calls the build.sh script which runs one build with setup environment
5 # variables: BUILD_LIBPCAP, REMOTE, CC, CMAKE, CRYPTO and SMB.
6 # The matrix can be configured with environment variables
7 # MATRIX_BUILD_LIBPCAP, MATRIX_REMOTE, MATRIX_CC, MATRIX_CMAKE, MATRIX_CRYPTO
10 : "${MATRIX_BUILD_LIBPCAP:=no yes}"
11 : "${MATRIX_REMOTE:=no}"
12 : "${MATRIX_CC:=gcc clang}"
13 : "${MATRIX_CMAKE:=no yes}"
14 : "${MATRIX_CRYPTO:=no yes}"
15 : "${MATRIX_SMB:=no yes}"
19 # Install directory prefix
20 if [ -z "$PREFIX" ]; then
21 # shellcheck disable=SC2006
22 PREFIX
=`mktempdir tcpdump_build_matrix`
23 echo "PREFIX set to '$PREFIX'"
29 for CC
in $MATRIX_CC; do
31 # Exclude gcc on macOS (it is just an alias for clang).
32 # shellcheck disable=SC2006
33 if [ "$CC" = gcc
] && [ "`uname -s`" = Darwin
]; then
37 for CMAKE
in $MATRIX_CMAKE; do
39 for CRYPTO
in $MATRIX_CRYPTO; do
41 for SMB
in $MATRIX_SMB; do
43 # shellcheck disable=SC2006
44 COUNT
=`increment $COUNT`
45 echo_magenta
"===== SETUP $COUNT: BUILD_LIBPCAP=$BUILD_LIBPCAP REMOTE=${REMOTE:-?} CC=$CC CMAKE=$CMAKE CRYPTO=$CRYPTO SMB=$SMB ====="
46 # Run one build with setup environment variables:
47 # BUILD_LIBPCAP, REMOTE, CC, CMAKE, CRYPTO and SMB
48 run_after_echo .
/build.sh
50 if [ "$CMAKE" = yes ]; then
51 run_after_echo
rm -rf build
53 run_after_echo
make distclean
55 run_after_echo
rm -rf "$PREFIX"/bin
/tcpdump
*
56 run_after_echo git status
-suall
57 # Cancel changes in configure
58 run_after_echo git checkout configure
65 touch .devel configure
66 for BUILD_LIBPCAP
in $MATRIX_BUILD_LIBPCAP; do
68 if [ "$BUILD_LIBPCAP" = yes ]; then
69 for REMOTE
in $MATRIX_REMOTE; do
71 # Build libpcap with Autoconf.
72 echo_magenta
"Build libpcap (CMAKE=no REMOTE=$REMOTE)"
73 (cd ..
/libpcap
&& CMAKE
=no .
/build.sh
)
74 # Set PKG_CONFIG_PATH for configure when building libpcap
75 if [ "$CMAKE" != no
]; then
76 PKG_CONFIG_PATH
="$PREFIX/lib/pkgconfig"
77 export PKG_CONFIG_PATH
82 echo_magenta
'Use system libpcap'
83 purge_directory
"$PREFIX"
84 (cd ..
/libpcap
; make distclean ||
echo '(Ignoring the make error.)')
89 run_after_echo
rm -rf "$PREFIX"
90 echo_magenta
"Tested setup count: $COUNT"
91 # vi: set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab autoindent :