Skip to content

Commit 91bd41e

Browse files
committed
CI: Synchronize scripts with the master branch.
1 parent fedd2e0 commit 91bd41e

File tree

3 files changed

+64
-11
lines changed

3 files changed

+64
-11
lines changed

build.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@
1212
: "${TCPDUMP_TAINTED:=no}"
1313
: "${TCPDUMP_CMAKE_TAINTED:=no}"
1414
: "${MAKE_BIN:=make}"
15+
# At least one OS (AIX 7) where this software can build does not have at least
16+
# one command (mktemp) required for a successful run of "make releasetar".
17+
: "${TEST_RELEASETAR:=yes}"
1518

1619
. ./build_common.sh
1720
# Install directory prefix
1821
if [ -z "$PREFIX" ]; then
1922
PREFIX=`mktempdir tcpdump_build`
2023
echo "PREFIX set to '$PREFIX'"
24+
DELETE_PREFIX=yes
2125
fi
2226
TCPDUMP_BIN="$PREFIX/bin/tcpdump"
2327
# For TESTrun
@@ -39,10 +43,19 @@ clang-*/SunOS-5.11)
3943
# [-Wstrict-prototypes]
4044
[ "`uname -o`" = illumos ] && TCPDUMP_TAINTED=yes
4145
;;
46+
*)
47+
;;
4248
esac
4349

4450
[ "$TCPDUMP_TAINTED" != yes ] && CFLAGS=`cc_werr_cflags`
4551

52+
case `cc_id`/`os_id` in
53+
clang-*/SunOS-5.11)
54+
# Work around https://www.illumos.org/issues/16369
55+
[ "`uname -o`" = illumos ] && grep -Fq OpenIndiana /etc/release && CFLAGS="-Wno-fuse-ld-path${CFLAGS:+ $CFLAGS}"
56+
;;
57+
esac
58+
4659
# If necessary, set TCPDUMP_CMAKE_TAINTED here to exempt particular cmake from
4760
# warnings. Use as specific terms as possible (e.g. some specific version and
4861
# some specific OS).
@@ -68,14 +81,14 @@ else
6881
run_after_echo mkdir build
6982
run_after_echo cd build
7083
if [ "$BUILD_LIBPCAP" = yes ]; then
71-
run_after_echo cmake "$CMAKE_OPTIONS" \
84+
run_after_echo cmake ${CMAKE_OPTIONS:+"$CMAKE_OPTIONS"} \
7285
-DWITH_CRYPTO="$CRYPTO" -DENABLE_SMB="$SMB" \
7386
${CFLAGS:+-DEXTRA_CFLAGS="$CFLAGS"} \
7487
-DCMAKE_INSTALL_PREFIX="$PREFIX" -DCMAKE_PREFIX_PATH="$PREFIX" ..
7588
LD_LIBRARY_PATH="$PREFIX/lib"
7689
export LD_LIBRARY_PATH
7790
else
78-
run_after_echo cmake "$CMAKE_OPTIONS" \
91+
run_after_echo cmake ${CMAKE_OPTIONS:+"$CMAKE_OPTIONS"} \
7992
-DWITH_CRYPTO="$CRYPTO" -DENABLE_SMB="$SMB" \
8093
${CFLAGS:+-DEXTRA_CFLAGS="$CFLAGS"} \
8194
-DCMAKE_INSTALL_PREFIX="$PREFIX" ..
@@ -111,7 +124,7 @@ if [ "$BUILD_LIBPCAP" = yes ]; then
111124
run_after_echo "$MAKE_BIN" check
112125
fi
113126
if [ "$CMAKE" = no ]; then
114-
run_after_echo "$MAKE_BIN" releasetar
127+
[ "$TEST_RELEASETAR" = yes ] && run_after_echo "$MAKE_BIN" releasetar
115128
fi
116129
if [ "$CIRRUS_CI" = true ]; then
117130
run_after_echo sudo \

build_common.sh

Lines changed: 47 additions & 7 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:
@@ -184,6 +201,10 @@ cc_werr_cflags() {
184201
# by default, but an additional option makes the style more consistent.
185202
echo '-errwarn=%all -errtags=yes'
186203
;;
204+
msvc-*)
205+
# XXX - what?
206+
echo ''
207+
;;
187208
esac
188209
}
189210

@@ -208,19 +229,34 @@ os_id() {
208229
: "${os_id_version:=`uname -v`}"
209230
echo "${os_id_version}.${os_id_release}"
210231
;;
211-
Darwin|NetBSD|OpenBSD|SunOS)
232+
Darwin|GNU|OpenBSD|SunOS)
212233
echo "$os_id_release"
213234
;;
214-
FreeBSD|Linux)
235+
FreeBSD|NetBSD|Linux)
215236
# Meaningful version is usually the substring before the first dash.
237+
# Or the first underscore.
216238
echo "$os_id_release" | sed 's/^\([0-9\.]*\).*$/\1/'
217239
;;
218240
Haiku)
219-
# Meaningful version is the substring before the plus sign.
220-
# "hrev55181" stands for "R1/beta3".
221-
# "hrev54154" stands for "R1/beta2".
241+
# The complete version is a substring before the first space, e.g.:
242+
# * "hrevNNNNN" for a release without updates, e.g. hrev56578 for
243+
# R1/beta4, also for a clean build of master branch;
244+
# * "hrevNNNNN+MM" for a release with updates;
245+
# * "hrevNNNNN-MM" for a build of a branch that is ahead of the master
246+
# branch;
247+
# * "hrevNNNNN_MMMM_KK" for a CI build of a Gerrit review;
248+
# * something else for a build of a working copy with the changes not
249+
# yet committed.
250+
# With this system it is not clear which version components would be
251+
# meaningful to relate with the build result, so let's return the
252+
# complete version and leave any interpretation to the user.
222253
: "${os_id_version:=`uname -v`}"
223-
echo "$os_id_version" | sed 's/^\(hrev.*\)+.*$/\1/'
254+
echo "$os_id_version" | sed -E 's/^(hrev[^ ]+).+$/\1/'
255+
;;
256+
MSYS*)
257+
# uname -s produces "MSYS_NT-{NT version?}-{build?}
258+
# uname -r produces MSYS2 version?
259+
echo "$os_id_version", MSYS "$os_id_release"
224260
;;
225261
*)
226262
echo 'UNKNOWN'
@@ -230,7 +266,8 @@ os_id() {
230266

231267
increment() {
232268
# No arithmetic expansion in Solaris /bin/sh before 11.
233-
echo "${1:?} + 1" | bc
269+
# shellcheck disable=SC2003
270+
expr "${1:?}" + 1
234271
}
235272

236273
# Display text in magenta.
@@ -254,6 +291,9 @@ print_so_deps() {
254291
Haiku-*)
255292
run_after_echo objdump -p "${1:?}"
256293
;;
294+
MSYS*)
295+
run_after_echo dumpbin /dependents "${1:?}"
296+
;;
257297
*)
258298
run_after_echo ldd "${1:?}"
259299
;;

build_matrix.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ build_tcpdump() {
5050
for SMB in $MATRIX_SMB; do
5151
export SMB
5252
COUNT=`increment "$COUNT"`
53-
echo_magenta "===== SETUP $COUNT: BUILD_LIBPCAP=$BUILD_LIBPCAP REMOTE=${REMOTE:-?} CC=$CC CMAKE=$CMAKE CRYPTO=$CRYPTO SMB=$SMB =====" >&2
53+
echo_magenta "===== SETUP $COUNT: CC=$CC BUILD_LIBPCAP=$BUILD_LIBPCAP REMOTE=${REMOTE:-?} CMAKE=$CMAKE CRYPTO=$CRYPTO SMB=$SMB =====" >&2
5454
# Run one build with setup environment variables:
5555
# BUILD_LIBPCAP, REMOTE, CC, CMAKE, CRYPTO and SMB
5656
run_after_echo ./build.sh

0 commit comments

Comments
 (0)