3 # This script runs one build with setup environment variables: BUILD_LIBPCAP,
4 # REMOTE, CC, CMAKE, CRYPTO and SMB.
6 : "${BUILD_LIBPCAP:=no}"
12 : "${TCPDUMP_TAINTED:=no}"
15 # Install directory prefix
16 if [ -z "$PREFIX" ]; then
17 # shellcheck disable=SC2006
18 PREFIX
=`mktempdir tcpdump_build`
19 echo "PREFIX set to '$PREFIX'"
21 TCPDUMP_BIN
="$PREFIX/bin/tcpdump"
27 # The norm is to compile without any warnings, but tcpdump builds on some OSes
28 # are not warning-free for one or another reason. If you manage to fix one of
29 # these cases, please remember to remove respective exemption below to help any
30 # later warnings in the same matrix subset trigger an error.
32 # (There are no exemptions right now.)
34 # shellcheck disable=SC2006
35 [ "$TCPDUMP_TAINTED" != yes ] && CFLAGS
=`cc_werr_cflags`
37 if [ "$CMAKE" = no
]; then
38 if [ "$BUILD_LIBPCAP" = yes ]; then
39 echo "Using PKG_CONFIG_PATH=$PKG_CONFIG_PATH"
40 run_after_echo .
/configure
--with-crypto="$CRYPTO" \
41 --enable-smb="$SMB" --prefix="$PREFIX"
42 LD_LIBRARY_PATH
="$PREFIX/lib"
43 export LD_LIBRARY_PATH
45 run_after_echo .
/configure
--with-crypto="$CRYPTO" \
46 --enable-smb="$SMB" --prefix="$PREFIX" --disable-local-libpcap
49 run_after_echo
rm -rf build
50 run_after_echo mkdir build
51 run_after_echo
cd build
52 if [ "$BUILD_LIBPCAP" = yes ]; then
53 run_after_echo cmake
-DWITH_CRYPTO="$CRYPTO" -DENABLE_SMB="$SMB" \
54 ${CFLAGS:+-DEXTRA_CFLAGS="$CFLAGS"} \
55 -DCMAKE_INSTALL_PREFIX="$PREFIX" -DCMAKE_PREFIX_PATH="$PREFIX" ..
56 LD_LIBRARY_PATH
="$PREFIX/lib"
57 export LD_LIBRARY_PATH
59 run_after_echo cmake
-DWITH_CRYPTO="$CRYPTO" -DENABLE_SMB="$SMB" \
60 ${CFLAGS:+-DEXTRA_CFLAGS="$CFLAGS"} \
61 -DCMAKE_INSTALL_PREFIX="$PREFIX" ..
64 run_after_echo
make -s clean
65 if [ "$CMAKE" = no
]; then
66 run_after_echo
make -s ${CFLAGS:+CFLAGS="$CFLAGS"}
68 # The "-s" flag is a no-op and CFLAGS is set using -DEXTRA_CFLAGS above.
71 run_after_echo
make install
72 print_so_deps
"$TCPDUMP_BIN"
73 run_after_echo
"$TCPDUMP_BIN" -h
74 # The "-D" flag depends on HAVE_PCAP_FINDALLDEVS and it would not be difficult
75 # to run the command below only if the macro is defined. That said, it seems
76 # more useful to run it anyway: every system that currently runs this script
77 # has pcap_findalldevs(), thus if the macro isn't defined, it means something
78 # went wrong in the build process (as was observed with GCC, CMake and the
79 # system libpcap on Solaris 11).
80 run_after_echo
"$TCPDUMP_BIN" -D
81 if [ "$CIRRUS_CI" = true
]; then
82 # Likewise for the "-J" flag and HAVE_PCAP_SET_TSTAMP_TYPE.
84 ${LD_LIBRARY_PATH:+LD_LIBRARY_PATH="$LD_LIBRARY_PATH"} \
87 ${LD_LIBRARY_PATH:+LD_LIBRARY_PATH="$LD_LIBRARY_PATH"} \
90 if [ "$BUILD_LIBPCAP" = yes ]; then
91 run_after_echo
make check
93 if [ "$CMAKE" = no
]; then
94 run_after_echo
make releasetar
96 if [ "$CIRRUS_CI" = true
]; then
98 ${LD_LIBRARY_PATH:+LD_LIBRARY_PATH="$LD_LIBRARY_PATH"} \
99 "$TCPDUMP_BIN" -#n -c 10
102 if [ "$DELETE_PREFIX" = yes ]; then
103 run_after_echo
rm -rf "$PREFIX"
105 # vi: set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab autoindent :