diff --git a/scripts/android/build_monero.sh b/scripts/android/build_monero.sh deleted file mode 100755 index fb596e452..000000000 --- a/scripts/android/build_monero.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh - -. ./config.sh -MONERO_BRANCH=release-v0.18.3.2-android -MONERO_SRC_DIR=${WORKDIR}/monero - -git clone https://github.com/cake-tech/monero.git ${MONERO_SRC_DIR} --branch ${MONERO_BRANCH} -cd $MONERO_SRC_DIR -git submodule update --init --force - -for arch in "aarch" "aarch64" "i686" "x86_64" -do -FLAGS="" -PREFIX=${WORKDIR}/prefix_${arch} -DEST_LIB_DIR=${PREFIX}/lib/monero -DEST_INCLUDE_DIR=${PREFIX}/include/monero -export CMAKE_INCLUDE_PATH="${PREFIX}/include" -export CMAKE_LIBRARY_PATH="${PREFIX}/lib" -ANDROID_STANDALONE_TOOLCHAIN_PATH="${TOOLCHAIN_BASE_DIR}_${arch}" -PATH="${ANDROID_STANDALONE_TOOLCHAIN_PATH}/bin:${ORIGINAL_PATH}" - -mkdir -p $DEST_LIB_DIR -mkdir -p $DEST_INCLUDE_DIR - -case $arch in - "aarch" ) - CLANG=arm-linux-androideabi-clang - CXXLANG=arm-linux-androideabi-clang++ - BUILD_64=OFF - TAG="android-armv7" - ARCH="armv7-a" - ARCH_ABI="armeabi-v7a" - FLAGS="-D CMAKE_ANDROID_ARM_MODE=ON -D NO_AES=true";; - "aarch64" ) - CLANG=aarch64-linux-androideabi-clang - CXXLANG=aarch64-linux-androideabi-clang++ - BUILD_64=ON - TAG="android-armv8" - ARCH="armv8-a" - ARCH_ABI="arm64-v8a";; - "i686" ) - CLANG=i686-linux-androideabi-clang - CXXLANG=i686-linux-androideabi-clang++ - BUILD_64=OFF - TAG="android-x86" - ARCH="i686" - ARCH_ABI="x86";; - "x86_64" ) - CLANG=x86_64-linux-androideabi-clang - CXXLANG=x86_64-linux-androideabi-clang++ - BUILD_64=ON - TAG="android-x86_64" - ARCH="x86-64" - ARCH_ABI="x86_64";; -esac - -cd $MONERO_SRC_DIR -rm -rf ./build/release -mkdir -p ./build/release -cd ./build/release -CC=${CLANG} CXX=${CXXLANG} cmake -D USE_DEVICE_TREZOR=OFF -D BUILD_GUI_DEPS=1 -D BUILD_TESTS=OFF -D ARCH=${ARCH} -D STATIC=ON -D BUILD_64=${BUILD_64} -D CMAKE_BUILD_TYPE=release -D ANDROID=true -D INSTALL_VENDORED_LIBUNBOUND=ON -D BUILD_TAG=${TAG} -D CMAKE_SYSTEM_NAME="Android" -D CMAKE_ANDROID_STANDALONE_TOOLCHAIN="${ANDROID_STANDALONE_TOOLCHAIN_PATH}" -D CMAKE_ANDROID_ARCH_ABI=${ARCH_ABI} -D MANUAL_SUBMODULES=1 $FLAGS ../.. - -make wallet_api -j$THREADS -find . -path ./lib -prune -o -name '*.a' -exec cp '{}' lib \; - -cp -r ./lib/* $DEST_LIB_DIR -cp ../../src/wallet/api/wallet2_api.h $DEST_INCLUDE_DIR -done diff --git a/scripts/android/build_monero_all.sh b/scripts/android/build_monero_all.sh index 69ec37b5f..f683d5d27 100755 --- a/scripts/android/build_monero_all.sh +++ b/scripts/android/build_monero_all.sh @@ -1,9 +1,48 @@ #!/bin/bash -./build_iconv.sh -./build_boost.sh -./build_openssl.sh -./build_sodium.sh -./build_unbound.sh -./build_zmq.sh -./build_monero.sh +# 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 + +# 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 + # ./build_single.sh ${COIN} i686-linux-android $NPROC + ./build_single.sh ${COIN} arm-linux-androideabi $NPROC + ./build_single.sh ${COIN} aarch64-linux-android $NPROC + popd + done +fi + +unxz -f ../monero_c/release/monero/x86_64-linux-android_libwallet2_api_c.so.xz +unxz -f ../monero_c/release/wownero/x86_64-linux-android_libwallet2_api_c.so.xz +unxz -f ../monero_c/release/monero/arm-linux-androideabi_libwallet2_api_c.so.xz +unxz -f ../monero_c/release/wownero/arm-linux-androideabi_libwallet2_api_c.so.xz +unxz -f ../monero_c/release/monero/aarch64-linux-android_libwallet2_api_c.so.xz +unxz -f ../monero_c/release/wownero/aarch64-linux-android_libwallet2_api_c.so.xz \ No newline at end of file diff --git a/scripts/prepare_moneroc.sh b/scripts/prepare_moneroc.sh new file mode 100755 index 000000000..0ae270588 --- /dev/null +++ b/scripts/prepare_moneroc.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +set -x -e + +cd "$(dirname "$0")" + + + +if [[ ! -d "monero_c" ]]; +then + git clone https://github.com/mrcyjanek/monero_c --branch rewrite-wip + cd monero_c + git checkout cd90f3bcd0349759030751ec7ce84eec6ee80c43 + git reset --hard + git submodule update --init --force --recursive + ./apply_patches.sh monero + ./apply_patches.sh wownero +else + cd monero_c +fi + +if [[ ! -f "monero/.patch-applied" ]]; +then + ./apply_patches.sh monero +fi + +if [[ ! -f "wownero/.patch-applied" ]]; +then + ./apply_patches.sh wownero +fi +cd .. + +echo "monero_c source prepared".