cake_wallet/scripts/android/build_monero_all.sh
2024-06-05 13:58:05 +02:00

63 lines
3 KiB
Bash
Executable file

#!/bin/bash
# Usage: env USE_DOCKER= ./build_all.sh
set -x -e
cd "$(dirname "$0")"
NPROC="-j$(nproc)"
if [[ "x$(uname)" == "xDarwin" ]];
then
USE_DOCKER="ON"
NPROC="-j1"
fi
../prepare_moneroc.sh
if [[ ! "x$RUNNER_OS" == "x" ]];
then
REMOVE_CACHES=ON
fi
# NOTE: -j1 is intentional. Otherwise you will run into weird behaviour on macos
if [[ ! "x$USE_DOCKER" == "x" ]];
then
for COIN in monero;
do
pushd ../monero_c
docker run --platform linux/amd64 -v$HOME/.cache/ccache:/root/.ccache -v$PWD:$PWD -w $PWD --rm -it git.mrcyjanek.net/mrcyjanek/debian:buster bash -c "git config --global --add safe.directory '*'; apt update; apt install -y ccache gcc g++ libtinfo5 gperf; ./build_single.sh ${COIN} x86_64-linux-android $NPROC"
# docker run --platform linux/amd64 -v$PWD:$PWD -w $PWD --rm -it git.mrcyjanek.net/mrcyjanek/debian:buster bash -c "git config --global --add safe.directory '*'; apt update; apt install -y ccache gcc g++ libtinfo5 gperf; ./build_single.sh ${COIN} i686-linux-android $NPROC"
docker run --platform linux/amd64 -v$HOME/.cache/ccache:/root/.ccache -v$PWD:$PWD -w $PWD --rm -it git.mrcyjanek.net/mrcyjanek/debian:buster bash -c "git config --global --add safe.directory '*'; apt update; apt install -y ccache gcc g++ libtinfo5 gperf; ./build_single.sh ${COIN} arm-linux-androideabi $NPROC"
docker run --platform linux/amd64 -v$HOME/.cache/ccache:/root/.ccache -v$PWD:$PWD -w $PWD --rm -it git.mrcyjanek.net/mrcyjanek/debian:buster bash -c "git config --global --add safe.directory '*'; apt update; apt install -y ccache gcc g++ libtinfo5 gperf; ./build_single.sh ${COIN} aarch64-linux-android $NPROC"
popd
done
else
for COIN in monero;
do
pushd ../monero_c
./build_single.sh ${COIN} x86_64-linux-android $NPROC
[[ ! "x$REMOVE_CACHES" == "x" ]] && rm -rf monero/contrib/depends/x86_64-linux-android
# ./build_single.sh ${COIN} i686-linux-android $NPROC
# [[ ! "x$REMOVE_CACHES" == "x" ]] && rm -rf monero/contrib/depends/i686-linux-android
./build_single.sh ${COIN} arm-linux-androideabi $NPROC
[[ ! "x$REMOVE_CACHES" == "x" ]] && rm -rf monero/contrib/depends/arm-linux-androideabi
./build_single.sh ${COIN} aarch64-linux-android $NPROC
[[ ! "x$REMOVE_CACHES" == "x" ]] && rm -rf monero/contrib/depends/aarch64-linux-android
popd
done
fi
[[ ! "x$REMOVE_CACHES" == "x" ]] && rm -rf monero/contrib/depends/built
[[ ! "x$REMOVE_CACHES" == "x" ]] && rm -rf monero/contrib/depends/sources
unxz -f ../monero_c/release/monero/x86_64-linux-android_libwallet2_api_c.so.xz
unxz -f ../monero_c/release/monero/x86_64-linux-android_libc++_shared.so.xz
unxz -f ../monero_c/release/monero/arm-linux-androideabi_libwallet2_api_c.so.xz
unxz -f ../monero_c/release/monero/arm-linux-androideabi_libc++_shared.so.xz
unxz -f ../monero_c/release/monero/aarch64-linux-android_libwallet2_api_c.so.xz
unxz -f ../monero_c/release/monero/aarch64-linux-android_libc++_shared.so.xz