3 # This script runs one build with setup environment variables: BUILD_LIBPCAP,
4 # REMOTE, CC, CMAKE, CRYPTO and SMB
5 # (default: BUILD_LIBPCAP=no, REMOTE=no, CC=gcc, CMAKE=no, CRYPTO=no, SMB=no).
7 # BUILD_LIBPCAP: no or yes
8 BUILD_LIBPCAP
=${BUILD_LIBPCAP:-no}
13 # GCC and Clang recognize --version and print to stdout. Sun compilers
14 # recognize -V and print to stderr.
15 "$CC" --version 2>/dev
/null ||
"$CC" -V ||
:
22 # Install directory prefix
23 if [ -z "$PREFIX" ]; then
24 PREFIX
=$
(mktemp
-d -t tcpdump_build_XXXXXXXX
)
25 echo "PREFIX set to '$PREFIX'"
28 export TCPDUMP_BIN
="$PREFIX/bin/tcpdump"
33 if [ "$TRAVIS" != true
]; then return; fi
34 printf 'travis_fold:%s:%s.script.%s\r' "$tf_action" "$LABEL" "$tf_name"
38 # Run a command after displaying it
42 # shellcheck disable=SC2068
46 # LABEL is needed to build the travis fold labels
47 LABEL
="$BUILD_LIBPCAP.$REMOTE.$CC.$CMAKE.$CRYPTO.$SMB"
48 if [ "$CMAKE" = no
]; then
49 echo '$ ./configure [...]'
50 travis_fold start configure
51 if [ "$BUILD_LIBPCAP" = yes ]; then
52 echo "Using PKG_CONFIG_PATH=$PKG_CONFIG_PATH"
53 .
/configure
--with-crypto="$CRYPTO" --enable-smb="$SMB" --prefix="$PREFIX"
54 export LD_LIBRARY_PATH
="$PREFIX/lib"
56 .
/configure
--disable-local-libpcap --with-crypto="$CRYPTO" --enable-smb="$SMB" --prefix="$PREFIX"
58 travis_fold end configure
64 travis_fold start cmake
65 if [ "$BUILD_LIBPCAP" = yes ]; then
66 cmake
-DWITH_CRYPTO="$CRYPTO" -DENABLE_SMB="$SMB" -DCMAKE_PREFIX_PATH="$PREFIX" -DCMAKE_INSTALL_PREFIX="$PREFIX" ..
67 export LD_LIBRARY_PATH
="$PREFIX/lib"
69 cmake
-DWITH_CRYPTO="$CRYPTO" -DENABLE_SMB="$SMB" -DCMAKE_INSTALL_PREFIX="$PREFIX" ..
73 run_after_echo
"make -s clean"
74 run_after_echo
"make -s CFLAGS=-Werror"
76 travis_fold start make_install
78 travis_fold end make_install
79 run_after_echo
"$TCPDUMP_BIN --version"
80 run_after_echo
"$TCPDUMP_BIN -h"
81 run_after_echo
"$TCPDUMP_BIN -D"
83 if [ "$system" = Linux
]; then
84 run_after_echo
"ldd $TCPDUMP_BIN"
86 if [ "$TRAVIS" = true
]; then
87 if [ -n "$LD_LIBRARY_PATH" ]; then
88 run_after_echo
"sudo LD_LIBRARY_PATH=$LD_LIBRARY_PATH $TCPDUMP_BIN -J"
89 run_after_echo
"sudo LD_LIBRARY_PATH=$LD_LIBRARY_PATH $TCPDUMP_BIN -L"
91 run_after_echo
"sudo $TCPDUMP_BIN -J"
92 run_after_echo
"sudo $TCPDUMP_BIN -L"
95 if [ "$BUILD_LIBPCAP" = yes ]; then
96 run_after_echo
"make check"
98 if [ "$CMAKE" = no
]; then
100 if [ "$system" = Darwin
] ||
[ "$system" = Linux
]; then
101 run_after_echo
"make releasetar"
104 if [ "$TRAVIS" = true
]; then
105 if [ "$TRAVIS_OS_NAME" = linux
] && [ "$TRAVIS_CPU_ARCH" != ppc64le
] && [ "$TRAVIS_CPU_ARCH" != s390x
] && [ "$TRAVIS_CPU_ARCH" != arm64
]; then
106 if [ -n "$LD_LIBRARY_PATH" ]; then
107 run_after_echo
"sudo LD_LIBRARY_PATH=$LD_LIBRARY_PATH $TCPDUMP_BIN -#n -c 10"
109 run_after_echo
"sudo $TCPDUMP_BIN -#n -c 10"
113 # The DEBUG_BUILD variable is not set by default to avoid Travis error message:
114 # "The job exceeded the maximum log length, and has been terminated."
115 # Setting it needs to reduce the matrix cases.
116 if [ "$TRAVIS" = true
] && [ -n "$DEBUG_BUILD" ] ; then
117 echo '$ cat Makefile [...]'
118 travis_fold start cat_makefile
119 sed '/DO NOT DELETE THIS LINE -- mkdep uses it/q' < Makefile
120 travis_fold end cat_makefile
121 echo '$ cat config.h'
122 travis_fold start cat_config_h
124 travis_fold end cat_config_h
125 if [ "$CMAKE" = no
]; then
126 echo '$ cat config.log'
127 travis_fold start cat_config_log
129 travis_fold end cat_config_log
132 if [ "$DELETE_PREFIX" = yes ]; then
135 # vi: set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab autoindent :