From: Denis Ovsienko Date: Sun, 4 Feb 2024 15:18:38 +0000 (+0000) Subject: CI: Copy recent improvements from libpcap. X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/ec780ab24acf7fc52eb40cfbf21c0ec51240c666?hp=10c9f6fdaa79a650df98ffe98017f282a0fcde4a CI: Copy recent improvements from libpcap. --- diff --git a/.cirrus.yml b/.cirrus.yml index c62c7797..24d4a2bc 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -44,7 +44,7 @@ linux_task: LANG: C script: - apt-get -qy update >/dev/null - - apt-get -qy install git autoconf make cmake clang-15 gcc bc >/dev/null + - apt-get -qy install git autoconf make cmake clang-15 gcc >/dev/null - apt-get -qy install flex bison libdbus-1-dev libbluetooth-dev libnl-genl-3-dev libibverbs-dev >/dev/null # for libpcap - apt-get -qy install libssl-dev libsmi2-dev libcap-ng-dev libpcap-dev binutils-dev >/dev/null - apt-get -qy install sudo >/dev/null # for some tcpdump commands diff --git a/build_common.sh b/build_common.sh index 3264d2e9..cdae4626 100644 --- a/build_common.sh +++ b/build_common.sh @@ -45,6 +45,7 @@ mktempdir() { *) # At least Haiku, Linux and OpenBSD implementations require explicit # trailing X'es in the template, so make it the same suffix as above. + # XXX - is MSYS2 GNU-based, so that it would be like Linux? mktemp -d -t "${mktempdir_prefix}.XXXXXXXX" ;; esac @@ -94,6 +95,16 @@ cc_version_nocache() { ;; esac ;; + cl) + # Visual Studio's compiler doesn't have a "print the compiler + # version" option, but we can get version information by + # running it with no options, sending its standard error to + # the standard output, and throwing out the usage message; + # as we have MSYS2, we can just "head" it out. + # + # XXX - does it exit with an error? + "$CC" 2>&1 | head -2 + ;; *) "$CC" --version || "$CC" -V || : ;; @@ -134,6 +145,12 @@ cc_id_nocache() { return fi + cc_id_guessed=`echo "$cc_id_firstline" | sed 's/^Microsoft (R) C\/C++ Optimizing Compiler Version \([0-9\.]*\) .*$/msvc-\1/'` + if [ "$cc_id_firstline" != "$cc_id_guessed" ]; then + echo "$cc_id_guessed" + return + fi + # OpenBSD default GCC: # "gcc (GCC) 4.2.1 20070719" # RedHat GCC: @@ -181,6 +198,10 @@ cc_werr_cflags() { suncc-*) echo '-errwarn=%all' ;; + msvc-*) + # XXX - what? + echo '' + ;; esac } @@ -205,11 +226,12 @@ os_id() { : "${os_id_version:=`uname -v`}" echo "${os_id_version}.${os_id_release}" ;; - Darwin|NetBSD|OpenBSD|SunOS) + Darwin|GNU|OpenBSD|SunOS) echo "$os_id_release" ;; - FreeBSD|Linux) + FreeBSD|NetBSD|Linux) # Meaningful version is usually the substring before the first dash. + # Or the first underscore. echo "$os_id_release" | sed 's/^\([0-9\.]*\).*$/\1/' ;; Haiku) @@ -220,6 +242,11 @@ os_id() { : "${os_id_version:=`uname -v`}" echo "$os_id_version" | sed 's/^\(hrev.*\)+.*$/\1/' ;; + MSYS*) + # uname -s produces "MSYS_NT-{NT version?}-{build?} + # uname -r produces MSYS2 version? + echo "$os_id_version", MSYS "$os_id_release" + ;; *) echo 'UNKNOWN' ;; @@ -228,7 +255,8 @@ os_id() { increment() { # No arithmetic expansion in Solaris /bin/sh before 11. - echo "${1:?} + 1" | bc + # shellcheck disable=SC2003 + expr "${1:?}" + 1 } # Display text in magenta. @@ -252,6 +280,9 @@ print_so_deps() { Haiku-*) run_after_echo objdump -p "${1:?}" ;; + MSYS*) + run_after_echo dumpbin /dependents "${1:?}" + ;; *) run_after_echo ldd "${1:?}" ;;