3 # This script runs one build with setup environment variables: CC, CMAKE, IPV6
9 : "${LIBPCAP_TAINTED:=no}"
10 : "${LIBPCAP_CMAKE_TAINTED:=no}"
12 # At least one OS (AIX 7) where this software can build does not have at least
13 # one command (mktemp) required for a successful run of "make releasetar".
14 : "${TEST_RELEASETAR:=yes}"
17 # Install directory prefix
18 if [ -z "$PREFIX" ]; then
19 PREFIX
=`mktempdir libpcap_build`
20 echo "PREFIX set to '$PREFIX'"
26 # The norm is to compile without any warnings, but libpcap builds on some OSes
27 # are not warning-free for one or another reason. If you manage to fix one of
28 # these cases, please remember to remove respective exemption below to help any
29 # later warnings in the same matrix subset trigger an error.
30 # shellcheck disable=SC2221,SC2222
31 case `cc_id`/`os_id` in
33 # At least one warning is expected because TCC does not implement
34 # thread-local storage.
38 # pcap-netfilter-linux.c:427:10: error: will never be executed
39 # [-Werror,-Wunreachable-code]
40 # pcap.c:3812:4: error: will never be executed
41 # [-Werror,-Wunreachable-code]
42 # scanner.l:662:3: warning: will never be executed [-Wunreachable-code]
43 # gencode.c:7061:3: warning: will never be executed [-Wunreachable-code]
49 [ "$LIBPCAP_TAINTED" != yes ] && CFLAGS
=`cc_werr_cflags`
51 case `cc_id`/`os_id` in
53 # Work around https://www.illumos.org/issues/16369
54 [ "`uname -o`" = illumos
] && grep -Fq OpenIndiana
/etc
/release
&& CFLAGS
="-Wno-fuse-ld-path${CFLAGS:+ $CFLAGS}"
58 # If necessary, set LIBPCAP_CMAKE_TAINTED here to exempt particular cmake from
59 # warnings. Use as specific terms as possible (e.g. some specific version and
62 [ "$LIBPCAP_CMAKE_TAINTED" != yes ] && CMAKE_OPTIONS
='-Werror=dev'
64 if [ "$CMAKE" = no
]; then
65 run_after_echo .
/autogen.sh
66 run_after_echo .
/configure
--prefix="$PREFIX" --enable-ipv6="$IPV6" --enable-remote="$REMOTE"
68 # Remove the leftovers from any earlier in-source builds, so this
69 # out-of-source build does not break because of that.
70 # https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#what-is-an-out-of-source-build
71 # (The contents of build/ remaining after an earlier unsuccessful attempt
72 # can fail subsequent build attempts too, sometimes in non-obvious ways,
73 # so remove that directory as well.)
74 run_after_echo
rm -rf CMakeFiles
/ CMakeCache.txt build
/
75 run_after_echo mkdir build
76 run_after_echo
cd build
77 run_after_echo cmake
--version
78 run_after_echo cmake
${CFLAGS:+-DEXTRA_CFLAGS="$CFLAGS"} \
79 ${CMAKE_OPTIONS:+"$CMAKE_OPTIONS"} \
80 -DCMAKE_INSTALL_PREFIX="$PREFIX" -DINET6="$IPV6" -DENABLE_REMOTE="$REMOTE" ..
82 run_after_echo
"$MAKE_BIN" -s clean
83 if [ "$CMAKE" = no
]; then
84 run_after_echo
"$MAKE_BIN" -s ${CFLAGS:+CFLAGS="$CFLAGS"}
85 run_after_echo
"$MAKE_BIN" -s testprogs
${CFLAGS:+CFLAGS="$CFLAGS"}
87 # The "-s" flag is a no-op and CFLAGS is set using -DEXTRA_CFLAGS above.
88 run_after_echo
"$MAKE_BIN"
89 run_after_echo
"$MAKE_BIN" testprogs
91 run_after_echo
"$MAKE_BIN" install
93 run_after_echo
"$PREFIX/bin/pcap-config" --help
94 run_after_echo
"$PREFIX/bin/pcap-config" --version
95 run_after_echo
"$PREFIX/bin/pcap-config" --cflags
96 run_after_echo
"$PREFIX/bin/pcap-config" --libs
97 run_after_echo
"$PREFIX/bin/pcap-config" --additional-libs
98 run_after_echo
"$PREFIX/bin/pcap-config" --libs --static
99 run_after_echo
"$PREFIX/bin/pcap-config" --additional-libs --static
100 run_after_echo
"$PREFIX/bin/pcap-config" --libs --static-pcap-only
101 run_after_echo
"$PREFIX/bin/pcap-config" --additional-libs --static-pcap-only
103 [ "$REMOTE" = yes ] && run_after_echo
"$PREFIX/sbin/rpcapd" -h
105 # VALGRIND_CMD is meant either to collapse or to expand.
106 # shellcheck disable=SC2086
107 if [ "$CMAKE" = no
]; then
108 FILTERTEST_BIN
="$VALGRIND_CMD testprogs/filtertest"
109 export FILTERTEST_BIN
110 run_after_echo
"$MAKE_BIN" -s check
111 run_after_echo
$VALGRIND_CMD testprogs
/findalldevstest
112 [ "$TEST_RELEASETAR" = yes ] && run_after_echo
"$MAKE_BIN" releasetar
114 FILTERTEST_BIN
="$VALGRIND_CMD run/filtertest"
115 export FILTERTEST_BIN
116 run_after_echo
"$MAKE_BIN" -s check
117 run_after_echo
$VALGRIND_CMD run
/findalldevstest
120 if [ "$DELETE_PREFIX" = yes ]; then
121 run_after_echo
rm -rf "$PREFIX"
123 # vi: set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab autoindent :