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}"
13 : "${TCPDUMP_CMAKE_TAINTED:=no}"
17 # Install directory prefix
18 if [ -z "$PREFIX" ]; then
19 PREFIX
=`mktempdir tcpdump_build`
20 echo "PREFIX set to '$PREFIX'"
22 TCPDUMP_BIN
="$PREFIX/bin/tcpdump"
28 # The norm is to compile without any warnings, but tcpdump builds on some OSes
29 # are not warning-free for one or another reason. If you manage to fix one of
30 # these cases, please remember to remove respective exemption below to help any
31 # later warnings in the same matrix subset trigger an error.
33 case `cc_id`/`os_id` in
35 # (Clang 9 on OpenIndiana, Clang 11 on OmniOS)
36 # tcpdump.c:2312:51: warning: this function declaration is not a prototype
37 # [-Wstrict-prototypes]
38 # tcpdump.c:2737:11: warning: this function declaration is not a prototype
39 # [-Wstrict-prototypes]
40 [ "`uname -o`" = illumos
] && TCPDUMP_TAINTED
=yes
44 [ "$TCPDUMP_TAINTED" != yes ] && CFLAGS
=`cc_werr_cflags`
46 # If necessary, set TCPDUMP_CMAKE_TAINTED here to exempt particular cmake from
47 # warnings. Use as specific terms as possible (e.g. some specific version and
50 [ "$TCPDUMP_CMAKE_TAINTED" != yes ] && CMAKE_OPTIONS
='-Werror=dev'
52 if [ "$CMAKE" = no
]; then
53 if [ "$BUILD_LIBPCAP" = yes ]; then
54 echo "Using PKG_CONFIG_PATH=$PKG_CONFIG_PATH"
55 run_after_echo .
/autogen.sh
56 run_after_echo .
/configure
--with-crypto="$CRYPTO" \
57 --enable-smb="$SMB" --prefix="$PREFIX"
58 LD_LIBRARY_PATH
="$PREFIX/lib"
59 export LD_LIBRARY_PATH
61 run_after_echo .
/autogen.sh
62 run_after_echo .
/configure
--with-crypto="$CRYPTO" \
63 --enable-smb="$SMB" --prefix="$PREFIX" --disable-local-libpcap
66 # See libpcap build.sh for the rationale.
67 run_after_echo
rm -rf CMakeFiles
/ CMakeCache.txt build
/
68 run_after_echo mkdir build
69 run_after_echo
cd build
70 if [ "$BUILD_LIBPCAP" = yes ]; then
71 run_after_echo cmake
"$CMAKE_OPTIONS" \
72 -DWITH_CRYPTO="$CRYPTO" -DENABLE_SMB="$SMB" \
73 ${CFLAGS:+-DEXTRA_CFLAGS="$CFLAGS"} \
74 -DCMAKE_INSTALL_PREFIX="$PREFIX" -DCMAKE_PREFIX_PATH="$PREFIX" ..
75 LD_LIBRARY_PATH
="$PREFIX/lib"
76 export LD_LIBRARY_PATH
78 run_after_echo cmake
"$CMAKE_OPTIONS" \
79 -DWITH_CRYPTO="$CRYPTO" -DENABLE_SMB="$SMB" \
80 ${CFLAGS:+-DEXTRA_CFLAGS="$CFLAGS"} \
81 -DCMAKE_INSTALL_PREFIX="$PREFIX" ..
84 run_after_echo
"$MAKE_BIN" -s clean
85 if [ "$CMAKE" = no
]; then
86 run_after_echo
"$MAKE_BIN" -s ${CFLAGS:+CFLAGS="$CFLAGS"}
88 # The "-s" flag is a no-op and CFLAGS is set using -DEXTRA_CFLAGS above.
89 run_after_echo
"$MAKE_BIN"
91 run_after_echo
"$MAKE_BIN" install
92 print_so_deps
"$TCPDUMP_BIN"
93 run_after_echo
"$TCPDUMP_BIN" -h
94 # The "-D" flag depends on HAVE_PCAP_FINDALLDEVS and it would not be difficult
95 # to run the command below only if the macro is defined. That said, it seems
96 # more useful to run it anyway: every system that currently runs this script
97 # has pcap_findalldevs(), thus if the macro isn't defined, it means something
98 # went wrong in the build process (as was observed with GCC, CMake and the
99 # system libpcap on Solaris 11).
100 run_after_echo
"$TCPDUMP_BIN" -D
101 if [ "$CIRRUS_CI" = true
]; then
102 # Likewise for the "-J" flag and HAVE_PCAP_SET_TSTAMP_TYPE.
103 run_after_echo sudo \
104 ${LD_LIBRARY_PATH:+LD_LIBRARY_PATH="$LD_LIBRARY_PATH"} \
106 run_after_echo sudo \
107 ${LD_LIBRARY_PATH:+LD_LIBRARY_PATH="$LD_LIBRARY_PATH"} \
110 if [ "$BUILD_LIBPCAP" = yes ]; then
111 run_after_echo
"$MAKE_BIN" check
113 if [ "$CMAKE" = no
]; then
114 run_after_echo
"$MAKE_BIN" releasetar
116 if [ "$CIRRUS_CI" = true
]; then
117 run_after_echo sudo \
118 ${LD_LIBRARY_PATH:+LD_LIBRARY_PATH="$LD_LIBRARY_PATH"} \
119 "$TCPDUMP_BIN" -#n -c 10
122 if [ "$DELETE_PREFIX" = yes ]; then
123 run_after_echo
rm -rf "$PREFIX"
125 # vi: set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab autoindent :