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
|
|
|
|
2018-12-05 19:34:43 +03:00
|
|
|
SQLCIPHER_VERSION="4.0.0"
|
|
|
|
SQLCIPHER_SHA256="c8f5fc6d800aae6107bf23900144804db5510c2676c93fbb269e4a0700837d68"
|
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"
|
|
|
|
NSS_URL="http://ftp.mozilla.org/pub/security/nss/releases/NSS_3_43_RTM/src/$NSS_ARCHIVE"
|
|
|
|
NSS_SHA256="fb2d54d507ceb185bac73f492cce7086a462d41977c2378aba9dd10e04448cf3"
|
|
|
|
|
2018-05-25 23:39:00 +03:00
|
|
|
# End of configuration.
|
|
|
|
|
|
|
|
if [ "$#" -ne 1 ]
|
|
|
|
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
|
|
|
|
|
|
|
|
PLATFORM=$1
|
|
|
|
|
|
|
|
abspath () { case "$1" in /*)printf "%s\\n" "$1";; *)printf "%s\\n" "$PWD/$1";; esac; }
|
|
|
|
export -f abspath
|
|
|
|
|
2019-03-27 00:35:50 +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-03-27 00:35:50 +03:00
|
|
|
echo "Using $OPENSSL.tar.gz"
|
2018-05-25 23:39:00 +03:00
|
|
|
fi
|
2019-03-27 00:35:50 +03:00
|
|
|
echo "$OPENSSL_SHA256 $OPENSSL.tar.gz" | shasum -a 256 -c - || exit 2
|
|
|
|
tar xfz "$OPENSSL.tar.gz"
|
2018-05-25 23:39:00 +03:00
|
|
|
OPENSSL_SRC_PATH=$(abspath $OPENSSL)
|
|
|
|
|
2019-03-27 00:35:50 +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-03-27 00:35:50 +03:00
|
|
|
echo "Using $SQLCIPHER.tar.gz"
|
2018-08-04 02:26:45 +03:00
|
|
|
fi
|
2019-03-27 00:35:50 +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")
|
|
|
|
|
|
|
|
rm -rf "$NSS"
|
|
|
|
if [ ! -e "$NSS_ARCHIVE" ]; then
|
|
|
|
echo "Downloading $NSS_ARCHIVE"
|
|
|
|
curl -L -O "$NSS_URL"
|
|
|
|
else
|
|
|
|
echo "Using $NSS_ARCHIVE"
|
|
|
|
fi
|
|
|
|
echo "$NSS_SHA256 $NSS_ARCHIVE" | shasum -a 256 -c - || exit 2
|
|
|
|
tar xfz "$NSS_ARCHIVE"
|
|
|
|
NSS_SRC_PATH=$(abspath "$NSS")
|
|
|
|
./patch-nss-src.sh "${NSS_SRC_PATH}"
|
2018-08-04 02:26:45 +03:00
|
|
|
|
2018-05-25 23:39:00 +03:00
|
|
|
if [ "$PLATFORM" == "ios" ]
|
|
|
|
then
|
2019-03-27 00:35:50 +03:00
|
|
|
./build-all-ios.sh "$OPENSSL_SRC_PATH" "$SQLCIPHER_SRC_PATH" "$NSS_SRC_PATH"
|
2018-05-25 23:39:00 +03:00
|
|
|
elif [ "$PLATFORM" == "android" ]
|
|
|
|
then
|
2019-03-27 00:35:50 +03:00
|
|
|
./build-all-android.sh "$OPENSSL_SRC_PATH" "$SQLCIPHER_SRC_PATH" "$NSS_SRC_PATH"
|
2018-05-28 21:44:34 +03:00
|
|
|
elif [ "$PLATFORM" == "desktop" ]
|
|
|
|
then
|
2019-03-27 00:35:50 +03:00
|
|
|
./build-nss-desktop.sh "$NSS_SRC_PATH"
|
2018-09-19 02:47:27 +03:00
|
|
|
./build-openssl-desktop.sh "$OPENSSL_SRC_PATH"
|
2018-11-02 06:40:29 +03:00
|
|
|
./build-sqlcipher-desktop.sh "$SQLCIPHER_SRC_PATH"
|
2018-11-07 02:10:55 +03:00
|
|
|
elif [ "$PLATFORM" == "darwin" -o "$PLATFORM" == "win32-x86-64" ]
|
2018-11-02 06:40:29 +03:00
|
|
|
then
|
2019-03-27 00:35:50 +03:00
|
|
|
./build-nss-desktop.sh "$NSS_SRC_PATH" "$PLATFORM"
|
2018-11-07 02:10:55 +03:00
|
|
|
./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"
|
|
|
|
rm -rf "$OPENSSL_SRC_PATH"
|
2018-08-04 02:26:45 +03:00
|
|
|
rm -rf "$SQLCIPHER_SRC_PATH"
|
2019-03-27 00:35:50 +03:00
|
|
|
rm -rf "$NSS_SRC_PATH"
|
2018-05-25 23:39:00 +03:00
|
|
|
|
|
|
|
echo "Done"
|