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}"
16 # Install directory prefix
17 if [ -z "$PREFIX" ]; then
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 case `cc_id`/`os_id` in
35 # tcpdump.c:2312:51: warning: this function declaration is not a prototype
36 # [-Wstrict-prototypes]
37 # tcpdump.c:2737:11: warning: this function declaration is not a prototype
38 # [-Wstrict-prototypes]
39 [ "`uname -o`" = illumos
] && TCPDUMP_TAINTED
=yes
43 [ "$TCPDUMP_TAINTED" != yes ] && CFLAGS
=`cc_werr_cflags`
45 if [ "$CMAKE" = no
]; then
46 if [ "$BUILD_LIBPCAP" = yes ]; then
47 echo "Using PKG_CONFIG_PATH=$PKG_CONFIG_PATH"
48 run_after_echo .
/configure
--with-crypto="$CRYPTO" \
49 --enable-smb="$SMB" --prefix="$PREFIX"
50 LD_LIBRARY_PATH
="$PREFIX/lib"
51 export LD_LIBRARY_PATH
53 run_after_echo .
/configure
--with-crypto="$CRYPTO" \
54 --enable-smb="$SMB" --prefix="$PREFIX" --disable-local-libpcap
57 run_after_echo
rm -rf build
58 run_after_echo mkdir build
59 run_after_echo
cd build
60 if [ "$BUILD_LIBPCAP" = yes ]; then
61 run_after_echo cmake
-DWITH_CRYPTO="$CRYPTO" -DENABLE_SMB="$SMB" \
62 ${CFLAGS:+-DEXTRA_CFLAGS="$CFLAGS"} \
63 -DCMAKE_INSTALL_PREFIX="$PREFIX" -DCMAKE_PREFIX_PATH="$PREFIX" ..
64 LD_LIBRARY_PATH
="$PREFIX/lib"
65 export LD_LIBRARY_PATH
67 run_after_echo cmake
-DWITH_CRYPTO="$CRYPTO" -DENABLE_SMB="$SMB" \
68 ${CFLAGS:+-DEXTRA_CFLAGS="$CFLAGS"} \
69 -DCMAKE_INSTALL_PREFIX="$PREFIX" ..
72 run_after_echo
"$MAKE_BIN" -s clean
73 if [ "$CMAKE" = no
]; then
74 run_after_echo
"$MAKE_BIN" -s ${CFLAGS:+CFLAGS="$CFLAGS"}
76 # The "-s" flag is a no-op and CFLAGS is set using -DEXTRA_CFLAGS above.
77 run_after_echo
"$MAKE_BIN"
79 run_after_echo
"$MAKE_BIN" install
80 print_so_deps
"$TCPDUMP_BIN"
81 run_after_echo
"$TCPDUMP_BIN" -h
82 # The "-D" flag depends on HAVE_PCAP_FINDALLDEVS and it would not be difficult
83 # to run the command below only if the macro is defined. That said, it seems
84 # more useful to run it anyway: every system that currently runs this script
85 # has pcap_findalldevs(), thus if the macro isn't defined, it means something
86 # went wrong in the build process (as was observed with GCC, CMake and the
87 # system libpcap on Solaris 11).
88 run_after_echo
"$TCPDUMP_BIN" -D
89 if [ "$CIRRUS_CI" = true
]; then
90 # Likewise for the "-J" flag and HAVE_PCAP_SET_TSTAMP_TYPE.
92 ${LD_LIBRARY_PATH:+LD_LIBRARY_PATH="$LD_LIBRARY_PATH"} \
95 ${LD_LIBRARY_PATH:+LD_LIBRARY_PATH="$LD_LIBRARY_PATH"} \
98 if [ "$BUILD_LIBPCAP" = yes ]; then
99 run_after_echo
"$MAKE_BIN" check
101 if [ "$CMAKE" = no
]; then
102 run_after_echo
"$MAKE_BIN" releasetar
104 if [ "$CIRRUS_CI" = true
]; then
105 run_after_echo sudo \
106 ${LD_LIBRARY_PATH:+LD_LIBRARY_PATH="$LD_LIBRARY_PATH"} \
107 "$TCPDUMP_BIN" -#n -c 10
110 if [ "$DELETE_PREFIX" = yes ]; then
111 run_after_echo
rm -rf "$PREFIX"
113 # vi: set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab autoindent :