2019-05-03 09:31:20 +00:00
|
|
|
#!/bin/sh
|
|
|
|
set -eux
|
|
|
|
|
|
|
|
download_openssl () {
|
|
|
|
if [ ! -f "download-cache/openssl-${OPENSSL_VERSION}.tar.gz" ]; then
|
2020-04-07 18:35:49 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# OpenSSL has different links for latest and previous releases
|
|
|
|
# since we want to download several versions, let us try to treat
|
|
|
|
# current version as latest, if it fails, follow with previous
|
|
|
|
#
|
|
|
|
|
|
|
|
wget -P download-cache/ \
|
|
|
|
"https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz" || \
|
2019-05-03 09:31:20 +00:00
|
|
|
wget -P download-cache/ \
|
2020-04-07 18:35:49 +00:00
|
|
|
"https://www.openssl.org/source/old/${OPENSSL_VERSION%[a-z]}/openssl-${OPENSSL_VERSION}.tar.gz"
|
2019-05-03 09:31:20 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
build_openssl_linux () {
|
|
|
|
(
|
|
|
|
cd "openssl-${OPENSSL_VERSION}/"
|
|
|
|
./config shared --prefix="${HOME}/opt" --openssldir="${HOME}/opt" -DPURIFY
|
|
|
|
make all install_sw
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
build_openssl_osx () {
|
|
|
|
(
|
|
|
|
cd "openssl-${OPENSSL_VERSION}/"
|
|
|
|
./Configure darwin64-x86_64-cc shared \
|
|
|
|
--prefix="${HOME}/opt" --openssldir="${HOME}/opt" -DPURIFY
|
|
|
|
make depend all install_sw
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
build_openssl () {
|
|
|
|
if [ "$(cat ${HOME}/opt/.openssl-version)" != "${OPENSSL_VERSION}" ]; then
|
|
|
|
tar zxf "download-cache/openssl-${OPENSSL_VERSION}.tar.gz"
|
2020-02-11 09:36:23 +00:00
|
|
|
case `uname` in
|
|
|
|
'Darwin')
|
|
|
|
build_openssl_osx
|
|
|
|
;;
|
|
|
|
'Linux')
|
|
|
|
build_openssl_linux
|
|
|
|
;;
|
|
|
|
esac
|
2019-05-03 09:31:20 +00:00
|
|
|
echo "${OPENSSL_VERSION}" > "${HOME}/opt/.openssl-version"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
download_libressl () {
|
|
|
|
if [ ! -f "download-cache/libressl-${LIBRESSL_VERSION}.tar.gz" ]; then
|
|
|
|
wget -P download-cache/ \
|
|
|
|
"https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-${LIBRESSL_VERSION}.tar.gz"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
build_libressl () {
|
|
|
|
if [ "$(cat ${HOME}/opt/.libressl-version)" != "${LIBRESSL_VERSION}" ]; then
|
|
|
|
tar zxf "download-cache/libressl-${LIBRESSL_VERSION}.tar.gz"
|
|
|
|
(
|
|
|
|
cd "libressl-${LIBRESSL_VERSION}/"
|
|
|
|
./configure --prefix="${HOME}/opt"
|
|
|
|
make all install
|
|
|
|
)
|
|
|
|
echo "${LIBRESSL_VERSION}" > "${HOME}/opt/.libressl-version"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2019-06-04 21:16:51 +00:00
|
|
|
download_boringssl () {
|
|
|
|
if [ ! -d "download-cache/boringssl" ]; then
|
|
|
|
git clone --depth=1 https://boringssl.googlesource.com/boringssl download-cache/boringssl
|
|
|
|
else
|
|
|
|
(
|
|
|
|
cd download-cache/boringssl
|
|
|
|
git pull
|
|
|
|
)
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2019-05-03 09:31:20 +00:00
|
|
|
if [ ! -z ${LIBRESSL_VERSION+x} ]; then
|
|
|
|
download_libressl
|
|
|
|
build_libressl
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -z ${OPENSSL_VERSION+x} ]; then
|
|
|
|
download_openssl
|
|
|
|
build_openssl
|
|
|
|
fi
|
|
|
|
|
2019-05-08 20:15:59 +00:00
|
|
|
if [ ! -z ${BORINGSSL+x} ]; then
|
|
|
|
(
|
2019-09-16 11:13:10 +00:00
|
|
|
|
|
|
|
# travis-ci comes with go-1.11, while boringssl requires go-1.13
|
|
|
|
eval "$(curl -sL https://raw.githubusercontent.com/travis-ci/gimme/master/gimme | GIMME_GO_VERSION=1.13 bash)"
|
|
|
|
|
2019-06-04 21:16:51 +00:00
|
|
|
download_boringssl
|
|
|
|
cd download-cache/boringssl
|
|
|
|
if [ -d build ]; then rm -rf build; fi
|
2019-05-08 20:15:59 +00:00
|
|
|
mkdir build
|
|
|
|
cd build
|
2020-06-21 11:39:30 +00:00
|
|
|
cmake -GNinja -DCMAKE_BUILD_TYPE=release -DBUILD_SHARED_LIBS=1 ..
|
|
|
|
ninja
|
2019-05-08 20:15:59 +00:00
|
|
|
|
2020-10-11 18:42:51 +00:00
|
|
|
rm -rf ${HOME}/opt/lib || exit 0
|
|
|
|
rm -rf ${HOME}/opt/include || exit 0
|
2019-05-08 20:15:59 +00:00
|
|
|
|
2020-10-11 18:42:51 +00:00
|
|
|
mkdir -p ${HOME}/opt/lib
|
|
|
|
cp crypto/libcrypto.so ssl/libssl.so ${HOME}/opt/lib
|
2019-05-08 20:15:59 +00:00
|
|
|
|
2020-10-11 18:42:51 +00:00
|
|
|
mkdir -p ${HOME}/opt/include
|
|
|
|
cp -r ../include/* ${HOME}/opt/include
|
2019-05-08 20:15:59 +00:00
|
|
|
)
|
|
|
|
fi
|
2019-05-03 09:31:20 +00:00
|
|
|
|