From 9393f063812080a88e673c5a56905449dc6dbaf7 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Thu, 11 Feb 2016 22:06:33 +0000 Subject: [PATCH] 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). --- .travis.yml | 7 ++++++- builds/android/build.sh | 37 +++++++++++++++++++++++------------- builds/cmake/ci_build.sh | 9 +++++++++ builds/libsodium/ci_build.sh | 30 ----------------------------- ci_build.sh | 9 +++++++++ 5 files changed, 48 insertions(+), 44 deletions(-) delete mode 100755 builds/libsodium/ci_build.sh diff --git a/.travis.yml b/.travis.yml index 4d9d9a2f44..f71245618a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/builds/android/build.sh b/builds/android/build.sh index 0b94298997..9d4d70db52 100755 --- a/builds/android/build.sh +++ b/builds/android/build.sh @@ -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" diff --git a/builds/cmake/ci_build.sh b/builds/cmake/ci_build.sh index 96904ea6a1..05140fb5b2 100755 --- a/builds/cmake/ci_build.sh +++ b/builds/cmake/ci_build.sh @@ -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 diff --git a/builds/libsodium/ci_build.sh b/builds/libsodium/ci_build.sh deleted file mode 100755 index f9501cf4ef..0000000000 --- a/builds/libsodium/ci_build.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/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 diff --git a/ci_build.sh b/ci_build.sh index e8e900f43f..2e55d2e155 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -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 &&