2 # Build script for Travis CI
6 # same revision used in the build recipe of the testing environment
8 BOTAN_DIR
=$TRAVIS_BUILD_DIR/..
/botan
10 if test -d "$BOTAN_DIR"; then
14 echo "$ build_botan()"
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"
24 # disable some larger modules we don't need for the tests
25 BOTAN_CONFIG
="$BOTAN_CONFIG --disable-modules=pkcs11,tls,x509,xmss"
27 git clone https
://github.com
/randombit
/botan.git
$BOTAN_DIR &&
29 git checkout
-qf $BOTAN_REV &&
30 python .
/configure.py
--amalgamation $BOTAN_CONFIG &&
31 make -j4 libs
>/dev
/null
&&
32 sudo
make install >/dev
/null
&&
33 sudo ldconfig ||
exit $?
39 WOLFSSL_REV
=v4.1
.0-stable
40 WOLFSSL_DIR
=$TRAVIS_BUILD_DIR/..
/wolfssl
42 if test -d "$WOLFSSL_DIR"; then
46 echo "$ build_wolfssl()"
48 WOLFSSL_CFLAGS
="-DWOLFSSL_PUBLIC_MP -DWOLFSSL_DES_ECB"
49 WOLFSSL_CONFIG
="--enable-keygen --enable-rsapss --enable-aesccm
50 --enable-aesctr --enable-des3 --enable-camellia
51 --enable-curve25519 --enable-ed25519"
53 git clone https
://github.com
/wolfSSL
/wolfssl.git
$WOLFSSL_DIR &&
55 git checkout
-qf $WOLFSSL_REV &&
57 .
/configure C_EXTRA_FLAGS
="$WOLFSSL_CFLAGS" $WOLFSSL_CONFIG &&
58 make -j4 >/dev
/null
&&
59 sudo
make install >/dev
/null
&&
60 sudo ldconfig ||
exit $?
67 TSS2_PKG
=tpm2-tss-
$TSS2_REV
68 TSS2_DIR
=$TRAVIS_BUILD_DIR/..
/$TSS2_PKG
69 TSS2_SRC
=https
://github.com
/tpm2-software
/tpm2-tss
/releases
/download
/$TSS2_REV/$TSS2_PKG.
tar.gz
71 if test -d "$TSS2_DIR"; then
77 # the default version of libgcrypt in Ubuntu 16.04 is too old
78 sudo apt-get update
-qq && \
79 sudo apt-get
install -qq libgcrypt20-dev
&&
80 curl
-L $TSS2_SRC |
tar xz
-C $TRAVIS_BUILD_DIR/..
&&
83 make -j4 >/dev
/null
&&
84 sudo
make install >/dev
/null
&&
85 sudo ldconfig ||
exit $?
92 SSL_PKG
=openssl-
$SSL_REV
93 SSL_DIR
=$TRAVIS_BUILD_DIR/..
/$SSL_PKG
94 SSL_SRC
=https
://www.openssl.org
/source
/$SSL_PKG.
tar.gz
95 SSL_INS
=/usr
/local
/ssl
96 SSL_OPT
="shared no-tls no-dtls no-ssl3 no-zlib no-comp no-idea no-psk no-srp
97 no-stdio no-tests enable-rfc3779 enable-ec_nistp_64_gcc_128
100 if test -d "$SSL_DIR"; then
104 echo "$ build_openssl()"
106 curl
-L $SSL_SRC |
tar xz
-C $TRAVIS_BUILD_DIR/..
&&
108 .
/config
--prefix=$SSL_INS --openssldir=$SSL_INS $SSL_OPT &&
109 make -j4 >/dev
/null
&&
110 sudo
make install_sw
>/dev
/null
&&
111 echo $SSL_INS/lib | sudo
tee /etc
/ld.so.conf.d
/openssl-
$SSL_REV.conf
>/dev
/null
&&
112 sudo ldconfig ||
exit $?
118 CFLAGS
="$CFLAGS -I/usr/local/ssl/include"
119 LDFLAGS
="$LDFLAGS -L/usr/local/ssl/lib"
121 if test "$1" = "deps"; then
126 if test -z $TRAVIS_BUILD_DIR; then
127 TRAVIS_BUILD_DIR
=$PWD
136 CFLAGS
="-g -O2 -Wall -Wno-format -Wno-format-security -Wno-pointer-sign -Werror"
140 # should be the default, but lets make sure
141 CONFIG
="--with-printf-hooks=glibc"
144 CONFIG
="--disable-defaults --enable-pki --enable-openssl --enable-pem"
145 export TESTS_PLUGINS
="test-vectors pem openssl!"
147 if test "$TEST" != "openssl-1.0"; then
149 use_custom_openssl
$1
153 CONFIG
="--disable-defaults --enable-pki --enable-gcrypt --enable-pkcs1"
154 export TESTS_PLUGINS
="test-vectors pkcs1 gcrypt!"
155 DEPS
="libgcrypt11-dev"
158 CONFIG
="--disable-defaults --enable-pki --enable-botan --enable-pem"
159 export TESTS_PLUGINS
="test-vectors pem botan!"
160 # we can't use the old package that comes with Ubuntu so we build from
161 # the current master until 2.8.0 is released and then probably switch to
162 # that unless we need newer features (at least 2.7.0 plus PKCS#1 patch is
163 # currently required)
165 if test "$1" = "deps"; then
170 CONFIG
="--disable-defaults --enable-pki --enable-wolfssl --enable-pem"
171 export TESTS_PLUGINS
="test-vectors pem wolfssl!"
172 # build with custom options to enable all the features the plugin supports
174 if test "$1" = "deps"; then
179 CONFIG
="--with-printf-hooks=builtin"
181 all|coverage|sonarcloud
)
182 CONFIG
="--enable-all --disable-android-dns --disable-android-log
183 --disable-kernel-pfroute --disable-keychain
184 --disable-lock-profiler --disable-padlock --disable-fuzzing
185 --disable-osx-attr --disable-tkm --disable-uci
186 --disable-soup --disable-unwind-backtraces
187 --disable-svc --disable-dbghelp-backtraces --disable-socket-win
188 --disable-kernel-wfp --disable-kernel-iph --disable-winhttp"
189 # not enabled on the build server
190 CONFIG
="$CONFIG --disable-af-alg"
191 if test "$TEST" != "coverage"; then
192 CONFIG
="$CONFIG --disable-coverage"
194 # not actually required but configure checks for it
197 DEPS
="$DEPS libcurl4-gnutls-dev libsoup2.4-dev libunbound-dev libldns-dev
198 libmysqlclient-dev libsqlite3-dev clearsilver-dev libfcgi-dev
199 libpcsclite-dev libpam0g-dev binutils-dev libunwind8-dev libnm-dev
200 libjson0-dev iptables-dev python-pip libtspi-dev libsystemd-dev"
202 if test "$1" = "deps"; then
207 use_custom_openssl
$1
210 CONFIG
="--disable-defaults --enable-svc --enable-ikev2
211 --enable-ikev1 --enable-static --enable-test-vectors --enable-nonce
212 --enable-constraints --enable-revocation --enable-pem --enable-pkcs1
213 --enable-pkcs8 --enable-x509 --enable-pubkey --enable-acert
214 --enable-eap-tnc --enable-eap-ttls --enable-eap-identity
215 --enable-updown --enable-ext-auth --enable-libipsec
216 --enable-tnccs-20 --enable-imc-attestation --enable-imv-attestation
217 --enable-imc-os --enable-imv-os --enable-tnc-imv --enable-tnc-imc
218 --enable-pki --enable-swanctl --enable-socket-win
219 --enable-kernel-iph --enable-kernel-wfp --enable-winhttp"
220 # no make check for Windows binaries unless we run on a windows host
221 if test "$APPVEYOR" != "True"; then
225 CONFIG
="$CONFIG --enable-openssl"
226 CFLAGS
="$CFLAGS -I/c/OpenSSL-$TEST/include"
227 LDFLAGS
="-L/c/OpenSSL-$TEST"
230 CFLAGS
="$CFLAGS -mno-ms-bitfields"
231 DEPS
="gcc-mingw-w64-base"
234 CONFIG
="--host=x86_64-w64-mingw32 $CONFIG --enable-dbghelp-backtraces"
235 DEPS
="gcc-mingw-w64-x86-64 binutils-mingw-w64-x86-64 mingw-w64-x86-64-dev $DEPS"
236 CC
="$CCACHE x86_64-w64-mingw32-gcc"
239 CONFIG
="--host=i686-w64-mingw32 $CONFIG"
240 DEPS
="gcc-mingw-w64-i686 binutils-mingw-w64-i686 mingw-w64-i686-dev $DEPS"
241 CC
="$CCACHE i686-w64-mingw32-gcc"
246 # this causes a false positive in ip-packet.c since Xcode 8.3
247 CFLAGS
="$CFLAGS -Wno-address-of-packed-member"
248 # use the same options as in the Homebrew Formula
249 CONFIG
="--disable-defaults --enable-charon --enable-cmd --enable-constraints
250 --enable-curl --enable-eap-gtc --enable-eap-identity
251 --enable-eap-md5 --enable-eap-mschapv2 --enable-ikev1 --enable-ikev2
252 --enable-kernel-libipsec --enable-kernel-pfkey
253 --enable-kernel-pfroute --enable-nonce --enable-openssl
254 --enable-osx-attr --enable-pem --enable-pgp --enable-pkcs1
255 --enable-pkcs8 --enable-pki --enable-pubkey --enable-revocation
256 --enable-scepclient --enable-socket-default --enable-sshkey
257 --enable-stroke --enable-swanctl --enable-unity --enable-updown
258 --enable-x509 --enable-xauth-generic"
259 DEPS
="bison gettext openssl curl"
260 BREW_PREFIX
=$
(brew
--prefix)
261 export PATH
=$BREW_PREFIX/opt
/bison
/bin
:$PATH
262 export ACLOCAL_PATH
=$BREW_PREFIX/opt
/gettext
/share
/aclocal
:$ACLOCAL_PATH
263 for pkg
in openssl curl
265 PKG_CONFIG_PATH
=$BREW_PREFIX/opt
/$pkg/lib
/pkgconfig
:$PKG_CONFIG_PATH
266 CPPFLAGS
="-I$BREW_PREFIX/opt/$pkg/include $CPPFLAGS"
267 LDFLAGS
="-L$BREW_PREFIX/opt/$pkg/lib $LDFLAGS"
269 export PKG_CONFIG_PATH
274 CFLAGS
="$CFLAGS -DNO_CHECK_MEMWIPE"
275 CONFIG
="--enable-fuzzing --enable-static --disable-shared --disable-scripts
276 --enable-imc-test --enable-tnccs-20"
277 # don't run any of the unit tests
278 export TESTS_RUNNERS
=
280 if test -z "$1"; then
281 if test -z "$FUZZING_CORPORA"; then
282 git clone
--depth 1 https
://github.com
/strongswan
/fuzzing-corpora.git fuzzing-corpora
283 export FUZZING_CORPORA
=$TRAVIS_BUILD_DIR/fuzzing-corpora
285 # these are about the same as those on OSS-Fuzz (except for the
286 # symbolize options and strip_path_prefix)
287 export ASAN_OPTIONS
=redzone
=16:handle_sigill
=1:strict_string_check
=1:\
288 allocator_release_to_os_interval_ms
=500:strict_memcmp
=1:detect_container_overflow
=1:\
289 coverage
=0:allocator_may_return_null
=1:use_sigaltstack
=1:detect_stack_use_after_return
=1:\
290 alloc_dealloc_mismatch
=0:detect_leaks
=1:print_scariness
=1:max_uar_stack_size_log
=16:\
291 handle_abort
=1:check_malloc_usable_size
=0:quarantine_size_mb
=10:detect_odr_violation
=0:\
292 symbolize
=1:handle_segv
=1:fast_unwind_on_fatal
=0:external_symbolizer_path
=/usr
/bin
/llvm-symbolizer-3.5
300 CONFIG
="--disable-defaults"
304 echo "$0: unknown test $TEST" >&2
309 if test "$1" = "deps"; then
310 case "$TRAVIS_OS_NAME" in
312 sudo apt-get update
-qq && \
313 sudo apt-get
install -qq bison flex gperf
gettext $DEPS
317 # workaround for issue #6352
318 brew uninstall
--force libtool
&& brew
install libtool
&& \
325 if test "$1" = "pydeps"; then
326 test -z "$PYDEPS" || pip
-q install --user $PYDEPS
331 --disable-dependency-tracking
332 --enable-silent-rules
333 --enable-test-vectors
334 --enable-monolithic=${MONOLITHIC-no}
335 --enable-leak-detective=${LEAK_DETECTIVE-no}"
337 echo "$ ./autogen.sh"
338 .
/autogen.sh ||
exit $?
339 echo "$ CC=$CC CFLAGS=\"$CFLAGS\" ./configure $CONFIG"
340 CC
="$CC" CFLAGS
="$CFLAGS" .
/configure
$CONFIG ||
exit $?
350 echo "$ make $TARGET"
353 # without target, coverage is currently not supported anyway because
354 # sonarqube only supports gcov, not lcov
355 build-wrapper-linux-x86-64
--out-dir bw-output
make -j4 ||
exit $?
358 make -j4 $TARGET ||
exit $?
364 if test -s make.warnings
; then
372 -Dsonar.projectKey
=strongswan \
373 -Dsonar.projectVersion
=$
(git describe
)+${TRAVIS_BUILD_NUMBER} \
375 -Dsonar.cfamily.threads
=2 \
376 -Dsonar.cfamily.build-wrapper-output
=bw-output ||
exit $?
377 rm -r bw-output .scannerwork
383 # ensure there are no unignored build artifacts (or other changes) in the Git repo
384 unclean
="$(git status --porcelain)"
385 if test -n "$unclean"; then
386 echo "Unignored build artifacts or other changes:"