application-services/libs/build-all.sh

93 строки
2.7 KiB
Bash
Исходник Обычный вид История

#!/usr/bin/env bash
set -euvx
2018-12-14 21:19:11 +03:00
OPENSSL_VERSION="1.1.1a"
OPENSSL_SHA256="fc20130f8b7cbd2fb918b2f14e2f429e109c31ddd0fb38fc5d71d9ffed3f9f41"
2019-04-22 21:22:34 +03:00
SQLCIPHER_VERSION="4.1.0"
SQLCIPHER_SHA256="65144ca3ba4c0f9cd4bae8c20bb42f2b84424bf29d1ebcf04c44a728903b1faa"
2019-03-27 00:35:50 +03:00
NSS="nss-3.43"
NSS_ARCHIVE="nss-3.43-with-nspr-4.21.tar.gz"
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"
# End of configuration.
if [ "${#}" -ne 1 ]
then
echo "Usage:"
2018-05-28 21:44:34 +03:00
echo "./build-all.sh [ios|android|desktop]"
exit 1
fi
PLATFORM="${1}"
abspath () { case "${1}" in /*)printf "%s\\n" "${1}";; *)printf "%s\\n" "${PWD}/${1}";; esac; }
export -f abspath
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"
else
echo "Using ${OPENSSL}.tar.gz"
fi
echo "${OPENSSL_SHA256} ${OPENSSL}.tar.gz" | shasum -a 256 -c - || exit 2
tar xfz "${OPENSSL}.tar.gz"
OPENSSL_SRC_PATH=$(abspath ${OPENSSL})
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"
else
echo "Using ${SQLCIPHER}.tar.gz"
fi
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
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
echo "Using ${NSS_ARCHIVE}"
2019-03-27 00:35:50 +03:00
fi
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}"
if [ "${PLATFORM}" == "ios" ]
then
./build-all-ios.sh "${OPENSSL_SRC_PATH}" "${SQLCIPHER_SRC_PATH}" "${NSS_SRC_PATH}"
elif [ "${PLATFORM}" == "android" ]
then
./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
./build-nss-desktop.sh "${NSS_SRC_PATH}"
./build-openssl-desktop.sh "${OPENSSL_SRC_PATH}"
./build-sqlcipher-desktop.sh "${SQLCIPHER_SRC_PATH}"
elif [ "${PLATFORM}" == "darwin" -o "${PLATFORM}" == "win32-x86-64" ]
then
./build-nss-desktop.sh "${NSS_SRC_PATH}" "${PLATFORM}"
./build-openssl-desktop.sh "${OPENSSL_SRC_PATH}" "${PLATFORM}"
./build-sqlcipher-desktop.sh "${SQLCIPHER_SRC_PATH}" "${PLATFORM}"
else
echo "Unrecognized platform"
exit 1
fi
echo "Cleaning up"
rm -rf "${OPENSSL_SRC_PATH}"
rm -rf "${SQLCIPHER_SRC_PATH}"
rm -rf "${NSS_SRC_PATH}"
echo "Done"