]> The Tcpdump Group git mirrors - tcpslice/blob - build_matrix.sh
build_matrix.sh: Run "git show --oneline -s"
[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 run_after_echo git show --oneline -s
32 touch .devel
33 for CC in $MATRIX_CC; do
34 export CC
35 discard_cc_cache
36 if gcc_is_clang_in_disguise; then
37 echo '(skipped)'
38 continue
39 fi
40 for BUILD_LIBPCAP in $MATRIX_BUILD_LIBPCAP; do
41 COUNT=`increment "$COUNT"`
42 echo_magenta "===== SETUP $COUNT: CC=$CC BUILD_LIBPCAP=$BUILD_LIBPCAP =====" >&2
43 if [ "$BUILD_LIBPCAP" = yes ]; then
44 echo_magenta "Build libpcap (CMAKE=no)" >&2
45 (cd ../libpcap && CMAKE=no ./build.sh)
46 else
47 echo_magenta 'Use system libpcap' >&2
48 purge_directory "$PREFIX"
49 if [ -d ../libpcap ]; then
50 (cd ../libpcap; "$MAKE_BIN" distclean || echo '(Ignoring the make error.)')
51 fi
52 fi
53 # Run one build with the setup environment variable: CC
54 run_after_echo ./build.sh
55 echo 'Cleaning...'
56 "$MAKE_BIN" distclean
57 purge_directory "$PREFIX"
58 run_after_echo git status -suall
59 done
60 done
61 run_after_echo rm -rf "$PREFIX"
62 echo_magenta "Tested setup count: $COUNT" >&2
63 # vi: set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab autoindent :