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}"
15 # At least one OS (AIX 7) where this software can build does not have at least
16 # one command (mktemp) required for a successful run of "make releasetar".
17 : "${TEST_RELEASETAR:=yes}"
20 # Install directory prefix
21 if [ -z "$PREFIX" ]; then
22 PREFIX
=`mktempdir tcpdump_build`
23 echo "PREFIX set to '$PREFIX'"
26 TCPDUMP_BIN
="$PREFIX/bin/tcpdump"
32 # The norm is to compile without any warnings, but tcpdump builds on some OSes
33 # are not warning-free for one or another reason. If you manage to fix one of
34 # these cases, please remember to remove respective exemption below to help any
35 # later warnings in the same matrix subset trigger an error.
37 case `cc_id`/`os_id` in
39 # (Clang 9 on OpenIndiana, Clang 11 on OmniOS)
40 # tcpdump.c:2312:51: warning: this function declaration is not a prototype
41 # [-Wstrict-prototypes]
42 # tcpdump.c:2737:11: warning: this function declaration is not a prototype
43 # [-Wstrict-prototypes]
44 [ "`uname -o`" = illumos
] && TCPDUMP_TAINTED
=yes
46 suncc-5.1
[45]/SunOS-5.11
)
47 # Various E_STATEMENT_NOT_REACHED and E_DEPRECATED_ATT warnings.
54 [ "$TCPDUMP_TAINTED" != yes ] && CFLAGS
=`cc_werr_cflags`
56 case `cc_id`/`os_id` in
58 # Work around https://www.illumos.org/issues/16369
59 [ "`uname -o`" = illumos
] && grep -Fq OpenIndiana
/etc
/release
&& CFLAGS
="-Wno-fuse-ld-path${CFLAGS:+ $CFLAGS}"
63 # If necessary, set TCPDUMP_CMAKE_TAINTED here to exempt particular cmake from
64 # warnings. Use as specific terms as possible (e.g. some specific version and
67 [ "$TCPDUMP_CMAKE_TAINTED" != yes ] && CMAKE_OPTIONS
='-Werror=dev'
69 if [ "$CMAKE" = no
]; then
70 if [ "$BUILD_LIBPCAP" = yes ]; then
71 echo "Using PKG_CONFIG_PATH=$PKG_CONFIG_PATH"
72 run_after_echo .
/autogen.sh
73 run_after_echo .
/configure
--with-crypto="$CRYPTO" \
74 --enable-smb="$SMB" --prefix="$PREFIX"
75 LD_LIBRARY_PATH
="$PREFIX/lib"
76 export LD_LIBRARY_PATH
78 run_after_echo .
/autogen.sh
79 run_after_echo .
/configure
--with-crypto="$CRYPTO" \
80 --enable-smb="$SMB" --prefix="$PREFIX" --disable-local-libpcap
83 # See libpcap build.sh for the rationale.
84 run_after_echo
rm -rf CMakeFiles
/ CMakeCache.txt build
/
85 run_after_echo mkdir build
86 run_after_echo
cd build
87 if [ "$BUILD_LIBPCAP" = yes ]; then
88 run_after_echo cmake
${CMAKE_OPTIONS:+"$CMAKE_OPTIONS"} \
89 -DWITH_CRYPTO="$CRYPTO" -DENABLE_SMB="$SMB" \
90 ${CFLAGS:+-DEXTRA_CFLAGS="$CFLAGS"} \
91 -DCMAKE_INSTALL_PREFIX="$PREFIX" -DCMAKE_PREFIX_PATH="$PREFIX" ..
92 LD_LIBRARY_PATH
="$PREFIX/lib"
93 export LD_LIBRARY_PATH
95 run_after_echo cmake
${CMAKE_OPTIONS:+"$CMAKE_OPTIONS"} \
96 -DWITH_CRYPTO="$CRYPTO" -DENABLE_SMB="$SMB" \
97 ${CFLAGS:+-DEXTRA_CFLAGS="$CFLAGS"} \
98 -DCMAKE_INSTALL_PREFIX="$PREFIX" ..
101 run_after_echo
"$MAKE_BIN" -s clean
102 if [ "$CMAKE" = no
]; then
103 run_after_echo
"$MAKE_BIN" -s ${CFLAGS:+CFLAGS="$CFLAGS"}
105 # The "-s" flag is a no-op and CFLAGS is set using -DEXTRA_CFLAGS above.
106 run_after_echo
"$MAKE_BIN"
108 run_after_echo
"$MAKE_BIN" install
109 print_so_deps
"$TCPDUMP_BIN"
110 run_after_echo
"$TCPDUMP_BIN" -h
111 # The "-D" flag depends on HAVE_PCAP_FINDALLDEVS and it would not be difficult
112 # to run the command below only if the macro is defined. That said, it seems
113 # more useful to run it anyway: every system that currently runs this script
114 # has pcap_findalldevs(), thus if the macro isn't defined, it means something
115 # went wrong in the build process (as was observed with GCC, CMake and the
116 # system libpcap on Solaris 11).
117 run_after_echo
"$TCPDUMP_BIN" -D
118 if [ "$CIRRUS_CI" = true
]; then
119 # Likewise for the "-J" flag and HAVE_PCAP_SET_TSTAMP_TYPE.
120 run_after_echo sudo \
121 ${LD_LIBRARY_PATH:+LD_LIBRARY_PATH="$LD_LIBRARY_PATH"} \
123 run_after_echo sudo \
124 ${LD_LIBRARY_PATH:+LD_LIBRARY_PATH="$LD_LIBRARY_PATH"} \
127 if [ "$BUILD_LIBPCAP" = yes ]; then
128 run_after_echo
"$MAKE_BIN" check
130 if [ "$CMAKE" = no
]; then
131 [ "$TEST_RELEASETAR" = yes ] && run_after_echo
"$MAKE_BIN" releasetar
133 if [ "$CIRRUS_CI" = true
]; then
134 run_after_echo sudo \
135 ${LD_LIBRARY_PATH:+LD_LIBRARY_PATH="$LD_LIBRARY_PATH"} \
136 "$TCPDUMP_BIN" -#n -c 10
139 if [ "$DELETE_PREFIX" = yes ]; then
140 run_after_echo
rm -rf "$PREFIX"
142 # vi: set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab autoindent :