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).
9 # BUILD_LIBPCAP: no or yes
10 BUILD_LIBPCAP
=${BUILD_LIBPCAP:-no}
15 # GCC and Clang recognize --version and print to stdout. Sun compilers
16 # recognize -V and print to stderr.
17 "$CC" --version 2>/dev
/null ||
"$CC" -V ||
:
24 # Install directory prefix
25 if [ -z "$PREFIX" ]; then
26 PREFIX
=$
(mktemp
-d -t tcpdump_build_XXXXXXXX
)
27 echo "PREFIX set to '$PREFIX'"
30 export TCPDUMP_BIN
="$PREFIX/bin/tcpdump"
35 if [ "$TRAVIS" != true
]; then return; fi
36 echo -ne "travis_fold:$action:$LABEL.script.$name\\r"
40 # Run a command after displaying it
47 # LABEL is needed to build the travis fold labels
48 LABEL
="$BUILD_LIBPCAP.$REMOTE.$CC.$CMAKE.$CRYPTO.$SMB"
49 if [ "$CMAKE" = no
]; then
50 echo '$ ./configure [...]'
51 travis_fold start configure
52 if [ "$BUILD_LIBPCAP" = yes ]; then
53 echo "Using PKG_CONFIG_PATH=$PKG_CONFIG_PATH"
54 .
/configure
--with-crypto="$CRYPTO" --enable-smb="$SMB" --prefix="$PREFIX"
55 export LD_LIBRARY_PATH
="$PREFIX/lib"
57 .
/configure
--disable-local-libpcap --with-crypto="$CRYPTO" --enable-smb="$SMB" --prefix="$PREFIX"
59 travis_fold end configure
65 travis_fold start cmake
66 if [ "$BUILD_LIBPCAP" = yes ]; then
67 cmake
-DWITH_CRYPTO="$CRYPTO" -DENABLE_SMB="$SMB" -DCMAKE_PREFIX_PATH="$PREFIX" -DCMAKE_INSTALL_PREFIX="$PREFIX" ..
68 export LD_LIBRARY_PATH
="$PREFIX/lib"
70 cmake
-DWITH_CRYPTO="$CRYPTO" -DENABLE_SMB="$SMB" -DCMAKE_INSTALL_PREFIX="$PREFIX" ..
74 run_after_echo
"make -s clean"
75 run_after_echo
"make -s CFLAGS=-Werror"
77 travis_fold start make_install
79 travis_fold end make_install
80 run_after_echo
"$TCPDUMP_BIN --version"
81 run_after_echo
"$TCPDUMP_BIN -h"
82 run_after_echo
"$TCPDUMP_BIN -D"
84 if [ "$system" = Linux
]; then
85 run_after_echo
"ldd $TCPDUMP_BIN"
87 if [ "$TRAVIS" = true
]; then
88 if [ -n "$LD_LIBRARY_PATH" ]; then
89 run_after_echo
"sudo LD_LIBRARY_PATH=$LD_LIBRARY_PATH $TCPDUMP_BIN -J"
90 run_after_echo
"sudo LD_LIBRARY_PATH=$LD_LIBRARY_PATH $TCPDUMP_BIN -L"
92 run_after_echo
"sudo $TCPDUMP_BIN -J"
93 run_after_echo
"sudo $TCPDUMP_BIN -L"
96 if [ "$BUILD_LIBPCAP" = yes ]; then
97 run_after_echo
"make check"
99 if [ "$CMAKE" = no
]; then
101 if [ "$system" = Darwin
] ||
[ "$system" = Linux
]; then
102 run_after_echo
"make releasetar"
105 if [ "$TRAVIS" = true
]; then
106 if [ "$TRAVIS_OS_NAME" = linux
] && [ "$TRAVIS_CPU_ARCH" != ppc64le
] && [ "$TRAVIS_CPU_ARCH" != s390x
] && [ "$TRAVIS_CPU_ARCH" != arm64
]; then
107 if [ -n "$LD_LIBRARY_PATH" ]; then
108 run_after_echo
"sudo LD_LIBRARY_PATH=$LD_LIBRARY_PATH $TCPDUMP_BIN -#n -c 10"
110 run_after_echo
"sudo $TCPDUMP_BIN -#n -c 10"
114 # The DEBUG_BUILD variable is not set by default to avoid Travis error message:
115 # "The job exceeded the maximum log length, and has been terminated."
116 # Setting it needs to reduce the matrix cases.
117 if [ "$TRAVIS" = true
] && [ -n "$DEBUG_BUILD" ] ; then
118 echo '$ cat Makefile [...]'
119 travis_fold start cat_makefile
120 sed '/DO NOT DELETE THIS LINE -- mkdep uses it/q' < Makefile
121 travis_fold end cat_makefile
122 echo '$ cat config.h'
123 travis_fold start cat_config_h
125 travis_fold end cat_config_h
126 if [ "$CMAKE" = no
]; then
127 echo '$ cat config.log'
128 travis_fold start cat_config_log
130 travis_fold end cat_config_log
133 if [ "$DELETE_PREFIX" = yes ]; then
136 # vi: set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab autoindent :