Skip to content

Commit ec780ab

Browse files
committed
CI: Copy recent improvements from libpcap.
1 parent 10c9f6f commit ec780ab

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

.cirrus.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ linux_task:
4444
LANG: C
4545
script:
4646
- apt-get -qy update >/dev/null
47-
- apt-get -qy install git autoconf make cmake clang-15 gcc bc >/dev/null
47+
- apt-get -qy install git autoconf make cmake clang-15 gcc >/dev/null
4848
- apt-get -qy install flex bison libdbus-1-dev libbluetooth-dev libnl-genl-3-dev libibverbs-dev >/dev/null # for libpcap
4949
- apt-get -qy install libssl-dev libsmi2-dev libcap-ng-dev libpcap-dev binutils-dev >/dev/null
5050
- apt-get -qy install sudo >/dev/null # for some tcpdump commands

build_common.sh

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ mktempdir() {
4545
*)
4646
# At least Haiku, Linux and OpenBSD implementations require explicit
4747
# trailing X'es in the template, so make it the same suffix as above.
48+
# XXX - is MSYS2 GNU-based, so that it would be like Linux?
4849
mktemp -d -t "${mktempdir_prefix}.XXXXXXXX"
4950
;;
5051
esac
@@ -94,6 +95,16 @@ cc_version_nocache() {
9495
;;
9596
esac
9697
;;
98+
cl)
99+
# Visual Studio's compiler doesn't have a "print the compiler
100+
# version" option, but we can get version information by
101+
# running it with no options, sending its standard error to
102+
# the standard output, and throwing out the usage message;
103+
# as we have MSYS2, we can just "head" it out.
104+
#
105+
# XXX - does it exit with an error?
106+
"$CC" 2>&1 | head -2
107+
;;
97108
*)
98109
"$CC" --version || "$CC" -V || :
99110
;;
@@ -134,6 +145,12 @@ cc_id_nocache() {
134145
return
135146
fi
136147

148+
cc_id_guessed=`echo "$cc_id_firstline" | sed 's/^Microsoft (R) C\/C++ Optimizing Compiler Version \([0-9\.]*\) .*$/msvc-\1/'`
149+
if [ "$cc_id_firstline" != "$cc_id_guessed" ]; then
150+
echo "$cc_id_guessed"
151+
return
152+
fi
153+
137154
# OpenBSD default GCC:
138155
# "gcc (GCC) 4.2.1 20070719"
139156
# RedHat GCC:
@@ -181,6 +198,10 @@ cc_werr_cflags() {
181198
suncc-*)
182199
echo '-errwarn=%all'
183200
;;
201+
msvc-*)
202+
# XXX - what?
203+
echo ''
204+
;;
184205
esac
185206
}
186207

@@ -205,11 +226,12 @@ os_id() {
205226
: "${os_id_version:=`uname -v`}"
206227
echo "${os_id_version}.${os_id_release}"
207228
;;
208-
Darwin|NetBSD|OpenBSD|SunOS)
229+
Darwin|GNU|OpenBSD|SunOS)
209230
echo "$os_id_release"
210231
;;
211-
FreeBSD|Linux)
232+
FreeBSD|NetBSD|Linux)
212233
# Meaningful version is usually the substring before the first dash.
234+
# Or the first underscore.
213235
echo "$os_id_release" | sed 's/^\([0-9\.]*\).*$/\1/'
214236
;;
215237
Haiku)
@@ -220,6 +242,11 @@ os_id() {
220242
: "${os_id_version:=`uname -v`}"
221243
echo "$os_id_version" | sed 's/^\(hrev.*\)+.*$/\1/'
222244
;;
245+
MSYS*)
246+
# uname -s produces "MSYS_NT-{NT version?}-{build?}
247+
# uname -r produces MSYS2 version?
248+
echo "$os_id_version", MSYS "$os_id_release"
249+
;;
223250
*)
224251
echo 'UNKNOWN'
225252
;;
@@ -228,7 +255,8 @@ os_id() {
228255

229256
increment() {
230257
# No arithmetic expansion in Solaris /bin/sh before 11.
231-
echo "${1:?} + 1" | bc
258+
# shellcheck disable=SC2003
259+
expr "${1:?}" + 1
232260
}
233261

234262
# Display text in magenta.
@@ -252,6 +280,9 @@ print_so_deps() {
252280
Haiku-*)
253281
run_after_echo objdump -p "${1:?}"
254282
;;
283+
MSYS*)
284+
run_after_echo dumpbin /dependents "${1:?}"
285+
;;
255286
*)
256287
run_after_echo ldd "${1:?}"
257288
;;

0 commit comments

Comments
 (0)