]> The Tcpdump Group git mirrors - tcpdump/blob - build_matrix.sh
CI: Add warning exemptions for Sun C (suncc-5.14) on Solaris 10
[tcpdump] / build_matrix.sh
1 #!/bin/sh -e
2
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
8 # and MATRIX_SMB.
9
10 : "${MATRIX_BUILD_LIBPCAP:=yes no}"
11 : "${MATRIX_REMOTE:=no}"
12 : "${MATRIX_CC:=gcc clang}"
13 : "${MATRIX_CMAKE:=no yes}"
14 : "${MATRIX_CRYPTO:=no yes}"
15 : "${MATRIX_SMB:=no yes}"
16 # Set this variable to "yes" before calling this script to disregard all cmake
17 # warnings in a particular environment (CI or a local working copy). Set it
18 # to "yes" in this script or in build.sh when a matrix subset is known to be
19 # not cmake warning-free because of the version or whatever other factor
20 # that the scripts can detect both in and out of CI.
21 : "${TCPDUMP_CMAKE_TAINTED:=no}"
22 # Set this variable to "yes" before calling this script to disregard all
23 # warnings in a particular environment (CI or a local working copy). Set it
24 # to "yes" in this script or in build.sh when a matrix subset is known to be
25 # not warning-free because of the OS, the compiler or whatever other factor
26 # that the scripts can detect both in and out of CI.
27 : "${TCPDUMP_TAINTED:=no}"
28 # Some OSes have native make without parallel jobs support and sometimes have
29 # GNU Make available as "gmake".
30 : "${MAKE_BIN:=make}"
31
32 . ./build_common.sh
33 print_sysinfo
34 # Install directory prefix
35 if [ -z "$PREFIX" ]; then
36 PREFIX=`mktempdir tcpdump_build_matrix`
37 echo "PREFIX set to '$PREFIX'"
38 export PREFIX
39 fi
40 COUNT=0
41 export TCPDUMP_TAINTED
42 export TCPDUMP_CMAKE_TAINTED
43 export MAKE_BIN
44
45 build_tcpdump() {
46 for CMAKE in $MATRIX_CMAKE; do
47 export CMAKE
48 for CRYPTO in $MATRIX_CRYPTO; do
49 export CRYPTO
50 for SMB in $MATRIX_SMB; do
51 export SMB
52 COUNT=`increment "$COUNT"`
53 echo_magenta "===== SETUP $COUNT: CC=$CC BUILD_LIBPCAP=$BUILD_LIBPCAP REMOTE=${REMOTE:-?} CMAKE=$CMAKE CRYPTO=$CRYPTO SMB=$SMB =====" >&2
54 # Run one build with setup environment variables:
55 # BUILD_LIBPCAP, REMOTE, CC, CMAKE, CRYPTO and SMB
56 run_after_echo ./build.sh
57 echo 'Cleaning...'
58 if [ "$CMAKE" = yes ]; then
59 run_after_echo rm -rf build
60 else
61 run_after_echo "$MAKE_BIN" distclean
62 fi
63 run_after_echo rm -rf "$PREFIX"/bin/tcpdump*
64 run_after_echo git status -suall
65 done
66 done
67 done
68 }
69
70 run_after_echo git show --oneline -s | cat
71 touch .devel
72 for CC in $MATRIX_CC; do
73 export CC
74 discard_cc_cache
75 if gcc_is_clang_in_disguise; then
76 echo '(skipped)'
77 continue
78 fi
79 for BUILD_LIBPCAP in $MATRIX_BUILD_LIBPCAP; do
80 export BUILD_LIBPCAP
81 if [ "$BUILD_LIBPCAP" = yes ]; then
82 for REMOTE in $MATRIX_REMOTE; do
83 export REMOTE
84 # Build libpcap with Autoconf.
85 echo_magenta "Build libpcap (CMAKE=no REMOTE=$REMOTE)" >&2
86 (cd ../libpcap && CMAKE=no ./build.sh)
87 # Set PKG_CONFIG_PATH for configure when building libpcap
88 if [ "$CMAKE" != no ]; then
89 PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig"
90 export PKG_CONFIG_PATH
91 fi
92 build_tcpdump
93 done
94 else
95 echo_magenta 'Use system libpcap' >&2
96 purge_directory "$PREFIX"
97 if [ -d ../libpcap ]; then
98 (cd ../libpcap; "$MAKE_BIN" distclean || echo '(Ignoring the make error.)')
99 fi
100 build_tcpdump
101 fi
102 done
103 done
104
105 run_after_echo rm -rf "$PREFIX"
106 echo_magenta "Tested setup count: $COUNT" >&2
107 # vi: set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab autoindent :