3 # This script runs one build with setup environment variables: CC, CMAKE, IPV6
9 : "${LIBPCAP_TAINTED:=no}"
10 : "${LIBPCAP_CMAKE_TAINTED:=no}"
12 # At least one OS (AIX 7) where this software can build does not have at least
13 # one command (mktemp) required for a successful run of "make releasetar".
14 : "${TEST_RELEASETAR:=yes}"
17 # Install directory prefix
18 if [ -z "$PREFIX" ]; then
19 PREFIX
=`mktempdir libpcap_build`
20 echo "PREFIX set to '$PREFIX'"
26 # The norm is to compile without any warnings, but libpcap builds on some OSes
27 # are not warning-free for one or another reason. If you manage to fix one of
28 # these cases, please remember to remove respective exemption below to help any
29 # later warnings in the same matrix subset trigger an error.
30 # shellcheck disable=SC2221,SC2222
31 case `cc_id`/`os_id` in
33 # At least one warning is expected because TCC does not implement
34 # thread-local storage.
40 [ "$LIBPCAP_TAINTED" != yes ] && CFLAGS
=`cc_werr_cflags`
42 case `cc_id`/`os_id` in
44 # Work around https://www.illumos.org/issues/16369
45 [ "`uname -o`" = illumos
] && grep -Fq OpenIndiana
/etc
/release
&& CFLAGS
="-Wno-fuse-ld-path${CFLAGS:+ $CFLAGS}"
49 # If necessary, set LIBPCAP_CMAKE_TAINTED here to exempt particular cmake from
50 # warnings. Use as specific terms as possible (e.g. some specific version and
53 [ "$LIBPCAP_CMAKE_TAINTED" != yes ] && CMAKE_OPTIONS
='-Werror=dev'
55 if [ "$CMAKE" = no
]; then
56 run_after_echo .
/autogen.sh
57 run_after_echo .
/configure
--prefix="$PREFIX" --enable-ipv6="$IPV6" --enable-remote="$REMOTE"
59 # Remove the leftovers from any earlier in-source builds, so this
60 # out-of-source build does not break because of that.
61 # https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#what-is-an-out-of-source-build
62 # (The contents of build/ remaining after an earlier unsuccessful attempt
63 # can fail subsequent build attempts too, sometimes in non-obvious ways,
64 # so remove that directory as well.)
65 run_after_echo
rm -rf CMakeFiles
/ CMakeCache.txt build
/
66 run_after_echo mkdir build
67 run_after_echo
cd build
68 run_after_echo cmake
--version
69 run_after_echo cmake
${CFLAGS:+-DEXTRA_CFLAGS="$CFLAGS"} \
70 ${CMAKE_OPTIONS:+"$CMAKE_OPTIONS"} \
71 -DCMAKE_INSTALL_PREFIX="$PREFIX" -DINET6="$IPV6" -DENABLE_REMOTE="$REMOTE" ..
73 run_after_echo
"$MAKE_BIN" -s clean
74 if [ "$CMAKE" = no
]; then
75 run_after_echo
"$MAKE_BIN" -s ${CFLAGS:+CFLAGS="$CFLAGS"}
76 run_after_echo
"$MAKE_BIN" -s testprogs
${CFLAGS:+CFLAGS="$CFLAGS"}
78 # The "-s" flag is a no-op and CFLAGS is set using -DEXTRA_CFLAGS above.
79 run_after_echo
"$MAKE_BIN"
80 run_after_echo
"$MAKE_BIN" testprogs
82 run_after_echo
"$MAKE_BIN" install
84 run_after_echo
"$PREFIX/bin/pcap-config" --help
85 run_after_echo
"$PREFIX/bin/pcap-config" --version
86 run_after_echo
"$PREFIX/bin/pcap-config" --cflags
87 run_after_echo
"$PREFIX/bin/pcap-config" --libs
88 run_after_echo
"$PREFIX/bin/pcap-config" --additional-libs
89 run_after_echo
"$PREFIX/bin/pcap-config" --libs --static
90 run_after_echo
"$PREFIX/bin/pcap-config" --additional-libs --static
91 run_after_echo
"$PREFIX/bin/pcap-config" --libs --static-pcap-only
92 run_after_echo
"$PREFIX/bin/pcap-config" --additional-libs --static-pcap-only
94 [ "$REMOTE" = yes ] && run_after_echo
"$PREFIX/sbin/rpcapd" -h
96 # VALGRIND_CMD is meant either to collapse or to expand.
97 # shellcheck disable=SC2086
98 if [ "$CMAKE" = no
]; then
99 run_after_echo
$VALGRIND_CMD testprogs
/findalldevstest
100 [ "$TEST_RELEASETAR" = yes ] && run_after_echo
"$MAKE_BIN" releasetar
102 run_after_echo
$VALGRIND_CMD run
/findalldevstest
105 if [ "$DELETE_PREFIX" = yes ]; then
106 run_after_echo
rm -rf "$PREFIX"
108 # vi: set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab autoindent :