2014-11-03 02:33:23 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2015-08-16 19:56:24 +02:00
|
|
|
set -x
|
2016-05-04 22:05:40 +02:00
|
|
|
set -e
|
2015-08-16 19:56:24 +02:00
|
|
|
|
2014-11-03 02:33:23 +01:00
|
|
|
if [ $BUILD_TYPE == "default" ]; then
|
2015-08-16 19:46:03 +02:00
|
|
|
mkdir tmp
|
|
|
|
BUILD_PREFIX=$PWD/tmp
|
|
|
|
|
|
|
|
CONFIG_OPTS=()
|
2017-05-01 17:11:16 +02:00
|
|
|
CONFIG_OPTS+=("CFLAGS=-g")
|
2015-08-16 19:46:03 +02:00
|
|
|
CONFIG_OPTS+=("CPPFLAGS=-I${BUILD_PREFIX}/include")
|
2017-05-01 17:11:16 +02:00
|
|
|
CONFIG_OPTS+=("CXXFLAGS=-g")
|
2015-08-16 19:46:03 +02:00
|
|
|
CONFIG_OPTS+=("LDFLAGS=-L${BUILD_PREFIX}/lib")
|
|
|
|
CONFIG_OPTS+=("PKG_CONFIG_PATH=${BUILD_PREFIX}/lib/pkgconfig")
|
|
|
|
CONFIG_OPTS+=("--prefix=${BUILD_PREFIX}")
|
2020-05-04 23:30:37 +02:00
|
|
|
CHECK="distcheck"
|
2015-08-16 19:46:03 +02:00
|
|
|
|
2017-03-30 16:22:50 +02:00
|
|
|
if [ -n "$ADDRESS_SANITIZER" ] && [ "$ADDRESS_SANITIZER" == "enabled" ]; then
|
2017-05-01 19:06:45 +02:00
|
|
|
CONFIG_OPTS+=("--enable-address-sanitizer=yes")
|
2020-05-04 23:30:37 +02:00
|
|
|
# distcheck does an out-of-tree build, and the fuzzer tests use a hard-coded relative path for simplicity
|
|
|
|
CHECK="check"
|
2017-03-30 16:22:50 +02:00
|
|
|
fi
|
|
|
|
|
2019-09-11 12:21:36 +02:00
|
|
|
if [ $USE_NSS == "yes" ]; then
|
|
|
|
CONFIG_OPTS+=("--with-nss")
|
|
|
|
fi
|
|
|
|
|
2016-02-11 23:06:33 +01:00
|
|
|
if [ -z $CURVE ]; then
|
|
|
|
CONFIG_OPTS+=("--disable-curve")
|
|
|
|
elif [ $CURVE == "libsodium" ]; then
|
|
|
|
CONFIG_OPTS+=("--with-libsodium=yes")
|
|
|
|
|
2016-12-27 14:45:45 +01:00
|
|
|
if ! ((command -v dpkg-query >/dev/null 2>&1 && dpkg-query --list libsodium-dev >/dev/null 2>&1) || \
|
|
|
|
(command -v brew >/dev/null 2>&1 && brew ls --versions libsodium >/dev/null 2>&1)); then
|
2016-12-26 21:50:38 +01:00
|
|
|
git clone --depth 1 -b stable git://github.com/jedisct1/libsodium.git
|
2017-05-01 13:29:24 +02:00
|
|
|
( cd libsodium; ./autogen.sh; ./configure --prefix=$BUILD_PREFIX; make install)
|
2016-12-26 21:50:38 +01:00
|
|
|
fi
|
2016-02-11 23:06:33 +01:00
|
|
|
fi
|
|
|
|
|
2017-08-19 18:51:54 +02:00
|
|
|
if [ -n "$GSSAPI" ] && [ "$GSSAPI" == "enabled" ]; then
|
|
|
|
CONFIG_OPTS+=("--with-libgssapi_krb5=yes")
|
|
|
|
fi
|
|
|
|
|
2017-08-19 18:54:42 +02:00
|
|
|
if [ -n "$PGM" ] && [ "$PGM" == "enabled" ]; then
|
|
|
|
CONFIG_OPTS+=("--with-pgm=yes")
|
|
|
|
fi
|
|
|
|
|
2017-10-17 12:17:13 +02:00
|
|
|
if [ -n "$NORM" ] && [ "$NORM" == "enabled" ]; then
|
|
|
|
CONFIG_OPTS+=("--with-norm=yes")
|
|
|
|
fi
|
|
|
|
|
2018-03-09 17:47:42 +01:00
|
|
|
if [ -n "$TIPC" ] && [ "$TIPC" == "enabled" ]; then
|
|
|
|
sudo modprobe tipc
|
|
|
|
fi
|
|
|
|
|
2018-02-12 09:01:03 +01:00
|
|
|
if [ -n "$POLLER" ]; then
|
|
|
|
CONFIG_OPTS+=("--with-poller=${POLLER}")
|
|
|
|
fi
|
|
|
|
|
2019-09-29 17:30:37 +02:00
|
|
|
if [ -n "$TLS" ] && [ "$TLS" == "enabled" ]; then
|
|
|
|
CONFIG_OPTS+=("--with-tls=yes")
|
|
|
|
fi
|
|
|
|
|
2016-05-02 22:57:42 +02:00
|
|
|
if [ -z $DRAFT ] || [ $DRAFT == "disabled" ]; then
|
|
|
|
CONFIG_OPTS+=("--enable-drafts=no")
|
|
|
|
elif [ $DRAFT == "enabled" ]; then
|
|
|
|
CONFIG_OPTS+=("--enable-drafts=yes")
|
|
|
|
fi
|
|
|
|
|
2018-11-09 19:54:46 +01:00
|
|
|
if [ -n "$FORCE_98" ] && [ "$FORCE_98" == "enabled" ]; then
|
|
|
|
CONFIG_OPTS+=("--enable-force-CXX98-compat=yes")
|
|
|
|
fi
|
|
|
|
|
2016-05-04 22:05:40 +02:00
|
|
|
# Build and check this project
|
2015-11-25 09:17:53 +01:00
|
|
|
(
|
|
|
|
./autogen.sh &&
|
2016-02-11 21:12:10 +01:00
|
|
|
./configure "${CONFIG_OPTS[@]}" &&
|
2016-03-06 19:05:28 +01:00
|
|
|
export DISTCHECK_CONFIGURE_FLAGS="${CONFIG_OPTS[@]}" &&
|
2020-05-04 23:30:37 +02:00
|
|
|
make VERBOSE=1 -j5 ${CHECK}
|
2015-11-25 09:17:53 +01:00
|
|
|
) || exit 1
|
2014-11-03 02:33:23 +01:00
|
|
|
else
|
|
|
|
cd ./builds/${BUILD_TYPE} && ./ci_build.sh
|
|
|
|
fi
|