Commit Graph

32 Commits

Author SHA1 Message Date
Denis Ovsienko
34a534f50d CI: Set DELETE_PREFIX in build.sh. [skip ci]
When the PREFIX variable is set before build.sh runs, this means it
points to a directory that build.sh needs neither to create nor to
remove, as that's a responsibility of whoever runs build.sh (which is
usually build_matrix.sh).  When the variable is not set before build.sh
runs, it means build.sh needs to create a temporary directory and to
remove it afterwards.

This convention works in libpcap and tcpslice, but in tcpdump the script
does not delete the temporary directory because I did not port the logic
correctly in commit 75e92be.  Get this right.
2023-07-02 20:12:48 +01:00
Denis Ovsienko
00fd858c85 CI: Introduce TEST_RELEASETAR. [skip ci]
Same as in tcpslice and libpcap.
2023-02-25 17:52:18 +00:00
Francois-Xavier Le Bail
15e642a9cd autoconf: Add autogen.sh, remove configure and config.h.in
Put autoconf-generated files in the release tarball.

The minimum required version of autoconf is currently 2.69.

If version 2.69 or later is already installed and there is no
autoconf default, it may be necessary to set the AUTORECONF
environment variable to enable the one to use, like:
AUTORECONF=autoreconf-2.69 ./autogen.sh
or
AUTORECONF=autoreconf-2.71 ./autogen.sh
2023-01-31 13:58:33 +01:00
Francois-Xavier Le Bail
625657ada8 CI: Introduce and use TCPDUMP_CMAKE_TAINTED
The new environment variable provides means to declare all or some libpcap
cmake run of a specific environment (CI or a working copy) as tainted.
Add explicit conditions to exempt the cmake run that emit warnings
now and request the compiler to treat warnings as errors *iff* the cmake
run is not tainted. This way if a cmake run that is warning-free now
degrades later, CI will fail it.

The treat warnings as errors cmake option used is:
-Werror=dev
       Make developer warnings errors.

       Make  warnings  that  are  meant  for  the  author of the CMake-
       Lists.txt files errors. By default this will also turn on depre-
       cated warnings as errors.
2022-11-30 12:05:58 +01:00
Denis Ovsienko
83322579a9 build.sh: Clean up better before CMake. [skip ci] 2022-07-09 12:09:12 +01:00
Denis Ovsienko
0bba1cdaf5 CI: Relax the illumos exemption rule. [skip appveyor]
As it turns out, the same warnings reproduce with other Clang versions
(at least 11) and other illumos distributions (at least OmniOS), so omit
Clang version in the pattern.
2022-03-11 15:07:08 +00:00
Denis Ovsienko
27b74a81ae CI: Disable shellcheck SC2006 in the Makefile. [skip ci]
Same as in tcpslice and libpcap.
2022-01-04 12:37:14 +00:00
Denis Ovsienko
4316f615c9 CI: Add MAKE_BIN to allow non-default makes. [skip ci]
This way parallel builds are simpler on Solaris and OpenIndiana.
2021-08-17 20:35:21 +01:00
Denis Ovsienko
4b3055b4bd Document some OpenIndiana particulars. [skip ci] 2021-08-17 17:39:47 +01:00
Denis Ovsienko
780f86b43c Use basename() and dirname() right on FreeBSD. [skip appveyor]
On FreeBSD CMake runs Clang with -std=gnu99, which used to emit three
warnings in a Capsicum-specific block along the following lines:

tcpdump.c:2432:32: warning: '_Generic' is a C11 extension
  [-Wc11-extensions]
/usr/include/libgen.h:61:21: note: expanded from macro 'basename'
  basename)(x)
/usr/include/sys/cdefs.h:325:2: note: expanded from macro '__generic'
        _Generic(expr, t: yes, default: no)

(In the same context Autoconf does not request a specific C standard
from Clang, so it happens to use C17 and there is no warning.)

Type-generic expressions support in C99 mode seems to be a quirk of
Clang that cannot be disabled and is harmless in this context, so
introduce and use another pair of diagnostic control macros (for Clang
only) to squelch the warnings.

While at it, study the reason for _Generic use in /usr/include/libgen.h
and realize that tcpdump.c still assumes the behaviour before FreeBSD
12.0.  Add two temporary buffers around basename() and dirname() calls
to get consistent results regardless of which FreeBSD version it is.

Remove the last remaining exemption rule.
2021-08-05 14:39:45 +01:00
Denis Ovsienko
51f9c3b947 Squelch a warning with Capsicum enabled. [skip appveyor]
The Capsicum workaround I added in commit 706c79e causes a side effect
on FreeBSD 11.4, 12.2 and 13.0 with local libpcap when Capsicum is
enabled, that is, in CMake builds (Capsicum detection is broken in
Autoconf builds, as it turns out).  Add a workaround for the side effect
as well and get rid of another warning and respective exemption:

tcpdump.c:2286:3: warning: implicit declaration of function 'bpf_dump'
  is invalid in C99 [-Wimplicit-function-declaration]
2021-08-04 00:45:45 +01:00
Denis Ovsienko
e8be4e64cd CI: Put a misplaced comment right in build.sh. [skip ci]
The script both assigns and uses TCPDUMP_BIN, so it is the export line
that is purposed for TESTrun rather than the variable assignment.
2021-08-03 15:31:54 +01:00
Denis Ovsienko
e5bf4ceec7 Move capdns from tcpdump.c to addrtoname.c.
Address the warning below (specific to a few versions of Clang, CMake
and FreeBSD) and update the exemption rule comment in build.sh.

tcpdump.c:244:16: warning: no previous extern declaration for non-static
  variable 'capdns' [-Wmissing-variable-declarations]
2021-08-02 00:32:46 +01:00
Denis Ovsienko
74ab2face0 CI: Explain useful side effects of "-D" and "-J". [skip ci] 2021-07-30 16:23:42 +01:00
Denis Ovsienko
7880ad999f CMake: Add a way to request -Werror and equivalents.
As it turns out, most FreeBSD/CMake tcpdump builds were emitting some
warnings.  This was difficult to notice because make returned success
regardless of the warnings because the compiler never received -Werror
because there was no way to tell CMake to append any compiler flags at
the build time, but not at the buildsystem generation time.  In other
words, the command "make CFLAGS=-Werror" had the same effect as just
"make".

Implement the desired behaviour with "cmake -DEXTRA_CFLAGS='xyz'" and
set the variable in build.sh when and as required.  Reword the comment
for clarity and define two known exemptions.
2021-07-30 10:44:45 +01:00
Denis Ovsienko
9b40c0b767 CI: Port recent improvements from tcpslice. [skip appveyor]
Introduce TCPDUMP_TAINTED, improve OS and compiler identification, print
matrix progress to stderr.
2021-07-30 10:33:35 +01:00
Denis Ovsienko
b1dca9b165 CI: Print dynamic dependencies early. [skip ci]
Call print_so_deps() just after "make install", so if dynamic linking
has failed for some reason, the failure to run tcpdump binary will not
prevent printing the details. Lose "tcpdump --version" because version
information is a part of "tcpdump -h" output.

-- Installing: /tmp/tcpdump_build_matrix.XXyKaiEo/bin/tcpdump
-- Set runtime path of "/tmp/tcpdump_build_matrix.XXyKaiEo/bin/tcpdump" to ""
-- Installing: /tmp/tcpdump_build_matrix.XXyKaiEo/share/man/man1/tcpdump.1
$ /tmp/tcpdump_build_matrix.XXyKaiEo/bin/tcpdump --version
ld.so.1: tcpdump: fatal: libpcap.so.1: open failed: No such file or directory
2021-07-26 15:43:16 +01:00
Denis Ovsienko
cdc3bc2359 CI: Refine C compilers handling. [skip appveyor]
In build_common.sh add minimal heuristics to print_cc_version() to help
it run the right command; add cc_id() and cc_werr_cflags() to pick the
right CFLAGS for the current compiler instead of the previously
hard-coded "-Werror". Add some comments.

In build.sh remove the CFLAGS exemptions for AIX and Solaris 9 builds,
which are in a better shape now and can complete specific subsets of the
full matrix without a warning. Set CFLAGS from cc_werr_cflags() to make
the best effort to catch as many warnings as possible. Let's see how well
that works.
2021-07-25 23:17:36 +01:00
Denis Ovsienko
c8e8e57d05 CI: Add missing SC2006 squelch directives. [skip ci] 2021-07-23 14:05:18 +01:00
Denis Ovsienko
507a4c91b5 CI: Import recent build matrix improvements. [skip appveyor]
Start using build_common.sh, make default assignments early and
uniformly, use Solaris-compatible command substitution and exports,
install bc on linux-amd64, deduplicate and reformat some long commands.
Run "make -s" without CFLAGS=-Werror when warnings are expected.

This implements initial support for AIX and Solaris in the tcpdump build
matrix scripts.

* AIX 7.1
M4='/opt/freeware/bin/m4' \
MATRIX_CC='gcc' \
MATRIX_CMAKE=no \
MATRIX_BUILD_LIBPCAP=yes \
./build_matrix.sh

* Solaris 9
MATRIX_CC=gcc \
MATRIX_CMAKE=no \
MATRIX_BUILD_LIBPCAP=no \
./build_matrix.sh

* Solaris 10 and 11
MATRIX_CC='gcc' \
MATRIX_CMAKE=no \
./build_matrix.sh
2021-07-23 01:52:50 +01:00
Denis Ovsienko
166cdc3dfb CI: Run "make releasetar" regardless of the OS.
Same as in tcpslice.
2021-07-18 01:04:13 +01:00
Francois-Xavier Le Bail
24f217998d CI: Add back running tcpdump -J/-L and capture, now with Cirrus VMs.
The Cirrus virtual machines are throwaway.

Revert partially f5739ad4ca.
2021-07-08 16:25:15 +02:00
Denis Ovsienko
f5739ad4ca CI: Get Travis CI vestige sorted in build.sh.
Compiling user-provided source code and running the resulting binary
with sudo was a security problem, thus instead of fixing two no-op
blocks remove them altogether. If anyone later needs to debug features
that require higher privileges, they will need to come up with a better
solution. Simplify the debug output test condition and rephrase the
associated comment for clarity.
2021-07-05 19:47:29 +01:00
Denis Ovsienko
d56f061500 CI: List shared libraries on more OSes.
Running ldd on Linux only originates from the Travis CI setup, where the
OS was either Linux or macOS. However, ldd is available in BSD systems
too, and macOS seems to have its own tool for the same job.
2021-07-05 19:47:25 +01:00
Denis Ovsienko
35a8fc576d CI: Lose the output folding props.
Same as in libpcap.
2021-07-05 12:09:59 +01:00
Denis Ovsienko
63ea6b5d47 CI: Switch from bash to POSIX shell.
Same as in libpcap.
2021-07-05 11:59:03 +01:00
Francois-Xavier Le Bail
5abf27529d build.sh: Disable a shellcheck error
We need the $@ expansion.

The error was:
Double quote array expansions to avoid re-splitting elements. [SC2068]
2021-05-31 15:01:44 +02:00
Denis Ovsienko
75e92bef00 CI: Refine the build matrix scripts. [skip appveyor]
Reproduce the recent improvements made in tcpslice and libpcap.
2021-03-21 00:32:50 +00:00
Francois-Xavier Le Bail
fb8908c0ec build.sh, build_matrix.sh: Use more the PREFIX variable 2021-03-13 19:50:02 +01:00
Francois-Xavier Le Bail
40fa95e88a Restore the possibility of building when remote is enabled in libpcap
This change allows to test the build with HAVE_PCAP_FINDALLDEVS_EX and
HAVE_PCAP_OPEN enabled.

Some ways to run theses tests:

MATRIX_BUILD_LIBPCAP=yes MATRIX_REMOTE=yes MATRIX_CMAKE=no MATRIX_CC=gcc \
MATRIX_CRYPTO=no MATRIX_SMB=no ./build_matrix.sh
(configure should display:
checking for pcap_open... yes
checking for pcap_findalldevs_ex... yes)

MATRIX_BUILD_LIBPCAP=yes MATRIX_REMOTE=yes MATRIX_CMAKE=yes MATRIX_CC=gcc \
MATRIX_CRYPTO=no MATRIX_SMB=no ./build_matrix.sh
(cmake should display:
Looking for pcap_open - found
Looking for pcap_findalldevs_ex - found)

Don't enable the builds with REMOTE=yes by default.

This partially reverts commit 3861a41bfa.
"Remove the REMOTE dimension from the nested matrix."
2021-02-11 10:32:58 +01:00
Denis Ovsienko
3861a41bfa Remove the REMOTE dimension from the nested matrix. [skip appveyor]
Neither the build process nor the tests of tcpdump currently depend on
presence or absence of the libpcap remote feature, and there is already
the libpcap nested matrix to cover that dimension, thus in the tcpdump
nested matrix just leave this aspect of the local libpcap build
unspecified and reduce the total number of rounds from 48 to 32.
2021-02-10 14:20:33 +00:00
Francois-Xavier Le Bail
973e9c1c9c Add the build_matrix.sh and build.sh scripts
Use them with Travis CI to build with less builders and save CI runtime.
This will currently run five builders: amd64, arm64, ppc64le, s390x and osx.

The build_matrix.sh script executes the matrix loops, exclude tests and
cleaning.
It conditionally builds libpcap running the build.sh script of libpcap.
It calls the build.sh script which runs one build with setup environment
variables: BUILD_LIBPCAP, REMOTE, CC, CMAKE, CRYPTO and SMB
(default: BUILD_LIBPCAP=no, REMOTE=no, CC=gcc, CMAKE=no, CRYPTO=no, SMB=no).
The matrix can be configured with environment variables
MATRIX_BUILD_LIBPCAP, MATRIX_REMOTE, MATRIX_CC, MATRIX_CMAKE, MATRIX_CRYPTO
and MATRIX_SMB
(default: MATRIX_BUILD_LIBPCAP='no yes', MATRIX_REMOTE='no yes',
MATRIX_CC='gcc clang', MATRIX_CMAKE='no yes', MATRIX_CRYPTO='no yes',
MATRIX_SMB='no yes').

These scripts can easily be updated to run new tests (32 bits builds,
sanitizers, coverage, etc).

They can be used locally for build tests or used with other CI systems.

Run examples:
./build_matrix.sh
MATRIX_BUILD_LIBPCAP=yes ./build_matrix.sh
MATRIX_CC=clang ./build_matrix.sh
CC=clang ./build.sh
CMAKE=yes ./build.sh
CC=clang CMAKE=yes CRYPTO=yes ./build.sh

Moreover:
Remove the old workaround PATH=$PATH...
Update the install directory prefix to /tmp/local.
Use vim modeline in the two shell scripts.
2021-02-09 16:11:39 +01:00