aboutsummaryrefslogtreecommitdiff
path: root/build_matrix.sh
blob: 8ac70225bfa80c92c9833cd25c88d9858f608357 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh -e

# This script executes the matrix loops, exclude tests and cleaning.
# The matrix can be configured with the following environment variables: MATRIX_CC,
# MATRIX_CMAKE and MATRIX_REMOTE.
: "${MATRIX_CC:=gcc clang}"
: "${MATRIX_CMAKE:=no yes}"
: "${MATRIX_REMOTE:=no yes}"
# It calls the build.sh script which runs one build with setup environment
# variables: CC, CMAKE and REMOTE.

. ./build_common.sh
print_sysinfo
# Install directory prefix
if [ -z "$PREFIX" ]; then
    # shellcheck disable=SC2006
    PREFIX=`mktempdir libpcap_build_matrix`
    echo "PREFIX set to '$PREFIX'"
    export PREFIX
fi
COUNT=0

touch .devel configure
for CC in $MATRIX_CC; do
    export CC
    discard_cc_cache
    if gcc_is_clang_in_disguise; then
        echo '(skipped)'
        continue
    fi
    for CMAKE in $MATRIX_CMAKE; do
        export CMAKE
        for REMOTE in $MATRIX_REMOTE; do
            export REMOTE
            # shellcheck disable=SC2006
            COUNT=`increment $COUNT`
            echo_magenta "===== SETUP $COUNT: CC=$CC CMAKE=$CMAKE REMOTE=$REMOTE =====" >&2
            # Run one build with setup environment variables: CC, CMAKE and REMOTE
            run_after_echo ./build.sh
            echo 'Cleaning...'
            if [ "$CMAKE" = yes ]; then rm -rf build; else make distclean; fi
            purge_directory "$PREFIX"
            run_after_echo git status -suall
            # Cancel changes in configure
            run_after_echo git checkout configure
        done
    done
done
run_after_echo rm -rf "$PREFIX"
echo_magenta "Tested setup count: $COUNT" >&2
# vi: set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab autoindent :