From c3808c416d333da131c909e5bf0313d513a04780 Mon Sep 17 00:00:00 2001 From: M Date: Thu, 4 Aug 2022 14:24:28 +0100 Subject: [PATCH] Update scripts for build monero lib for ios. --- cw_monero/ios/cw_monero.podspec | 7 +++++++ ios/Podfile.lock | 6 +++++- scripts/ios/build_monero.sh | 23 ++++++++++------------- scripts/ios/build_monero_all.sh | 1 + scripts/ios/build_openssl.sh | 2 +- scripts/ios/build_unbound.sh | 27 +++++++++++++++++++++++++++ scripts/ios/setup.sh | 1 + 7 files changed, 52 insertions(+), 15 deletions(-) create mode 100755 scripts/ios/build_unbound.sh diff --git a/cw_monero/ios/cw_monero.podspec b/cw_monero/ios/cw_monero.podspec index 8262427d8..d99bba923 100644 --- a/cw_monero/ios/cw_monero.podspec +++ b/cw_monero/ios/cw_monero.podspec @@ -34,6 +34,13 @@ Pod::Spec.new do |s| sodium.xcconfig = { 'HEADER_SEARCH_PATHS' => "${PODS_ROOT}/#{s.name}/External/ios/include/**" } end + s.subspec 'Unbound' do |unbound| + unbound.preserve_paths = '../../../../../cw_shared_external/ios/External/ios/include/**/*.h' + unbound.vendored_libraries = '../../../../../cw_shared_external/ios/External/ios/lib/libunbound.a' + unbound.libraries = 'unbound' + unbound.xcconfig = { 'HEADER_SEARCH_PATHS' => "${PODS_ROOT}/#{s.name}/External/ios/include/**" } + end + s.subspec 'Boost' do |boost| boost.preserve_paths = '../../../../../cw_shared_external/ios/External/ios/include/**/*.h', boost.vendored_libraries = '../../../../../cw_shared_external/ios/External/ios/lib/libboost.a', diff --git a/ios/Podfile.lock b/ios/Podfile.lock index d527812b2..af603c115 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -32,6 +32,7 @@ PODS: - cw_monero/Monero (= 0.0.2) - cw_monero/OpenSSL (= 0.0.2) - cw_monero/Sodium (= 0.0.2) + - cw_monero/Unbound (= 0.0.2) - cw_shared_external - Flutter - cw_monero/Boost (0.0.2): @@ -46,6 +47,9 @@ PODS: - cw_monero/Sodium (0.0.2): - cw_shared_external - Flutter + - cw_monero/Unbound (0.0.2): + - cw_shared_external + - Flutter - cw_shared_external (0.0.1): - cw_shared_external/Boost (= 0.0.1) - cw_shared_external/OpenSSL (= 0.0.1) @@ -214,7 +218,7 @@ SPEC CHECKSUMS: connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467 CryptoSwift: 093499be1a94b0cae36e6c26b70870668cb56060 cw_haven: b3e54e1fbe7b8e6fda57a93206bc38f8e89b898a - cw_monero: 88c5e7aa596c6848330750f5f8bcf05fb9c66375 + cw_monero: 4cf3b96f2da8e95e2ef7d6703dd4d2c509127b7d cw_shared_external: 2972d872b8917603478117c9957dfca611845a92 device_display_brightness: 1510e72c567a1f6ce6ffe393dcd9afd1426034f7 devicelocale: b22617f40038496deffba44747101255cee005b0 diff --git a/scripts/ios/build_monero.sh b/scripts/ios/build_monero.sh index ea29c7131..1e082bfb0 100755 --- a/scripts/ios/build_monero.sh +++ b/scripts/ios/build_monero.sh @@ -4,7 +4,7 @@ MONERO_URL="https://github.com/cake-tech/monero.git" MONERO_DIR_PATH="${EXTERNAL_IOS_SOURCE_DIR}/monero" -MONERO_VERSION=release-v0.17.3.2 +MONERO_VERSION=release-v0.18.0.0 BUILD_TYPE=release PREFIX=${EXTERNAL_IOS_DIR} DEST_LIB_DIR=${EXTERNAL_IOS_LIB_DIR}/monero @@ -18,6 +18,9 @@ git submodule update --init --force mkdir -p build cd .. +mkdir -p $DEST_LIB_DIR +mkdir -p $DEST_INCLUDE_DIR + ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" if [ -z $INSTALL_PREFIX ]; then INSTALL_PREFIX=${ROOT_DIR}/monero @@ -46,20 +49,14 @@ cmake -D IOS=ON \ -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ -DSTATIC=ON \ -DBUILD_GUI_DEPS=ON \ - -DINSTALL_VENDORED_LIBUNBOUND=ON \ + -DUNBOUND_INCLUDE_DIR=${EXTERNAL_IOS_INCLUDE_DIR} \ -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \ -DUSE_DEVICE_TREZOR=OFF \ ../.. -make -j4 && make install -cp external/randomx/librandomx.a ${DEST_LIB}/ -cp src/cryptonote_basic/libcryptonote_basic.a ${DEST_LIB}/ -cp src/cryptonote_basic/libcryptonote_format_utils_basic.a ${DEST_LIB}/ +make wallet_api -j4 +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 popd -done - -#only for arm64 -mkdir -p $DEST_LIB_DIR -mkdir -p $DEST_INCLUDE_DIR -cp ${MONERO_DIR_PATH}/lib-armv8-a/* $DEST_LIB_DIR -cp ${MONERO_DIR_PATH}/include/wallet/api/* $DEST_INCLUDE_DIR +done \ No newline at end of file diff --git a/scripts/ios/build_monero_all.sh b/scripts/ios/build_monero_all.sh index 42483323d..2b61f6db0 100755 --- a/scripts/ios/build_monero_all.sh +++ b/scripts/ios/build_monero_all.sh @@ -6,4 +6,5 @@ ./build_boost.sh ./build_sodium.sh ./build_zmq.sh +./build_unbound.sh ./build_monero.sh \ No newline at end of file diff --git a/scripts/ios/build_openssl.sh b/scripts/ios/build_openssl.sh index f6f76c0dd..128ba3a54 100755 --- a/scripts/ios/build_openssl.sh +++ b/scripts/ios/build_openssl.sh @@ -10,7 +10,7 @@ echo "============================ OpenSSL ============================" echo "Cloning Open SSL from - $OPEN_SSL_URL" git clone $OPEN_SSL_URL $OPEN_SSL_DIR_PATH cd $OPEN_SSL_DIR_PATH -./build-libssl.sh --version=1.1.1k --archs="x86_64 arm64 armv7s armv7" --targets="ios64-cross-arm64" --deprecated +./build-libssl.sh --version=1.1.1q --archs="x86_64 arm64 armv7s armv7" --targets="ios64-cross-arm64" --deprecated mv ${OPEN_SSL_DIR_PATH}/include/* $EXTERNAL_IOS_INCLUDE_DIR mv ${OPEN_SSL_DIR_PATH}/lib/* $EXTERNAL_IOS_LIB_DIR \ No newline at end of file diff --git a/scripts/ios/build_unbound.sh b/scripts/ios/build_unbound.sh new file mode 100755 index 000000000..679956a27 --- /dev/null +++ b/scripts/ios/build_unbound.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +. ./config.sh + +UNBOUND_VERSION=1.13.2 +UNBOUND_HASH=0a13b547f3b92a026b5ebd0423f54c991e5718037fd9f72445817f6a040e1a83 +UNBOUND_URL="https://www.nlnetlabs.nl/downloads/unbound/unbound-${UNBOUND_VERSION}.tar.gz" +UNBOUND_DIR_PATH="${EXTERNAL_IOS_SOURCE_DIR}/unbound-${UNBOUND_VERSION}" +UNBOUND_ARCH_PATH=${EXTERNAL_IOS_SOURCE_DIR}/unbound-${UNBOUND_VERSION}.tar.gz + +echo $UNBOUND_DIR_PATH +echo "============================ Unbound ============================" +curl $UNBOUND_URL -L -o $UNBOUND_ARCH_PATH +tar -xzf $UNBOUND_ARCH_PATH -C $EXTERNAL_IOS_SOURCE_DIR +cd $UNBOUND_DIR_PATH + +export IOS_SDK=iPhone +export IOS_CPU=arm64 +export IOS_PREFIX=$EXTERNAL_IOS_DIR +export AUTOTOOLS_HOST=aarch64-apple-ios +export AUTOTOOLS_BUILD="$(./config.guess)" +source ./contrib/ios/setenv_ios.sh +./contrib/ios/install_tools.sh +./contrib/ios/install_expat.sh +./configure --build="$AUTOTOOLS_BUILD" --host="$AUTOTOOLS_HOST" --prefix="$IOS_PREFIX" --with-ssl="$IOS_PREFIX" --disable-gost --with-libexpat="$IOS_PREFIX" +make +make install \ No newline at end of file diff --git a/scripts/ios/setup.sh b/scripts/ios/setup.sh index bddfa21ed..abe8435ae 100755 --- a/scripts/ios/setup.sh +++ b/scripts/ios/setup.sh @@ -35,5 +35,6 @@ ln ./libboost.a ${CW_MONERO_EXTERNAL_LIB}/libboost.a ln ./libcrypto.a ${CW_MONERO_EXTERNAL_LIB}/libcrypto.a ln ./libssl.a ${CW_MONERO_EXTERNAL_LIB}/libssl.a ln ./libsodium.a ${CW_MONERO_EXTERNAL_LIB}/libsodium.a +ln ./libunbound.a ${CW_MONERO_EXTERNAL_LIB}/libunbound.a cp ./libmonero.a $CW_MONERO_EXTERNAL_LIB cp ../include/monero/* $CW_MONERO_EXTERNAL_INCLUDE \ No newline at end of file