]> The Tcpdump Group git mirrors - tcpdump/blobdiff - build.sh
Makefile.in: don't remove configure and config.h.in in make distclean.
[tcpdump] / build.sh
index 0be231b8db632aa64a54ac2d7ef18c3a585a48d4..a900115f50cc7b186d7f717283a06d329abc85b8 100755 (executable)
--- a/build.sh
+++ b/build.sh
 : "${CRYPTO:=no}"
 : "${SMB:=no}"
 : "${TCPDUMP_TAINTED:=no}"
+: "${TCPDUMP_CMAKE_TAINTED:=no}"
+: "${MAKE_BIN:=make}"
 
 . ./build_common.sh
 # Install directory prefix
 if [ -z "$PREFIX" ]; then
-    # shellcheck disable=SC2006
     PREFIX=`mktempdir tcpdump_build`
     echo "PREFIX set to '$PREFIX'"
 fi
@@ -29,46 +30,65 @@ print_cc_version
 # these cases, please remember to remove respective exemption below to help any
 # later warnings in the same matrix subset trigger an error.
 
-# (There are no exemptions right now.)
+case `cc_id`/`os_id` in
+clang-*/SunOS-5.11)
+    # (Clang 9 on OpenIndiana, Clang 11 on OmniOS)
+    # tcpdump.c:2312:51: warning: this function declaration is not a prototype
+    #   [-Wstrict-prototypes]
+    # tcpdump.c:2737:11: warning: this function declaration is not a prototype
+    #   [-Wstrict-prototypes]
+    [ "`uname -o`" = illumos ] && TCPDUMP_TAINTED=yes
+    ;;
+esac
 
-# shellcheck disable=SC2006
 [ "$TCPDUMP_TAINTED" != yes ] && CFLAGS=`cc_werr_cflags`
 
+# If necessary, set TCPDUMP_CMAKE_TAINTED here to exempt particular cmake from
+# warnings. Use as specific terms as possible (e.g. some specific version and
+# some specific OS).
+
+[ "$TCPDUMP_CMAKE_TAINTED" != yes ] && CMAKE_OPTIONS='-Werror=dev'
+
 if [ "$CMAKE" = no ]; then
     if [ "$BUILD_LIBPCAP" = yes ]; then
         echo "Using PKG_CONFIG_PATH=$PKG_CONFIG_PATH"
+        run_after_echo ./autogen.sh
         run_after_echo ./configure --with-crypto="$CRYPTO" \
             --enable-smb="$SMB" --prefix="$PREFIX"
         LD_LIBRARY_PATH="$PREFIX/lib"
         export LD_LIBRARY_PATH
     else
+        run_after_echo ./autogen.sh
         run_after_echo ./configure --with-crypto="$CRYPTO" \
             --enable-smb="$SMB" --prefix="$PREFIX" --disable-local-libpcap
     fi
 else
-    run_after_echo rm -rf build
+    # See libpcap build.sh for the rationale.
+    run_after_echo rm -rf CMakeFiles/ CMakeCache.txt build/
     run_after_echo mkdir build
     run_after_echo cd build
     if [ "$BUILD_LIBPCAP" = yes ]; then
-        run_after_echo cmake -DWITH_CRYPTO="$CRYPTO" -DENABLE_SMB="$SMB" \
+        run_after_echo cmake "$CMAKE_OPTIONS" \
+            -DWITH_CRYPTO="$CRYPTO" -DENABLE_SMB="$SMB" \
             ${CFLAGS:+-DEXTRA_CFLAGS="$CFLAGS"} \
             -DCMAKE_INSTALL_PREFIX="$PREFIX" -DCMAKE_PREFIX_PATH="$PREFIX" ..
         LD_LIBRARY_PATH="$PREFIX/lib"
         export LD_LIBRARY_PATH
     else
-        run_after_echo cmake -DWITH_CRYPTO="$CRYPTO" -DENABLE_SMB="$SMB" \
+        run_after_echo cmake "$CMAKE_OPTIONS" \
+            -DWITH_CRYPTO="$CRYPTO" -DENABLE_SMB="$SMB" \
              ${CFLAGS:+-DEXTRA_CFLAGS="$CFLAGS"} \
             -DCMAKE_INSTALL_PREFIX="$PREFIX" ..
     fi
 fi
-run_after_echo make -s clean
+run_after_echo "$MAKE_BIN" -s clean
 if [ "$CMAKE" = no ]; then
-    run_after_echo make -s ${CFLAGS:+CFLAGS="$CFLAGS"}
+    run_after_echo "$MAKE_BIN" -s ${CFLAGS:+CFLAGS="$CFLAGS"}
 else
     # The "-s" flag is a no-op and CFLAGS is set using -DEXTRA_CFLAGS above.
-    run_after_echo make
+    run_after_echo "$MAKE_BIN"
 fi
-run_after_echo make install
+run_after_echo "$MAKE_BIN" install
 print_so_deps "$TCPDUMP_BIN"
 run_after_echo "$TCPDUMP_BIN" -h
 # The "-D" flag depends on HAVE_PCAP_FINDALLDEVS and it would not be difficult
@@ -88,10 +108,10 @@ if [ "$CIRRUS_CI" = true ]; then
         "$TCPDUMP_BIN" -L
 fi
 if [ "$BUILD_LIBPCAP" = yes ]; then
-    run_after_echo make check
+    run_after_echo "$MAKE_BIN" check
 fi
 if [ "$CMAKE" = no ]; then
-    run_after_echo make releasetar
+    run_after_echo "$MAKE_BIN" releasetar
 fi
 if [ "$CIRRUS_CI" = true ]; then
     run_after_echo sudo \