2014-11-02 17:33:23 -08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2015-08-16 18:56:24 +01:00
|
|
|
set -x
|
2016-05-04 22:05:40 +02:00
|
|
|
set -e
|
2015-08-16 18:56:24 +01:00
|
|
|
|
2020-05-05 12:16:19 +01:00
|
|
|
if [ $BUILD_TYPE = "default" ]; then
|
2015-08-16 18:46:03 +01:00
|
|
|
mkdir tmp
|
|
|
|
BUILD_PREFIX=$PWD/tmp
|
|
|
|
|
|
|
|
CONFIG_OPTS=()
|
2017-05-01 16:11:16 +01:00
|
|
|
CONFIG_OPTS+=("CFLAGS=-g")
|
2015-08-16 18:46:03 +01:00
|
|
|
CONFIG_OPTS+=("CPPFLAGS=-I${BUILD_PREFIX}/include")
|
2017-05-01 16:11:16 +01:00
|
|
|
CONFIG_OPTS+=("CXXFLAGS=-g")
|
2015-08-16 18:46:03 +01: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 22:30:37 +01:00
|
|
|
CHECK="distcheck"
|
2015-08-16 18:46:03 +01:00
|
|
|
|
2020-05-05 12:16:19 +01:00
|
|
|
if [ -n "$ADDRESS_SANITIZER" ] && [ "$ADDRESS_SANITIZER" = "enabled" ]; then
|
2017-05-01 18:06:45 +01:00
|
|
|
CONFIG_OPTS+=("--enable-address-sanitizer=yes")
|
2020-05-04 22:30:37 +01: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 15:22:50 +01:00
|
|
|
fi
|
|
|
|
|
2020-05-05 12:16:19 +01:00
|
|
|
if [ "$USE_NSS" = "yes" ]; then
|
2019-09-11 13:21:36 +03:00
|
|
|
CONFIG_OPTS+=("--with-nss")
|
|
|
|
fi
|
|
|
|
|
2020-05-05 12:16:19 +01:00
|
|
|
if [ -z "$CURVE" ]; then
|
2016-02-11 22:06:33 +00:00
|
|
|
CONFIG_OPTS+=("--disable-curve")
|
2020-05-05 12:16:19 +01:00
|
|
|
elif [ "$CURVE" = "libsodium" ]; then
|
2016-02-11 22:06:33 +00:00
|
|
|
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 12:29:24 +01:00
|
|
|
( cd libsodium; ./autogen.sh; ./configure --prefix=$BUILD_PREFIX; make install)
|
2016-12-26 21:50:38 +01:00
|
|
|
fi
|
2016-02-11 22:06:33 +00:00
|
|
|
fi
|
|
|
|
|
2020-05-05 12:16:19 +01:00
|
|
|
if [ -n "$GSSAPI" ] && [ "$GSSAPI" = "enabled" ]; then
|
2017-08-19 17:51:54 +01:00
|
|
|
CONFIG_OPTS+=("--with-libgssapi_krb5=yes")
|
|
|
|
fi
|
|
|
|
|
2020-05-05 12:16:19 +01:00
|
|
|
if [ -n "$PGM" ] && [ "$PGM" = "enabled" ]; then
|
2017-08-19 17:54:42 +01:00
|
|
|
CONFIG_OPTS+=("--with-pgm=yes")
|
|
|
|
fi
|
|
|
|
|
2020-05-05 12:16:19 +01:00
|
|
|
if [ -n "$NORM" ] && [ "$NORM" = "enabled" ]; then
|
2017-10-17 11:17:13 +01:00
|
|
|
CONFIG_OPTS+=("--with-norm=yes")
|
|
|
|
fi
|
|
|
|
|
2020-05-05 12:16:19 +01:00
|
|
|
if [ -n "$TIPC" ] && [ "$TIPC" = "enabled" ]; then
|
2018-03-09 16:47:42 +00:00
|
|
|
sudo modprobe tipc
|
|
|
|
fi
|
|
|
|
|
2018-02-12 08:01:03 +00:00
|
|
|
if [ -n "$POLLER" ]; then
|
|
|
|
CONFIG_OPTS+=("--with-poller=${POLLER}")
|
|
|
|
fi
|
|
|
|
|
2020-05-05 12:16:19 +01:00
|
|
|
if [ -n "$TLS" ] && [ "$TLS" = "enabled" ]; then
|
2019-09-29 18:30:37 +03:00
|
|
|
CONFIG_OPTS+=("--with-tls=yes")
|
|
|
|
fi
|
|
|
|
|
2020-05-05 12:16:19 +01:00
|
|
|
if [ -z "$DRAFT" ] || [ "$DRAFT" = "disabled" ]; then
|
2016-05-02 21:57:42 +01:00
|
|
|
CONFIG_OPTS+=("--enable-drafts=no")
|
2020-05-05 12:16:19 +01:00
|
|
|
elif [ "$DRAFT" = "enabled" ]; then
|
2016-05-02 21:57:42 +01:00
|
|
|
CONFIG_OPTS+=("--enable-drafts=yes")
|
|
|
|
fi
|
|
|
|
|
2020-05-05 12:16:19 +01:00
|
|
|
if [ -n "$FORCE_98" ] && [ "$FORCE_98" = "enabled" ]; then
|
2018-11-09 18:54:46 +00:00
|
|
|
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 20:12:10 +00:00
|
|
|
./configure "${CONFIG_OPTS[@]}" &&
|
2016-03-06 18:05:28 +00:00
|
|
|
export DISTCHECK_CONFIGURE_FLAGS="${CONFIG_OPTS[@]}" &&
|
2020-05-04 22:30:37 +01:00
|
|
|
make VERBOSE=1 -j5 ${CHECK}
|
2015-11-25 09:17:53 +01:00
|
|
|
) || exit 1
|
2014-11-02 17:33:23 -08:00
|
|
|
else
|
|
|
|
cd ./builds/${BUILD_TYPE} && ./ci_build.sh
|
|
|
|
fi
|