]> The Tcpdump Group git mirrors - tcpslice/blob - build_matrix.sh
0f10015a5adbd21515c230c6abd08d329780cad6
[tcpslice] / build_matrix.sh
1 #!/bin/sh -e
2
3 # This script executes the matrix loop, exclude tests and cleaning.
4 # The matrix can be configured with the following environment variables:
5 : "${MATRIX_CC:=gcc clang}"
6 : "${MATRIX_BUILD_LIBPCAP:=yes no}"
7 # Set this variable to "yes" before calling this script to disregard all
8 # warnings in a particular environment (CI or a local working copy). Set it to
9 # "yes" in this script or in build.sh when a matrix subset is known to be not
10 # warning-free because of the OS, the compiler or whatever other factor that
11 # the scripts can detect both in and out of CI.
12 : "${TCPSLICE_TAINTED:=no}"
13 # Some OSes have native make without parallel jobs support and sometimes have
14 # GNU Make available as "gmake".
15 : "${MAKE_BIN:=make}"
16 # It calls the build.sh script which runs one build with the setup environment
17 # variable CC.
18
19 . ./build_common.sh
20 print_sysinfo
21 # Install directory prefix
22 if [ -z "$PREFIX" ]; then
23 PREFIX=`mktempdir tcpslice_build_matrix`
24 echo "PREFIX set to '$PREFIX'"
25 export PREFIX
26 fi
27 COUNT=0
28 export TCPSLICE_TAINTED
29 export MAKE_BIN
30
31 touch .devel
32 for CC in $MATRIX_CC; do
33 export CC
34 discard_cc_cache
35 if gcc_is_clang_in_disguise; then
36 echo '(skipped)'
37 continue
38 fi
39 for BUILD_LIBPCAP in $MATRIX_BUILD_LIBPCAP; do
40 COUNT=`increment "$COUNT"`
41 echo_magenta "===== SETUP $COUNT: CC=$CC BUILD_LIBPCAP=$BUILD_LIBPCAP =====" >&2
42 if [ "$BUILD_LIBPCAP" = yes ]; then
43 echo_magenta "Build libpcap (CMAKE=no)" >&2
44 (cd ../libpcap && CMAKE=no ./build.sh)
45 else
46 echo_magenta 'Use system libpcap' >&2
47 purge_directory "$PREFIX"
48 if [ -d ../libpcap ]; then
49 (cd ../libpcap; "$MAKE_BIN" distclean || echo '(Ignoring the make error.)')
50 fi
51 fi
52 # Run one build with the setup environment variable: CC
53 run_after_echo ./build.sh
54 echo 'Cleaning...'
55 "$MAKE_BIN" distclean
56 purge_directory "$PREFIX"
57 run_after_echo git status -suall
58 done
59 done
60 run_after_echo rm -rf "$PREFIX"
61 echo_magenta "Tested setup count: $COUNT" >&2
62 # vi: set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab autoindent :