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
|
|
|
|
2014-11-02 17:33:23 -08: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}")
|
|
|
|
|
2017-03-30 15:22:50 +01:00
|
|
|
if [ -n "$ADDRESS_SANITIZER" ] && [ "$ADDRESS_SANITIZER" == "enabled" ]; then
|
2017-05-01 18:06:45 +01:00
|
|
|
CONFIG_OPTS+=("--enable-address-sanitizer=yes")
|
2017-05-01 18:44:26 +01:00
|
|
|
CONFIG_OPTS+=("CXX=g++-6")
|
|
|
|
CONFIG_OPTS+=("CC=gcc-6")
|
|
|
|
# workaround for linker problem with ASAN options in GCC
|
|
|
|
# http://stackoverflow.com/questions/37603238/fsanitize-not-using-gold-linker-in-gcc-6-1
|
|
|
|
CONFIG_OPTS+=("LDFLAGS=-fuse-ld=gold")
|
2017-03-30 15:22:50 +01:00
|
|
|
fi
|
|
|
|
|
2016-02-11 22:06:33 +00: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 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
|
|
|
|
|
2017-08-19 17:51:54 +01:00
|
|
|
if [ -n "$GSSAPI" ] && [ "$GSSAPI" == "enabled" ]; then
|
|
|
|
CONFIG_OPTS+=("--with-libgssapi_krb5=yes")
|
|
|
|
fi
|
|
|
|
|
2017-08-19 17:54:42 +01:00
|
|
|
if [ -n "$PGM" ] && [ "$PGM" == "enabled" ]; then
|
|
|
|
CONFIG_OPTS+=("--with-pgm=yes")
|
|
|
|
fi
|
|
|
|
|
2016-05-02 21:57:42 +01:00
|
|
|
if [ -z $DRAFT ] || [ $DRAFT == "disabled" ]; then
|
|
|
|
CONFIG_OPTS+=("--enable-drafts=no")
|
|
|
|
elif [ $DRAFT == "enabled" ]; then
|
|
|
|
CONFIG_OPTS+=("--enable-drafts=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[@]}" &&
|
2017-05-01 12:30:23 +01:00
|
|
|
make VERBOSE=1 -j5 distcheck
|
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
|