]>
Commit | Line | Data |
---|---|---|
fdce492e | 1 | #!/bin/sh |
d151cd28 TB |
2 | # Build script for Travis CI |
3 | ||
e5d52774 TB |
4 | build_botan() |
5 | { | |
1bbb736e | 6 | # same revision used in the build recipe of the testing environment |
59455137 | 7 | BOTAN_REV=2.15.0 |
da9e4fa0 | 8 | BOTAN_DIR=$DEPS_BUILD_DIR/botan |
24af02b0 | 9 | |
d4068a1d TB |
10 | if test -d "$BOTAN_DIR"; then |
11 | return | |
12 | fi | |
13 | ||
2a58030b TB |
14 | echo "$ build_botan()" |
15 | ||
e5d52774 TB |
16 | # if the leak detective is enabled we have to disable threading support |
17 | # (used for std::async) as that causes invalid frees somehow, the | |
18 | # locking allocator causes a static leak via the first function that | |
19 | # references it (e.g. crypter or hasher), so we disable that too | |
20 | if test "$LEAK_DETECTIVE" = "yes"; then | |
21 | BOTAN_CONFIG="--without-os-features=threads | |
22 | --disable-modules=locking_allocator" | |
23 | fi | |
24 | # disable some larger modules we don't need for the tests | |
da9e4fa0 TB |
25 | BOTAN_CONFIG="$BOTAN_CONFIG --disable-modules=pkcs11,tls,x509,xmss |
26 | --prefix=$DEPS_PREFIX" | |
1bbb736e TB |
27 | |
28 | git clone https://github.com/randombit/botan.git $BOTAN_DIR && | |
24af02b0 | 29 | cd $BOTAN_DIR && |
bbe72f97 | 30 | git checkout -qf $BOTAN_REV && |
24af02b0 | 31 | python ./configure.py --amalgamation $BOTAN_CONFIG && |
e5d52774 TB |
32 | make -j4 libs >/dev/null && |
33 | sudo make install >/dev/null && | |
34 | sudo ldconfig || exit $? | |
24af02b0 | 35 | cd - |
e5d52774 TB |
36 | } |
37 | ||
d50bb81c TB |
38 | build_wolfssl() |
39 | { | |
e96f5856 | 40 | WOLFSSL_REV=e9b1ceae7e1d # v4.5.0-stable + big endian fix |
da9e4fa0 | 41 | WOLFSSL_DIR=$DEPS_BUILD_DIR/wolfssl |
d50bb81c TB |
42 | |
43 | if test -d "$WOLFSSL_DIR"; then | |
44 | return | |
45 | fi | |
46 | ||
47 | echo "$ build_wolfssl()" | |
48 | ||
49 | WOLFSSL_CFLAGS="-DWOLFSSL_PUBLIC_MP -DWOLFSSL_DES_ECB" | |
da9e4fa0 | 50 | WOLFSSL_CONFIG="--prefix=$DEPS_PREFIX |
7ae4ced0 | 51 | --disable-crypttests --disable-examples |
da9e4fa0 | 52 | --enable-keygen --enable-rsapss --enable-aesccm |
d50bb81c | 53 | --enable-aesctr --enable-des3 --enable-camellia |
7ae4ced0 TB |
54 | --enable-curve25519 --enable-ed25519 |
55 | --enable-curve448 --enable-ed448 | |
56 | --enable-sha3 --enable-shake256" | |
d50bb81c TB |
57 | |
58 | git clone https://github.com/wolfSSL/wolfssl.git $WOLFSSL_DIR && | |
59 | cd $WOLFSSL_DIR && | |
60 | git checkout -qf $WOLFSSL_REV && | |
61 | ./autogen.sh && | |
62 | ./configure C_EXTRA_FLAGS="$WOLFSSL_CFLAGS" $WOLFSSL_CONFIG && | |
63 | make -j4 >/dev/null && | |
64 | sudo make install >/dev/null && | |
65 | sudo ldconfig || exit $? | |
66 | cd - | |
67 | } | |
68 | ||
7b46089e TB |
69 | build_tss2() |
70 | { | |
03a495f6 | 71 | TSS2_REV=2.4.2 |
7b46089e | 72 | TSS2_PKG=tpm2-tss-$TSS2_REV |
da9e4fa0 | 73 | TSS2_DIR=$DEPS_BUILD_DIR/$TSS2_PKG |
7b46089e TB |
74 | TSS2_SRC=https://github.com/tpm2-software/tpm2-tss/releases/download/$TSS2_REV/$TSS2_PKG.tar.gz |
75 | ||
76 | if test -d "$TSS2_DIR"; then | |
77 | return | |
78 | fi | |
79 | ||
2a58030b TB |
80 | echo "$ build_tss2()" |
81 | ||
da9e4fa0 | 82 | curl -L $TSS2_SRC | tar xz -C $DEPS_BUILD_DIR && |
7b46089e | 83 | cd $TSS2_DIR && |
da9e4fa0 | 84 | ./configure --prefix=$DEPS_PREFIX --disable-doxygen-doc && |
248f3491 TB |
85 | make -j4 >/dev/null && |
86 | sudo make install >/dev/null && | |
7b46089e TB |
87 | sudo ldconfig || exit $? |
88 | cd - | |
89 | } | |
90 | ||
da9e4fa0 TB |
91 | : ${TRAVIS_BUILD_DIR=$PWD} |
92 | : ${DEPS_BUILD_DIR=$TRAVIS_BUILD_DIR/..} | |
93 | : ${DEPS_PREFIX=/usr/local} | |
d151cd28 TB |
94 | |
95 | TARGET=check | |
96 | ||
60a0bb67 TB |
97 | DEPS="libgmp-dev" |
98 | ||
95e67e8d MW |
99 | CFLAGS="-g -O2 -Wall -Wno-format -Wno-format-security -Wno-pointer-sign -Werror" |
100 | ||
d151cd28 TB |
101 | case "$TEST" in |
102 | default) | |
316aa4b4 TB |
103 | # should be the default, but lets make sure |
104 | CONFIG="--with-printf-hooks=glibc" | |
d151cd28 | 105 | ;; |
2a58030b TB |
106 | openssl*) |
107 | CONFIG="--disable-defaults --enable-pki --enable-openssl --enable-pem" | |
885c05b0 | 108 | export TESTS_PLUGINS="test-vectors pem openssl!" |
60a0bb67 | 109 | DEPS="libssl-dev" |
d151cd28 TB |
110 | ;; |
111 | gcrypt) | |
3986c1e3 | 112 | CONFIG="--disable-defaults --enable-pki --enable-gcrypt --enable-pkcs1" |
885c05b0 | 113 | export TESTS_PLUGINS="test-vectors pkcs1 gcrypt!" |
60a0bb67 | 114 | DEPS="libgcrypt11-dev" |
d151cd28 | 115 | ;; |
9ee23d5e | 116 | botan) |
4bcc4bac | 117 | CONFIG="--disable-defaults --enable-pki --enable-botan --enable-pem" |
885c05b0 | 118 | export TESTS_PLUGINS="test-vectors pem botan!" |
9ee23d5e | 119 | DEPS="" |
0ff93958 | 120 | if test "$1" = "build-deps"; then |
e5d52774 | 121 | build_botan |
9ee23d5e TB |
122 | fi |
123 | ;; | |
d50bb81c TB |
124 | wolfssl) |
125 | CONFIG="--disable-defaults --enable-pki --enable-wolfssl --enable-pem" | |
885c05b0 | 126 | export TESTS_PLUGINS="test-vectors pem wolfssl!" |
d50bb81c TB |
127 | # build with custom options to enable all the features the plugin supports |
128 | DEPS="" | |
0ff93958 | 129 | if test "$1" = "build-deps"; then |
d50bb81c TB |
130 | build_wolfssl |
131 | fi | |
132 | ;; | |
316aa4b4 TB |
133 | printf-builtin) |
134 | CONFIG="--with-printf-hooks=builtin" | |
135 | ;; | |
e2d8833f | 136 | all|coverage|sonarcloud) |
d151cd28 | 137 | CONFIG="--enable-all --disable-android-dns --disable-android-log |
66c4735f | 138 | --disable-kernel-pfroute --disable-keychain |
157742be | 139 | --disable-lock-profiler --disable-padlock --disable-fuzzing |
e4fd163a | 140 | --disable-osx-attr --disable-tkm --disable-uci |
5833bc4b | 141 | --disable-unwind-backtraces |
4732e29a | 142 | --disable-svc --disable-dbghelp-backtraces --disable-socket-win |
c572401b | 143 | --disable-kernel-wfp --disable-kernel-iph --disable-winhttp" |
d151cd28 TB |
144 | # not enabled on the build server |
145 | CONFIG="$CONFIG --disable-af-alg" | |
3be430cc TB |
146 | if test "$TRAVIS_CPU_ARCH" != "amd64"; then |
147 | CONFIG="$CONFIG --disable-aesni --disable-rdrand" | |
148 | fi | |
42f7c989 TB |
149 | if test "$TEST" != "coverage"; then |
150 | CONFIG="$CONFIG --disable-coverage" | |
151 | else | |
152 | # not actually required but configure checks for it | |
153 | DEPS="$DEPS lcov" | |
154 | fi | |
e0b1b120 TB |
155 | # Botan requires GCC 5.0, so disable it on Ubuntu 16.04 |
156 | if test -n "$UBUNTU_XENIAL"; then | |
157 | CONFIG="$CONFIG --disable-botan" | |
158 | fi | |
60a0bb67 TB |
159 | DEPS="$DEPS libcurl4-gnutls-dev libsoup2.4-dev libunbound-dev libldns-dev |
160 | libmysqlclient-dev libsqlite3-dev clearsilver-dev libfcgi-dev | |
ed843063 | 161 | libpcsclite-dev libpam0g-dev binutils-dev libnm-dev libgcrypt20-dev |
393e39a1 | 162 | libjson-c-dev iptables-dev python-pip libtspi-dev libsystemd-dev" |
ead067e7 | 163 | PYDEPS="tox" |
0ff93958 | 164 | if test "$1" = "build-deps"; then |
e0b1b120 TB |
165 | if test -z "$UBUNTU_XENIAL"; then |
166 | build_botan | |
167 | fi | |
d50bb81c | 168 | build_wolfssl |
7b46089e | 169 | build_tss2 |
e5d52774 | 170 | fi |
d151cd28 | 171 | ;; |
fd372e13 MW |
172 | win*) |
173 | CONFIG="--disable-defaults --enable-svc --enable-ikev2 | |
d930d184 MW |
174 | --enable-ikev1 --enable-static --enable-test-vectors --enable-nonce |
175 | --enable-constraints --enable-revocation --enable-pem --enable-pkcs1 | |
176 | --enable-pkcs8 --enable-x509 --enable-pubkey --enable-acert | |
177 | --enable-eap-tnc --enable-eap-ttls --enable-eap-identity | |
1da56773 | 178 | --enable-updown --enable-ext-auth --enable-libipsec |
d930d184 MW |
179 | --enable-tnccs-20 --enable-imc-attestation --enable-imv-attestation |
180 | --enable-imc-os --enable-imv-os --enable-tnc-imv --enable-tnc-imc | |
cfdab423 TB |
181 | --enable-pki --enable-swanctl --enable-socket-win |
182 | --enable-kernel-iph --enable-kernel-wfp --enable-winhttp" | |
6eb7dd11 TB |
183 | # no make check for Windows binaries unless we run on a windows host |
184 | if test "$APPVEYOR" != "True"; then | |
185 | TARGET= | |
8a4f1102 | 186 | CCACHE=ccache |
09662628 TB |
187 | else |
188 | CONFIG="$CONFIG --enable-openssl" | |
189 | CFLAGS="$CFLAGS -I/c/OpenSSL-$TEST/include" | |
190 | LDFLAGS="-L/c/OpenSSL-$TEST" | |
191 | export LDFLAGS | |
6eb7dd11 | 192 | fi |
d930d184 | 193 | CFLAGS="$CFLAGS -mno-ms-bitfields" |
94a69986 | 194 | DEPS="gcc-mingw-w64-base" |
fd372e13 MW |
195 | case "$TEST" in |
196 | win64) | |
cfdab423 | 197 | CONFIG="--host=x86_64-w64-mingw32 $CONFIG --enable-dbghelp-backtraces" |
94a69986 | 198 | DEPS="gcc-mingw-w64-x86-64 binutils-mingw-w64-x86-64 mingw-w64-x86-64-dev $DEPS" |
8a4f1102 | 199 | CC="$CCACHE x86_64-w64-mingw32-gcc" |
fd372e13 MW |
200 | ;; |
201 | win32) | |
202 | CONFIG="--host=i686-w64-mingw32 $CONFIG" | |
cfdab423 | 203 | DEPS="gcc-mingw-w64-i686 binutils-mingw-w64-i686 mingw-w64-i686-dev $DEPS" |
8a4f1102 | 204 | CC="$CCACHE i686-w64-mingw32-gcc" |
fd372e13 MW |
205 | ;; |
206 | esac | |
d930d184 | 207 | ;; |
763f07c5 TB |
208 | android) |
209 | DEPS="$DEPS openjdk-8-jdk" | |
210 | if test "$1" = "deps"; then | |
211 | git clone git://git.strongswan.org/android-ndk-boringssl.git -b ndk-static \ | |
212 | src/frontends/android/app/src/main/jni/openssl | |
213 | fi | |
214 | TARGET=distdir | |
215 | ;; | |
e36b1e2e | 216 | osx) |
fd9edf7f TB |
217 | # this causes a false positive in ip-packet.c since Xcode 8.3 |
218 | CFLAGS="$CFLAGS -Wno-address-of-packed-member" | |
e36b1e2e TB |
219 | # use the same options as in the Homebrew Formula |
220 | CONFIG="--disable-defaults --enable-charon --enable-cmd --enable-constraints | |
221 | --enable-curl --enable-eap-gtc --enable-eap-identity | |
222 | --enable-eap-md5 --enable-eap-mschapv2 --enable-ikev1 --enable-ikev2 | |
223 | --enable-kernel-libipsec --enable-kernel-pfkey | |
224 | --enable-kernel-pfroute --enable-nonce --enable-openssl | |
225 | --enable-osx-attr --enable-pem --enable-pgp --enable-pkcs1 | |
226 | --enable-pkcs8 --enable-pki --enable-pubkey --enable-revocation | |
227 | --enable-scepclient --enable-socket-default --enable-sshkey | |
228 | --enable-stroke --enable-swanctl --enable-unity --enable-updown | |
229 | --enable-x509 --enable-xauth-generic" | |
230 | DEPS="bison gettext openssl curl" | |
231 | BREW_PREFIX=$(brew --prefix) | |
232 | export PATH=$BREW_PREFIX/opt/bison/bin:$PATH | |
233 | export ACLOCAL_PATH=$BREW_PREFIX/opt/gettext/share/aclocal:$ACLOCAL_PATH | |
234 | for pkg in openssl curl | |
235 | do | |
8486b3b4 | 236 | PKG_CONFIG_PATH=$BREW_PREFIX/opt/$pkg/lib/pkgconfig:$PKG_CONFIG_PATH |
e36b1e2e TB |
237 | CPPFLAGS="-I$BREW_PREFIX/opt/$pkg/include $CPPFLAGS" |
238 | LDFLAGS="-L$BREW_PREFIX/opt/$pkg/lib $LDFLAGS" | |
239 | done | |
240 | export PKG_CONFIG_PATH | |
241 | export CPPFLAGS | |
242 | export LDFLAGS | |
243 | ;; | |
d6949b15 TB |
244 | freebsd) |
245 | # use the options of the FreeBSD port (including options), except smp, | |
246 | # which requires a patch but is deprecated anyway, only using the builtin | |
247 | # printf hooks | |
248 | CONFIG="--enable-kernel-pfkey --enable-kernel-pfroute --disable-scripts | |
249 | --disable-kernel-netlink --enable-openssl --enable-eap-identity | |
250 | --enable-eap-md5 --enable-eap-tls --enable-eap-mschapv2 | |
251 | --enable-eap-peap --enable-eap-ttls --enable-md4 --enable-blowfish | |
252 | --enable-addrblock --enable-whitelist --enable-cmd --enable-curl | |
253 | --enable-eap-aka --enable-eap-aka-3gpp2 --enable-eap-dynamic | |
254 | --enable-eap-radius --enable-eap-sim --enable-eap-sim-file | |
255 | --enable-gcm --enable-ipseckey --enable-kernel-libipsec | |
256 | --enable-load-tester --enable-ldap --enable-mediation | |
257 | --enable-mysql --enable-sqlite --enable-tpm --enable-unbound | |
258 | --enable-unity --enable-xauth-eap --enable-xauth-pam | |
259 | --with-printf-hooks=builtin --enable-attr-sql --enable-sql" | |
260 | DEPS="gmp openldap-client libxml2 mysql80-client sqlite3 unbound ldns" | |
261 | export GPERF=/usr/local/bin/gperf | |
262 | export LEX=/usr/local/bin/flex | |
263 | ;; | |
1ce2721d TB |
264 | fuzzing) |
265 | CFLAGS="$CFLAGS -DNO_CHECK_MEMWIPE" | |
508b3087 | 266 | CONFIG="--enable-fuzzing --enable-static --disable-shared --disable-scripts |
75181f48 | 267 | --enable-imc-test --enable-tnccs-20" |
1ce2721d TB |
268 | # don't run any of the unit tests |
269 | export TESTS_RUNNERS= | |
270 | # prepare corpora | |
271 | if test -z "$1"; then | |
272 | if test -z "$FUZZING_CORPORA"; then | |
273 | git clone --depth 1 https://github.com/strongswan/fuzzing-corpora.git fuzzing-corpora | |
274 | export FUZZING_CORPORA=$TRAVIS_BUILD_DIR/fuzzing-corpora | |
275 | fi | |
7421884d TB |
276 | # these are about the same as those on OSS-Fuzz (except for the |
277 | # symbolize options and strip_path_prefix) | |
278 | export ASAN_OPTIONS=redzone=16:handle_sigill=1:strict_string_check=1:\ | |
279 | allocator_release_to_os_interval_ms=500:strict_memcmp=1:detect_container_overflow=1:\ | |
280 | coverage=0:allocator_may_return_null=1:use_sigaltstack=1:detect_stack_use_after_return=1:\ | |
281 | alloc_dealloc_mismatch=0:detect_leaks=1:print_scariness=1:max_uar_stack_size_log=16:\ | |
282 | handle_abort=1:check_malloc_usable_size=0:quarantine_size_mb=10:detect_odr_violation=0:\ | |
283 | symbolize=1:handle_segv=1:fast_unwind_on_fatal=0:external_symbolizer_path=/usr/bin/llvm-symbolizer-3.5 | |
1ce2721d TB |
284 | fi |
285 | ;; | |
658b6df4 TB |
286 | nm|nm-no-glib) |
287 | DEPS="gnome-common libsecret-1-dev libgtk-3-dev libnm-dev libnma-dev" | |
288 | if test "$TEST" = "nm"; then | |
289 | DEPS="$DEPS libnm-glib-vpn-dev libnm-gtk-dev" | |
290 | else | |
291 | CONFIG="$CONFIG --without-libnm-glib" | |
292 | fi | |
293 | cd src/frontends/gnome | |
294 | # don't run ./configure with ./autogen.sh | |
295 | export NOCONFIGURE=1 | |
296 | ;; | |
d151cd28 TB |
297 | dist) |
298 | TARGET=distcheck | |
299 | ;; | |
4e8f5a18 TB |
300 | apidoc) |
301 | DEPS="doxygen" | |
302 | CONFIG="--disable-defaults" | |
303 | TARGET=apidoc | |
304 | ;; | |
c9a34303 TB |
305 | lgtm) |
306 | DEPS="jq" | |
307 | ||
308 | if test -z "$1"; then | |
309 | # fall back to the parent of the latest commit (on new branches we might | |
310 | # not have a range, also on duplicate branches) | |
311 | base="${TRAVIS_COMMIT}^" | |
312 | if test -n "$TRAVIS_COMMIT_RANGE"; then | |
313 | base="${TRAVIS_COMMIT_RANGE%...*}" | |
314 | # after rebases, the first commit ID in the range might not be valid | |
315 | git rev-parse -q --verify $base | |
316 | if [ $? != 0 ]; then | |
317 | # this will always compare against master, while the range | |
318 | # otherwise only contains "new" commits | |
319 | base=$(git merge-base origin/master ${TRAVIS_COMMIT}) | |
320 | fi | |
321 | fi | |
322 | base=$(git rev-parse $base) | |
323 | project_id=1506185006272 | |
324 | ||
325 | echo "Starting code review for $TRAVIS_COMMIT (base $base) on lgtm.com" | |
326 | git diff --binary $base > lgtm.patch || exit $? | |
327 | curl -s -X POST --data-binary @lgtm.patch \ | |
328 | "https://lgtm.com/api/v1.0/codereviews/${project_id}?base=${base}&external-id=${TRAVIS_BUILD_NUMBER}" \ | |
329 | -H 'Content-Type: application/octet-stream' \ | |
330 | -H 'Accept: application/json' \ | |
331 | -H "Authorization: Bearer ${LGTM_TOKEN}" > lgtm.res || exit $? | |
332 | lgtm_check_url=$(jq -r '."task-result-url"' lgtm.res) | |
4b225bf8 TB |
333 | if [ -z "$lgtm_check_url" -o "$lgtm_check_url" = "null" ]; then |
334 | cat lgtm.res | |
c9a34303 TB |
335 | exit 1 |
336 | fi | |
337 | lgtm_url=$(jq -r '."task-result"."results-url"' lgtm.res) | |
338 | echo "Progress and full results: ${lgtm_url}" | |
339 | ||
340 | echo -n "Waiting for completion: " | |
341 | lgtm_status=pending | |
342 | while [ "$lgtm_status" = "pending" ]; do | |
343 | sleep 15 | |
344 | curl -s -X GET "${lgtm_check_url}" \ | |
345 | -H 'Accept: application/json' \ | |
346 | -H "Authorization: Bearer ${LGTM_TOKEN}" > lgtm.res | |
347 | if [ $? != 0 ]; then | |
348 | echo -n "-" | |
349 | continue | |
350 | fi | |
351 | echo -n "." | |
352 | lgtm_status=$(jq -r '.status' lgtm.res) | |
353 | done | |
354 | echo "" | |
355 | ||
356 | if [ "$lgtm_status" != "success" ]; then | |
357 | lgtm_message=$(jq -r '.["status-message"]' lgtm.res) | |
358 | echo "Code review failed: ${lgtm_message}" | |
359 | exit 1 | |
360 | fi | |
361 | lgtm_new=$(jq -r '.languages[].new' lgtm.res | awk '{t+=$1} END {print t}') | |
362 | lgtm_fixed=$(jq -r '.languages[].fixed' lgtm.res | awk '{t+=$1} END {print t}') | |
363 | echo -n "Code review complete: " | |
fdce492e | 364 | printf "%b\n" "\e[1;31m${lgtm_new}\e[0m new alerts, \e[1;32m${lgtm_fixed}\e[0m fixed" |
c9a34303 TB |
365 | exit $lgtm_new |
366 | fi | |
367 | ;; | |
d151cd28 TB |
368 | *) |
369 | echo "$0: unknown test $TEST" >&2 | |
370 | exit 1 | |
371 | ;; | |
372 | esac | |
373 | ||
0ff93958 TB |
374 | case "$1" in |
375 | deps) | |
e36b1e2e TB |
376 | case "$TRAVIS_OS_NAME" in |
377 | linux) | |
378 | sudo apt-get update -qq && \ | |
379 | sudo apt-get install -qq bison flex gperf gettext $DEPS | |
380 | ;; | |
381 | osx) | |
382 | brew update && \ | |
383 | brew install $DEPS | |
384 | ;; | |
d6949b15 TB |
385 | freebsd) |
386 | pkg install -y automake autoconf libtool pkgconf && \ | |
387 | pkg install -y bison flex gperf gettext $DEPS | |
388 | ;; | |
e36b1e2e | 389 | esac |
60a0bb67 | 390 | exit $? |
0ff93958 TB |
391 | ;; |
392 | pydeps) | |
6ccfeeb1 | 393 | test -z "$PYDEPS" || pip -q install --user $PYDEPS |
75a84579 | 394 | exit $? |
0ff93958 TB |
395 | ;; |
396 | build-deps) | |
397 | exit | |
398 | ;; | |
399 | *) | |
400 | ;; | |
401 | esac | |
75a84579 | 402 | |
d151cd28 | 403 | CONFIG="$CONFIG |
e36b1e2e | 404 | --disable-dependency-tracking |
d151cd28 TB |
405 | --enable-silent-rules |
406 | --enable-test-vectors | |
407 | --enable-monolithic=${MONOLITHIC-no} | |
408 | --enable-leak-detective=${LEAK_DETECTIVE-no}" | |
409 | ||
e36b1e2e TB |
410 | echo "$ ./autogen.sh" |
411 | ./autogen.sh || exit $? | |
4e8f5a18 TB |
412 | echo "$ CC=$CC CFLAGS=\"$CFLAGS\" ./configure $CONFIG" |
413 | CC="$CC" CFLAGS="$CFLAGS" ./configure $CONFIG || exit $? | |
414 | ||
415 | case "$TEST" in | |
416 | apidoc) | |
417 | exec 2>make.warnings | |
418 | ;; | |
419 | *) | |
420 | ;; | |
421 | esac | |
422 | ||
423 | echo "$ make $TARGET" | |
e2d8833f TB |
424 | case "$TEST" in |
425 | sonarcloud) | |
393e39a1 TB |
426 | # there is an issue with the platform detection that causes sonarqube to |
427 | # fail on bionic with "ERROR: ld.so: object '...libinterceptor-${PLATFORM}.so' | |
428 | # from LD_PRELOAD cannot be preloaded (cannot open shared object file)" | |
429 | # https://jira.sonarsource.com/browse/CPP-2027 | |
430 | BW_PATH=$(dirname $(which build-wrapper-linux-x86-64)) | |
431 | cp $BW_PATH/libinterceptor-x86_64.so $BW_PATH/libinterceptor-haswell.so | |
e2d8833f TB |
432 | # without target, coverage is currently not supported anyway because |
433 | # sonarqube only supports gcov, not lcov | |
434 | build-wrapper-linux-x86-64 --out-dir bw-output make -j4 || exit $? | |
435 | ;; | |
436 | *) | |
437 | make -j4 $TARGET || exit $? | |
438 | ;; | |
439 | esac | |
4e8f5a18 TB |
440 | |
441 | case "$TEST" in | |
442 | apidoc) | |
443 | if test -s make.warnings; then | |
444 | cat make.warnings | |
445 | exit 1 | |
446 | fi | |
f36e3755 | 447 | rm make.warnings |
4e8f5a18 | 448 | ;; |
e2d8833f TB |
449 | sonarcloud) |
450 | sonar-scanner \ | |
fd5cf311 TB |
451 | -Dsonar.projectKey=${SONAR_PROJECT} \ |
452 | -Dsonar.organization=${SONAR_ORGANIZATION} \ | |
e2d8833f TB |
453 | -Dsonar.projectVersion=$(git describe)+${TRAVIS_BUILD_NUMBER} \ |
454 | -Dsonar.sources=. \ | |
187ab298 | 455 | -Dsonar.cfamily.threads=2 \ |
1f2c83db TB |
456 | -Dsonar.cfamily.cache.enabled=true \ |
457 | -Dsonar.cfamily.cache.path=$HOME/.sonar-cache \ | |
e2d8833f | 458 | -Dsonar.cfamily.build-wrapper-output=bw-output || exit $? |
f36e3755 | 459 | rm -r bw-output .scannerwork |
e2d8833f | 460 | ;; |
763f07c5 TB |
461 | android) |
462 | rm -r strongswan-* | |
463 | cd src/frontends/android | |
464 | echo "$ ./gradlew build" | |
465 | NDK_CCACHE=ccache ./gradlew build | |
466 | ;; | |
4e8f5a18 TB |
467 | *) |
468 | ;; | |
469 | esac | |
f36e3755 TB |
470 | |
471 | # ensure there are no unignored build artifacts (or other changes) in the Git repo | |
472 | unclean="$(git status --porcelain)" | |
473 | if test -n "$unclean"; then | |
474 | echo "Unignored build artifacts or other changes:" | |
475 | echo "$unclean" | |
476 | exit 1 | |
477 | fi |