cake_wallet/scripts/android/build_openssl.sh

55 lines
1.4 KiB
Bash
Raw Normal View History

2021-08-31 09:27:30 +00:00
#!/bin/sh
2021-03-16 18:18:54 +00:00
2024-05-02 20:47:20 +00:00
set -e -x
2022-03-31 12:37:50 +00:00
2021-08-31 09:27:30 +00:00
. ./config.sh
OPENSSL_FILENAME=openssl-1.1.1q.tar.gz
2021-03-16 18:18:54 +00:00
OPENSSL_FILE_PATH=$WORKDIR/$OPENSSL_FILENAME
OPENSSL_SRC_DIR=$WORKDIR/openssl-1.1.1q
OPENSSL_SHA256="d7939ce614029cdff0b6c20f0e2e5703158a489a72b2507b8bd51bf8c8fd10ca"
2022-03-31 12:37:50 +00:00
ZLIB_DIR=$WORKDIR/zlib
ZLIB_TAG=v1.2.11
ZLIB_COMMIT_HASH="cacf7f1d4e3d44d871b605da3b647f07d718623f"
2022-04-01 08:58:46 +00:00
rm -rf $ZLIB_DIR
git clone -b $ZLIB_TAG --depth 1 https://github.com/madler/zlib $ZLIB_DIR
2022-03-31 12:37:50 +00:00
cd $ZLIB_DIR
git reset --hard $ZLIB_COMMIT_HASH
2021-03-16 18:18:54 +00:00
CC=clang CXX=clang++ ./configure --static
make
2021-08-31 09:27:30 +00:00
curl https://www.openssl.org/source/$OPENSSL_FILENAME -o $OPENSSL_FILE_PATH
echo $OPENSSL_SHA256 $OPENSSL_FILE_PATH | sha256sum -c - || exit 1
2021-03-16 18:18:54 +00:00
for arch in "aarch" "aarch64" "i686" "x86_64"
do
PREFIX=$WORKDIR/prefix_${arch}
2024-05-02 20:47:20 +00:00
TOOLCHAIN=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64
2021-12-29 20:12:54 +00:00
PATH="${TOOLCHAIN}/bin:${ORIGINAL_PATH}"
2021-03-16 18:18:54 +00:00
case $arch in
2021-12-29 20:12:54 +00:00
"aarch") X_ARCH="android-arm";;
"aarch64") X_ARCH="android-arm64";;
"i686") X_ARCH="android-x86";;
"x86_64") X_ARCH="android-x86_64";;
*) X_ARCH="android-${arch}";;
2021-08-31 09:27:30 +00:00
esac
2021-03-16 18:18:54 +00:00
cd $WORKDIR
rm -rf $OPENSSL_SRC_DIR
tar -xzf $OPENSSL_FILE_PATH -C $WORKDIR
cd $OPENSSL_SRC_DIR
2021-12-29 20:12:54 +00:00
CC=clang ANDROID_NDK=$TOOLCHAIN \
./Configure ${X_ARCH} \
no-shared no-tests \
2021-08-31 09:27:30 +00:00
--with-zlib-include=${PREFIX}/include \
--with-zlib-lib=${PREFIX}/lib \
--prefix=${PREFIX} \
--openssldir=${PREFIX} \
2021-12-29 20:12:54 +00:00
-D__ANDROID_API__=$API
make -j$THREADS
make -j$THREADS install_sw
2021-03-16 18:18:54 +00:00
done