aboutsummaryrefslogtreecommitdiff
path: root/test/build_openssl.sh
diff options
context:
space:
mode:
Diffstat (limited to 'test/build_openssl.sh')
-rwxr-xr-xtest/build_openssl.sh55
1 files changed, 55 insertions, 0 deletions
diff --git a/test/build_openssl.sh b/test/build_openssl.sh
new file mode 100755
index 00000000..124eabc9
--- /dev/null
+++ b/test/build_openssl.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+set -e
+
+if [ -d ~/openssl ]; then
+ exit 0
+fi
+
+case "${LIBRARY}" in
+"libressl")
+ URL1="http://ftp3.usa.openbsd.org/pub/OpenBSD/LibreSSL/libressl-${VERSION}.tar.gz"
+ URL2="http://ftp.eu.openbsd.org/pub/OpenBSD/LibreSSL/libressl-${VERSION}.tar.gz"
+ ;;
+"openssl")
+ URL1="https://openssl.org/source/openssl-${VERSION}.tar.gz"
+ URL2="http://mirrors.ibiblio.org/openssl/source/openssl-${VERSION}.tar.gz"
+ ;;
+esac
+
+case "${TARGET}" in
+"x86_64-unknown-linux-gnu")
+ OS_COMPILER=linux-x86_64
+ ;;
+"i686-unknown-linux-gnu")
+ OS_COMPILER=linux-elf
+ OS_FLAGS=-m32
+ ;;
+"arm-unknown-linux-gnueabihf")
+ OS_COMPILER=linux-armv4
+ export AR=arm-linux-gnueabihf-ar
+ export CC=arm-linux-gnueabihf-gcc
+ ;;
+esac
+
+mkdir -p /tmp/build
+cd /tmp/build
+
+OUT=/tmp/openssl.tgz
+MAX_REDIRECTS=5
+curl -o ${OUT} -L --max-redirs ${MAX_REDIRECTS} ${URL1} \
+ || curl -o ${OUT} -L --max-redirs ${MAX_REDIRECTS} ${URL2}
+
+tar --strip-components=1 -xzf ${OUT}
+
+PREFIX=${HOME}/openssl
+case "${LIBRARY}" in
+"openssl")
+ ./Configure --prefix=${PREFIX} ${OS_COMPILER} -fPIC ${OS_FLAGS} no-shared
+ ;;
+"libressl")
+ ./configure --prefix=${PREFIX} --disable-shared --with-pic
+ ;;
+esac
+
+make -j$(nproc)
+make install