2018-08-20 20:17:35 +03:00
|
|
|
#!/usr/bin/env bash
|
2018-05-25 23:39:00 +03:00
|
|
|
|
2018-08-04 02:25:10 +03:00
|
|
|
set -euvx
|
2018-05-25 23:39:00 +03:00
|
|
|
|
2018-12-14 21:19:11 +03:00
|
|
|
OPENSSL_VERSION="1.1.1a"
|
|
|
|
OPENSSL_SHA256="fc20130f8b7cbd2fb918b2f14e2f429e109c31ddd0fb38fc5d71d9ffed3f9f41"
|
2018-08-04 02:26:45 +03:00
|
|
|
|
2019-04-22 21:22:34 +03:00
|
|
|
SQLCIPHER_VERSION="4.1.0"
|
|
|
|
SQLCIPHER_SHA256="65144ca3ba4c0f9cd4bae8c20bb42f2b84424bf29d1ebcf04c44a728903b1faa"
|
2018-05-25 23:39:00 +03:00
|
|
|
|
2019-03-27 00:35:50 +03:00
|
|
|
NSS="nss-3.43"
|
|
|
|
NSS_ARCHIVE="nss-3.43-with-nspr-4.21.tar.gz"
|
2019-04-11 18:04:58 +03:00
|
|
|
NSS_URL="http://ftp.mozilla.org/pub/security/nss/releases/NSS_3_43_RTM/src/${NSS_ARCHIVE}"
|
2019-03-27 00:35:50 +03:00
|
|
|
NSS_SHA256="fb2d54d507ceb185bac73f492cce7086a462d41977c2378aba9dd10e04448cf3"
|
|
|
|
|
2018-05-25 23:39:00 +03:00
|
|
|
# End of configuration.
|
|
|
|
|
2019-05-29 23:12:28 +03:00
|
|
|
if [ ! -f "$(pwd)/build-all.sh" ]
|
|
|
|
then
|
|
|
|
echo "build-all.sh must be executed from within the libs/ directory."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-04-11 18:04:58 +03:00
|
|
|
if [ "${#}" -ne 1 ]
|
2018-05-25 23:39:00 +03:00
|
|
|
then
|
|
|
|
echo "Usage:"
|
2018-05-28 21:44:34 +03:00
|
|
|
echo "./build-all.sh [ios|android|desktop]"
|
2018-05-25 23:39:00 +03:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-04-11 18:04:58 +03:00
|
|
|
PLATFORM="${1}"
|
2018-05-25 23:39:00 +03:00
|
|
|
|
2019-04-11 18:04:58 +03:00
|
|
|
abspath () { case "${1}" in /*)printf "%s\\n" "${1}";; *)printf "%s\\n" "${PWD}/${1}";; esac; }
|
2018-05-25 23:39:00 +03:00
|
|
|
export -f abspath
|
|
|
|
|
2019-04-11 18:04:58 +03:00
|
|
|
OPENSSL="openssl-${OPENSSL_VERSION}"
|
|
|
|
rm -rf "${OPENSSL}"
|
|
|
|
if [ ! -e "${OPENSSL}.tar.gz" ]; then
|
|
|
|
echo "Downloading ${OPENSSL}.tar.gz"
|
|
|
|
curl -L -O "https://www.openssl.org/source/${OPENSSL}.tar.gz"
|
2018-05-25 23:39:00 +03:00
|
|
|
else
|
2019-04-11 18:04:58 +03:00
|
|
|
echo "Using ${OPENSSL}.tar.gz"
|
2018-05-25 23:39:00 +03:00
|
|
|
fi
|
2019-04-11 18:04:58 +03:00
|
|
|
echo "${OPENSSL_SHA256} ${OPENSSL}.tar.gz" | shasum -a 256 -c - || exit 2
|
|
|
|
tar xfz "${OPENSSL}.tar.gz"
|
|
|
|
OPENSSL_SRC_PATH=$(abspath ${OPENSSL})
|
2018-05-25 23:39:00 +03:00
|
|
|
|
2019-04-11 18:04:58 +03:00
|
|
|
SQLCIPHER="v${SQLCIPHER_VERSION}"
|
|
|
|
rm -rf "${SQLCIPHER}"
|
|
|
|
if [ ! -e "${SQLCIPHER}.tar.gz" ]; then
|
|
|
|
echo "Downloading ${SQLCIPHER}.tar.gz"
|
|
|
|
curl -L -O "https://github.com/sqlcipher/sqlcipher/archive/${SQLCIPHER}.tar.gz"
|
2018-08-04 02:26:45 +03:00
|
|
|
else
|
2019-04-11 18:04:58 +03:00
|
|
|
echo "Using ${SQLCIPHER}.tar.gz"
|
2018-08-04 02:26:45 +03:00
|
|
|
fi
|
2019-04-11 18:04:58 +03:00
|
|
|
echo "${SQLCIPHER_SHA256} ${SQLCIPHER}.tar.gz" | shasum -a 256 -c - || exit 2
|
|
|
|
tar xfz "${SQLCIPHER}.tar.gz"
|
|
|
|
SQLCIPHER_SRC_PATH=$(abspath "sqlcipher-${SQLCIPHER_VERSION}")
|
2019-03-27 00:35:50 +03:00
|
|
|
|
2019-04-11 18:04:58 +03:00
|
|
|
rm -rf "${NSS}"
|
|
|
|
if [ ! -e "${NSS_ARCHIVE}" ]; then
|
|
|
|
echo "Downloading ${NSS_ARCHIVE}"
|
|
|
|
curl -L -O "${NSS_URL}"
|
2019-03-27 00:35:50 +03:00
|
|
|
else
|
2019-04-11 18:04:58 +03:00
|
|
|
echo "Using ${NSS_ARCHIVE}"
|
2019-03-27 00:35:50 +03:00
|
|
|
fi
|
2019-04-11 18:04:58 +03:00
|
|
|
echo "${NSS_SHA256} ${NSS_ARCHIVE}" | shasum -a 256 -c - || exit 2
|
|
|
|
tar xfz "${NSS_ARCHIVE}"
|
|
|
|
NSS_SRC_PATH=$(abspath "${NSS}")
|
2019-03-27 00:35:50 +03:00
|
|
|
./patch-nss-src.sh "${NSS_SRC_PATH}"
|
2018-08-04 02:26:45 +03:00
|
|
|
|
2019-04-11 18:04:58 +03:00
|
|
|
if [ "${PLATFORM}" == "ios" ]
|
2018-05-25 23:39:00 +03:00
|
|
|
then
|
2019-04-11 18:04:58 +03:00
|
|
|
./build-all-ios.sh "${OPENSSL_SRC_PATH}" "${SQLCIPHER_SRC_PATH}" "${NSS_SRC_PATH}"
|
|
|
|
elif [ "${PLATFORM}" == "android" ]
|
2018-05-25 23:39:00 +03:00
|
|
|
then
|
2019-04-11 18:04:58 +03:00
|
|
|
./build-all-android.sh "${OPENSSL_SRC_PATH}" "${SQLCIPHER_SRC_PATH}" "${NSS_SRC_PATH}"
|
|
|
|
elif [ "${PLATFORM}" == "desktop" ]
|
2018-05-28 21:44:34 +03:00
|
|
|
then
|
2019-04-11 18:04:58 +03:00
|
|
|
./build-nss-desktop.sh "${NSS_SRC_PATH}"
|
|
|
|
./build-openssl-desktop.sh "${OPENSSL_SRC_PATH}"
|
|
|
|
./build-sqlcipher-desktop.sh "${SQLCIPHER_SRC_PATH}"
|
2019-05-30 01:52:59 +03:00
|
|
|
elif [ "${PLATFORM}" == "darwin" ] || [ "${PLATFORM}" == "win32-x86-64" ]
|
2018-11-02 06:40:29 +03:00
|
|
|
then
|
2019-04-11 18:04:58 +03:00
|
|
|
./build-nss-desktop.sh "${NSS_SRC_PATH}" "${PLATFORM}"
|
|
|
|
./build-openssl-desktop.sh "${OPENSSL_SRC_PATH}" "${PLATFORM}"
|
|
|
|
./build-sqlcipher-desktop.sh "${SQLCIPHER_SRC_PATH}" "${PLATFORM}"
|
2018-05-25 23:39:00 +03:00
|
|
|
else
|
|
|
|
echo "Unrecognized platform"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Cleaning up"
|
2019-04-11 18:04:58 +03:00
|
|
|
rm -rf "${OPENSSL_SRC_PATH}"
|
|
|
|
rm -rf "${SQLCIPHER_SRC_PATH}"
|
|
|
|
rm -rf "${NSS_SRC_PATH}"
|
2018-05-25 23:39:00 +03:00
|
|
|
|
|
|
|
echo "Done"
|