]> The Tcpdump Group git mirrors - libpcap/blob - build_matrix.sh
Update config.{guess,sub}, timestamps 2023-01-01,2023-01-21
[libpcap] / build_matrix.sh
1 #!/bin/sh -e
2
3 # This script executes the matrix loops, exclude tests and cleaning.
4 # The matrix can be configured with the following environment variables: MATRIX_CC,
5 # MATRIX_CMAKE and MATRIX_REMOTE.
6 : "${MATRIX_CC:=gcc clang}"
7 : "${MATRIX_CMAKE:=no yes}"
8 : "${MATRIX_REMOTE:=no yes}"
9 # Set this variable to "yes" before calling this script to disregard all
10 # warnings in a particular environment (CI or a local working copy). Set it
11 # to "yes" in this script or in build.sh when a matrix subset is known to be
12 # not warning-free because of the OS, the compiler or whatever other factor
13 # that the scripts can detect both in and out of CI.
14 : "${LIBPCAP_TAINTED:=no}"
15 # Some OSes have native make without parallel jobs support and sometimes have
16 # GNU Make available as "gmake".
17 : "${MAKE_BIN:=make}"
18 # It calls the build.sh script which runs one build with setup environment
19 # variables: CC, CMAKE and REMOTE.
20
21 . ./build_common.sh
22 print_sysinfo
23 # Install directory prefix
24 if [ -z "$PREFIX" ]; then
25 PREFIX=`mktempdir libpcap_build_matrix`
26 echo "PREFIX set to '$PREFIX'"
27 export PREFIX
28 fi
29 COUNT=0
30 export LIBPCAP_TAINTED
31 if command -v valgrind >/dev/null 2>&1; then
32 VALGRIND_CMD="valgrind --leak-check=full --error-exitcode=1"
33 export VALGRIND_CMD
34 fi
35
36 touch .devel configure
37 for CC in $MATRIX_CC; do
38 export CC
39 discard_cc_cache
40 if gcc_is_clang_in_disguise; then
41 echo '(skipped)'
42 continue
43 fi
44 for CMAKE in $MATRIX_CMAKE; do
45 export CMAKE
46 for REMOTE in $MATRIX_REMOTE; do
47 export REMOTE
48 COUNT=`increment $COUNT`
49 echo_magenta "===== SETUP $COUNT: CC=$CC CMAKE=$CMAKE REMOTE=$REMOTE =====" >&2
50 # Run one build with setup environment variables: CC, CMAKE and REMOTE
51 run_after_echo ./build.sh
52 echo 'Cleaning...'
53 if [ "$CMAKE" = yes ]; then rm -rf build; else "$MAKE_BIN" distclean; fi
54 purge_directory "$PREFIX"
55 run_after_echo git status -suall
56 # Cancel changes in configure
57 run_after_echo git checkout configure
58 done
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 :