aboutsummaryrefslogtreecommitdiffstats
path: root/src/scripts/ci/travis/build.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/scripts/ci/travis/build.sh')
-rwxr-xr-xsrc/scripts/ci/travis/build.sh63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/scripts/ci/travis/build.sh b/src/scripts/ci/travis/build.sh
new file mode 100755
index 000000000..369450091
--- /dev/null
+++ b/src/scripts/ci/travis/build.sh
@@ -0,0 +1,63 @@
+#!/bin/bash
+set -ev
+which shellcheck > /dev/null && shellcheck "$0" # Run shellcheck on this if available
+
+if [ "$BUILD_MODE" = "static" ]; then
+ CFG_FLAGS=(--disable-shared --via-amalgamation)
+elif [ "$BUILD_MODE" = "shared" ]; then
+ CFG_FLAGS=()
+elif [ "$BUILD_MODE" = "coverage" ]; then
+ # lcov gets confused by symlinks
+ CFG_FLAGS=(--build-mode=coverage --link-method=copy)
+elif [ "$BUILD_MODE" = "sanitizer" ]; then
+ CFG_FLAGS=(--build-mode=sanitizer)
+fi
+
+if [ "$MODULES" = "min" ]; then
+ CFG_FLAGS+=(--minimized-build --enable-modules=base)
+fi
+
+# Workaround for missing update-alternatives
+# https://github.com/travis-ci/travis-ci/issues/3668
+if [ "$CXX" = "g++" ]; then
+ export CXX="/usr/bin/g++-4.8"
+fi
+
+# enable ccache
+if [ "$TRAVIS_OS_NAME" = "linux" ]; then
+ ccache --max-size=30M
+ ccache --show-stats
+
+ export CXX="ccache $CXX"
+fi
+
+# configure
+if [ "$TARGETOS" = "ios32" ]; then
+ ./configure.py "${CFG_FLAGS[@]}" --cpu=armv7 --cc=clang \
+ --cc-abi-flags="-arch armv7 -arch armv7s -stdlib=libc++" \
+ --prefix=/tmp/botan-installation
+
+elif [ "$TARGETOS" = "ios64" ]; then
+ ./configure.py "${CFG_FLAGS[@]}" --cpu=armv8-a --cc=clang \
+ --cc-abi-flags="-arch arm64 -stdlib=libc++" \
+ --prefix=/tmp/botan-installation
+
+else
+ $CXX --version
+ ./configure.py "${CFG_FLAGS[@]}" --cc="$CC" --cc-bin="$CXX" \
+ --with-bzip2 --with-lzma --with-openssl --with-sqlite --with-zlib \
+ --prefix=/tmp/botan-installation
+fi
+
+# build
+if [ "${TARGETOS:0:3}" = "ios" ]; then
+ xcrun --sdk iphoneos make -j 2
+else
+ make -j 2
+fi
+
+if [ "$MODULES" != "min" ] && [ "${TARGETOS:0:3}" != "ios" ]; then
+ ./botan-test
+fi
+
+make install