Commit 9393f063 authored by Luca Boccassi's avatar Luca Boccassi

Problem: CI use of sodium or nacl is confusing

Solution: establish a matrix of CI options. On one axis we have the
build system (autotools, cmake, android) and on the other axis we
have the encryption options (tweetnacl, libsodium or none).
parent 05f382d2
......@@ -7,9 +7,14 @@ os:
- osx
env:
- BUILD_TYPE=default CURVE=libsodium
- BUILD_TYPE=android CURVE=libsodium
- BUILD_TYPE=cmake CURVE=libsodium
- BUILD_TYPE=default CURVE=tweetnacl
- BUILD_TYPE=android CURVE=tweetnacl
- BUILD_TYPE=cmake CURVE=tweetnacl
- BUILD_TYPE=default
- BUILD_TYPE=android
- BUILD_TYPE=libsodium
- BUILD_TYPE=cmake
sudo: false
......
......@@ -25,29 +25,40 @@ if [[ $ANDROID_BUILD_CLEAN ]]; then
rm -rf "${ANDROID_BUILD_PREFIX}"/*
fi
##
# Build libsodium from latest master branch
if [ -z $CURVE ]; then
CURVE="--disable-curve"
VERIFY="libzmq.so"
elif [ $CURVE == "libsodium" ]; then
CURVE="--with-libsodium=yes"
VERIFY="libzmq.so libsodium.so"
##
# Build libsodium from latest master branch
(android_build_verify_so "libsodium.so" &> /dev/null) || {
rm -rf "${cache}/libsodium"
(cd "${cache}" && git clone -b stable --depth 1 git://github.com/jedisct1/libsodium.git) || exit 1
(cd "${cache}/libsodium" && ./autogen.sh \
&& ./configure --quiet "${ANDROID_BUILD_OPTS[@]}" --disable-soname-versions \
&& make -j 4 \
&& make install) || exit 1
}
(android_build_verify_so "libsodium.so" &> /dev/null) || {
rm -rf "${cache}/libsodium"
(cd "${cache}" && git clone -b stable --depth 1 git://github.com/jedisct1/libsodium.git) || exit 1
(cd "${cache}/libsodium" && ./autogen.sh \
&& ./configure --quiet "${ANDROID_BUILD_OPTS[@]}" --disable-soname-versions \
&& make -j 4 \
&& make install) || exit 1
}
elif [ $CURVE == "tweetnacl" ]; then
# Default
CURVE=""
VERIFY="libzmq.so"
fi
##
# Build libzmq from local source
LIBTOOL_EXTRA_LDFLAGS='-avoid-version'
(android_build_verify_so "libzmq.so" "libsodium.so" &> /dev/null) || {
(android_build_verify_so ${VERIFY} &> /dev/null) || {
rm -rf "${cache}/libzmq"
(cp -r ../.. "${cache}/libzmq" && cd "${cache}/libzmq" && make clean)
(cd "${cache}/libzmq" && ./autogen.sh \
&& ./configure --quiet "${ANDROID_BUILD_OPTS[@]}" --without-docs --with-libsodium=yes \
&& ./configure --quiet "${ANDROID_BUILD_OPTS[@]}" ${CURVE} --without-docs \
&& make -j 4 \
&& make install) || exit 1
}
......@@ -55,5 +66,5 @@ LIBTOOL_EXTRA_LDFLAGS='-avoid-version'
##
# Verify shared libraries in prefix
android_build_verify_so "libzmq.so" "libsodium.so"
android_build_verify_so ${VERIFY}
echo "libzmq android build succeeded"
......@@ -18,5 +18,14 @@ CMAKE_OPTS+=("-DCMAKE_PREFIX_PATH:PATH=${BUILD_PREFIX}")
CMAKE_OPTS+=("-DCMAKE_LIBRARY_PATH:PATH=${BUILD_PREFIX}/lib")
CMAKE_OPTS+=("-DCMAKE_INCLUDE_PATH:PATH=${BUILD_PREFIX}/include")
if [ -z $CURVE ]; then
CMAKE_OPTS+=("-DENABLE_CURVE=OFF")
elif [ $CURVE == "libsodium" ]; then
CMAKE_OPTS+=("-DWITH_LIBSODIUM=ON")
git clone --depth 1 -b stable git://github.com/jedisct1/libsodium.git
( cd libsodium; ./autogen.sh; ./configure --prefix=$BUILD_PREFIX; make install)
fi
# Build, check, and install from local source
( cd ../..; mkdir build_cmake && cd build_cmake && PKG_CONFIG_PATH=${BUILD_PREFIX}/lib/pkgconfig cmake "${CMAKE_OPTS[@]}" .. && make all VERBOSE=1 && make install ) || exit 1
#!/usr/bin/env bash
set -x
mkdir tmp
BUILD_PREFIX=$PWD/tmp
CONFIG_OPTS=()
CONFIG_OPTS+=("CFLAGS=-I${BUILD_PREFIX}/include")
CONFIG_OPTS+=("CPPFLAGS=-I${BUILD_PREFIX}/include")
CONFIG_OPTS+=("CXXFLAGS=-I${BUILD_PREFIX}/include")
CONFIG_OPTS+=("LDFLAGS=-L${BUILD_PREFIX}/lib")
CONFIG_OPTS+=("PKG_CONFIG_PATH=${BUILD_PREFIX}/lib/pkgconfig")
CONFIG_OPTS+=("--prefix=${BUILD_PREFIX}")
# Build required projects first
# libsodium
git clone --depth 1 -b stable git://github.com/jedisct1/libsodium.git
( cd libsodium; ./autogen.sh; ./configure --prefix=$BUILD_PREFIX; make check; make install)
# Build and check this project
(
cd ../..;
./autogen.sh &&
./configure "${CONFIG_OPTS[@]}" --with-libsodium=yes &&
make &&
( if make check; then true; else cat test-suite.log; exit 1; fi ) &&
make install
) || exit 1
......@@ -14,6 +14,15 @@ if [ $BUILD_TYPE == "default" ]; then
CONFIG_OPTS+=("PKG_CONFIG_PATH=${BUILD_PREFIX}/lib/pkgconfig")
CONFIG_OPTS+=("--prefix=${BUILD_PREFIX}")
if [ -z $CURVE ]; then
CONFIG_OPTS+=("--disable-curve")
elif [ $CURVE == "libsodium" ]; then
CONFIG_OPTS+=("--with-libsodium=yes")
git clone --depth 1 -b stable git://github.com/jedisct1/libsodium.git
( cd libsodium; ./autogen.sh; ./configure --prefix=$BUILD_PREFIX; make check; make install)
fi
# Build and check this project
(
./autogen.sh &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment