Merge remote-tracking branch 'origin/main' into CAKE-360-yat

This commit is contained in:
M 2021-10-06 15:05:32 +03:00
commit c9482caa19
25 changed files with 399 additions and 131 deletions

View file

@ -91,6 +91,10 @@ add_library(cryptonote_basic STATIC IMPORTED)
set_target_properties(cryptonote_basic PROPERTIES IMPORTED_LOCATION
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/monero/libcryptonote_basic.a)
add_library(cryptonote_format_utils_basic STATIC IMPORTED)
set_target_properties(cryptonote_format_utils_basic PROPERTIES IMPORTED_LOCATION
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/monero/libcryptonote_format_utils_basic.a)
add_library(mnemonics STATIC IMPORTED)
set_target_properties(mnemonics PROPERTIES IMPORTED_LOCATION
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/monero/libmnemonics.a)
@ -189,6 +193,7 @@ target_link_libraries( cw_monero
wallet
cryptonote_core
cryptonote_basic
cryptonote_format_utils_basic
mnemonics
ringct
ringct_basic

View file

@ -8,13 +8,14 @@
#include "thread"
#include "CwWalletListener.h"
#if __APPLE__
#include "../External/android/monero/include/wallet2_api.h"
// Fix for randomx on ios
void __clear_cache(void* start, void* end) { }
#include "../External/ios/include/wallet2_api.h"
#else
#include "../External/android/x86/include/wallet2_api.h"
#endif
using namespace std::chrono_literals;
#ifdef __cplusplus
extern "C"
{

View file

@ -14,41 +14,41 @@ Pod::Spec.new do |s|
s.source_files = 'Classes/**/*'
s.public_header_files = 'Classes/**/*.h, Classes/*.h, External/ios/libs/monero/include/src/**/*.h, External/ios/libs/monero/include/contrib/**/*.h, External/ios/libs/monero/include/External/ios/**/*.h'
s.dependency 'Flutter'
s.platform = :ios, '9.0'
s.platform = :ios, '10.0'
s.swift_version = '4.0'
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS' => 'arm64', 'ENABLE_BITCODE' => 'NO' }
s.xcconfig = { 'HEADER_SEARCH_PATHS' => "${PODS_ROOT}/#{s.name}/Classes/*.h" }
s.subspec 'OpenSSL' do |openssl|
openssl.preserve_paths = 'External/ios/libs/OpenSSL/include/openssl/*.h', 'External/ios/libs/OpenSSL/include/LICENSE'
openssl.vendored_libraries = 'External/ios/libs/OpenSSL/lib/libcrypto.a', 'External/ios/libs/OpenSSL/lib/libssl.a'
openssl.preserve_paths = 'External/ios/include/*.h'
openssl.vendored_libraries = 'External/ios/lib/libcrypto.a', 'External/ios/lib/libssl.a'
openssl.libraries = 'ssl', 'crypto'
openssl.xcconfig = { 'HEADER_SEARCH_PATHS' => "${PODS_ROOT}/#{s.name}/External/ios/libs/OpenSSL/include/**" }
openssl.xcconfig = { 'HEADER_SEARCH_PATHS' => "${PODS_ROOT}/#{s.name}/External/ios/include/**" }
end
s.subspec 'Monero' do |monero|
monero.preserve_paths = 'External/ios/libs/monero/include/src/**/*.h', 'External/ios/libs/monero/include/External/ios/**/*.h', 'External/ios/libs/monero/include/contrib/**/*.h'
monero.vendored_libraries = 'External/ios/libs/monero/libs/lib-ios/*.a'
monero.libraries = 'easylogging', 'epee', 'unbound', 'wallet_merged', 'lmdb', 'randomx'
monero.xcconfig = { 'HEADER_SEARCH_PATHS' => "${PODS_ROOT}/#{s.name}/External/ios/libs/monero/include/src/**" }
monero.preserve_paths = 'External/ios/include/**/*.h'
monero.vendored_libraries = 'External/ios/lib/libeasylogging.a', 'External/ios/lib/libepee.a', 'External/ios/lib/liblmdb.a', 'External/ios/lib/librandomx.a', 'External/ios/lib/libunbound.a', 'External/ios/lib/libwallet_merged.a', 'libcryptonote_basic.a', 'libcryptonote_format_utils_basic.a'
monero.libraries = 'easylogging', 'epee', 'unbound', 'wallet_merged', 'lmdb', 'randomx', 'cryptonote_basic', 'cryptonote_format_utils_basic'
monero.xcconfig = { 'HEADER_SEARCH_PATHS' => "${PODS_ROOT}/#{s.name}/External/ios/include" }
end
s.subspec 'Boost' do |boost|
boost.preserve_paths = 'External/ios/libs/boost/include/**/*.h', 'External/ios/libs/boost/include/**/*.h'
boost.vendored_libraries = 'External/ios/libs/boost/build/libs/universal/*.a'
boost.libraries = 'boost', 'boost_wserialization', 'boost_thread', 'boost_system', 'boost_signals', 'boost_serialization', 'boost_regex', 'boost_random', 'boost_program_options', 'boost_locale', 'boost_graph', 'boost_filesystem', 'boost_date_time', 'boost_chrono'
boost.xcconfig = { 'HEADER_SEARCH_PATHS' => "${PODS_ROOT}/#{s.name}/External/ios/libs/boost/include/**" }
boost.preserve_paths = 'External/ios/include/**/*.h', 'External/ios/include/**/*.h'
boost.vendored_libraries = 'External/ios/lib/libboost_chrono.a', 'External/ios/lib/libboost_date_time.a', 'External/ios/lib/libboost_filesystem.a', 'External/ios/lib/libboost_graph.a', 'External/ios/lib/libboost_locale.a', 'External/ios/lib/libboost_program_options.a', 'External/ios/lib/libboost_random.a', 'External/ios/lib/libboost_regex.a', 'External/ios/lib/libboost_serialization.a', 'External/ios/lib/libboost_system.a', 'External/ios/lib/libboost_thread.a', 'External/ios/lib/libboost_wserialization.a'
boost.libraries = 'boost_wserialization', 'boost_thread', 'boost_system', 'boost_serialization', 'boost_regex', 'boost_random', 'boost_program_options', 'boost_locale', 'boost_graph', 'boost_filesystem', 'boost_date_time', 'boost_chrono'
boost.xcconfig = { 'HEADER_SEARCH_PATHS' => "${PODS_ROOT}/#{s.name}/External/ios/include/**" }
end
s.subspec 'Sodium' do |sodium|
sodium.preserve_paths = 'External/ios/libs/sodium/include/**/*.h'
sodium.vendored_libraries = 'External/ios/libs/sodium/lib/libsodium.a'
sodium.preserve_paths = 'External/ios/include/**/*.h'
sodium.vendored_libraries = 'External/ios/lib/libsodium.a'
sodium.libraries = 'sodium'
sodium.xcconfig = { 'HEADER_SEARCH_PATHS' => "${PODS_ROOT}/#{s.name}/External/ios/libs/sodium/include/**" }
sodium.xcconfig = { 'HEADER_SEARCH_PATHS' => "${PODS_ROOT}/#{s.name}/External/ios/include/**" }
end
s.subspec 'lmdb' do |lmdb|
lmdb.vendored_libraries = 'External/ios/libs/lmdb/liblmdb.a'
lmdb.vendored_libraries = 'External/ios/lib/liblmdb.a'
lmdb.libraries = 'lmdb'
end
end

View file

@ -165,7 +165,7 @@ SPEC CHECKSUMS:
BigInt: f668a80089607f521586bbe29513d708491ef2f7
connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467
CryptoSwift: 093499be1a94b0cae36e6c26b70870668cb56060
cw_monero: 78f369253cc913efc23db9cf6be81a11eaf40fe1
cw_monero: c79d5530b828b8013c1db421f1be8bab687f7b7e
devicelocale: b22617f40038496deffba44747101255cee005b0
DKImagePickerController: b5eb7f7a388e4643264105d648d01f727110fc3d
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179

View file

@ -362,7 +362,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 56;
CURRENT_PROJECT_VERSION = 59;
DEVELOPMENT_TEAM = 32J6BB6VUS;
ENABLE_BITCODE = NO;
EXCLUDED_SOURCE_FILE_NAMES = "";
@ -380,7 +380,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 4.2.5;
MARKETING_VERSION = 4.2.7;
PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@ -506,7 +506,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 56;
CURRENT_PROJECT_VERSION = 59;
DEVELOPMENT_TEAM = 32J6BB6VUS;
ENABLE_BITCODE = NO;
EXCLUDED_SOURCE_FILE_NAMES = "";
@ -524,7 +524,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 4.2.5;
MARKETING_VERSION = 4.2.7;
PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@ -542,7 +542,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 56;
CURRENT_PROJECT_VERSION = 59;
DEVELOPMENT_TEAM = 32J6BB6VUS;
ENABLE_BITCODE = NO;
EXCLUDED_SOURCE_FILE_NAMES = "";
@ -560,7 +560,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 4.2.5;
MARKETING_VERSION = 4.2.7;
PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";

View file

@ -123,10 +123,13 @@ class MoneroWalletService extends WalletService<
} catch (e) {
// TODO: Implement Exception for wallet list service.
if (e.toString().contains('bad_alloc') ||
if ((e.toString().contains('bad_alloc') ||
(e is WalletOpeningException &&
(e.message == 'std::bad_alloc' ||
e.message.contains('bad_alloc')))) {
e.message.contains('bad_alloc')))) ||
(e.toString().contains('does not correspond') ||
(e is WalletOpeningException &&
e.message.contains('does not correspond')))) {
await restoreOrResetWalletFiles(name);
return openWallet(name, password);
}

View file

@ -11,7 +11,7 @@ description: Cake Wallet.
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 4.2.5+60
version: 4.2.7+62
environment:
sdk: ">=2.7.0 <3.0.0"

View file

@ -1,16 +1,16 @@
# /bin/bash
#!/bin/sh
WORKDIR=/opt/android
TOOLCHAIN_BASE_DIR=${WORKDIR}/toolchain
ORIGINAL_PATH=$PATH
. ./config.sh
BOOST_SRC_DIR=$WORKDIR/boost_1_74_0
BOOST_FILENAME=boost_1_74_0.tar.bz2
BOOST_VERSION=1.74.0
for arch in "aarch" "aarch64" "i686" "x86_64"
do
PREFIX=$WORKDIR/prefix_${arch}
PATH="${TOOLCHAIN_BASE_DIR}_${arch}/bin:${ORIGINAL_PATH}"
./init_boost.sh $arch
./finish_boost.sh $arch
./init_boost.sh $arch $PREFIX $BOOST_SRC_DIR $BOOST_FILENAME $BOOST_VERSION
./finish_boost.sh $arch $PREFIX $BOOST_SRC_DIR $BOOST_SRC_DIR
done

View file

@ -1,29 +1,27 @@
# /bin/bash
#!/bin/sh
export WORKDIR=/opt/android
export ICONV_FILENAME=libiconv-1.15.tar.gz
. ./config.sh
export ICONV_FILENAME=libiconv-1.16.tar.gz
export ICONV_FILE_PATH=$WORKDIR/$ICONV_FILENAME
export ICONV_SRC_DIR=$WORKDIR/libiconv-1.15
export ICONV_SRC_DIR=$WORKDIR/libiconv-1.16
ICONV_SHA256="e6a1b1b589654277ee790cce3734f07876ac4ccfaecbee8afa0b649cf529cc04"
wget http://ftp.gnu.org/pub/gnu/libiconv/$ICONV_FILENAME -O $ICONV_FILE_PATH
ORIGINAL_PATH=$PATH
TOOLCHAIN_BASE_DIR=${WORKDIR}/toolchain
curl http://ftp.gnu.org/pub/gnu/libiconv/$ICONV_FILENAME -o $ICONV_FILE_PATH
echo $ICONV_SHA256 $ICONV_FILE_PATH | sha256sum -c - || exit 1
for arch in aarch aarch64 i686 x86_64
do
PREFIX=${WORKDIR}/prefix_${arch}
PATH="${TOOLCHAIN_BASE_DIR}_${arch}/bin:${ORIGINAL_PATH}"
case $arch in
"aarch" )
CLANG=arm-linux-androideabi-clang
CXXLANG=arm-linux-androideabi-clang++
HOST="arm-linux-android";;
CLANG=armv7a-linux-androideabi${API}-clang
CXXLANG=armv7a-linux-androideabi${API}-clang++
HOST="arm";;
* )
CLANG=${arch}-linux-android-clang
CXXLANG=${arch}-linux-android-clang++
CLANG=${arch}-linux-android${API}-clang
CXXLANG=${arch}-linux-android${API}-clang++
HOST="${arch}-linux-android";;
esac
@ -36,3 +34,4 @@ make
make install
done

View file

@ -1,10 +1,9 @@
# /bin/bash
#!/bin/sh
WORKDIR=/opt/android
TOOLCHAIN_BASE_DIR=${WORKDIR}/toolchain
ORIGINAL_PATH=$PATH
MONERO_BRANCH=v0.17.1.9-android
. ./config.sh
MONERO_BRANCH=v0.17.2.3-android
MONERO_SRC_DIR=${WORKDIR}/monero
CMAKE_TOOLCHAIN_FILE="${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake"
git clone https://github.com/cake-tech/monero.git ${MONERO_SRC_DIR} --branch ${MONERO_BRANCH}
cd $MONERO_SRC_DIR
@ -15,8 +14,6 @@ for arch in "aarch" "aarch64" "i686" "x86_64"
do
FLAGS=""
PREFIX=${WORKDIR}/prefix_${arch}
ANDROID_STANDALONE_TOOLCHAIN_PATH="${TOOLCHAIN_BASE_DIR}_${arch}"
PATH="${ANDROID_STANDALONE_TOOLCHAIN_PATH}/bin:${ORIGINAL_PATH}"
DEST_LIB_DIR=${PREFIX}/lib/monero
DEST_INCLUDE_DIR=${PREFIX}/include
export CMAKE_INCLUDE_PATH="${PREFIX}/include"
@ -27,30 +24,30 @@ mkdir -p $DEST_INCLUDE_DIR
case $arch in
"aarch" )
CLANG=arm-linux-androideabi-clang
CXXLANG=arm-linux-androideabi-clang++
ANDROID_CLANG=armv7a-linux-androideabi${API}-clang
ANDROID_CLANGPP=armv7a-linux-androideabi${API}-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++
ANDROID_CLANG=aarch64-linux-androideabi${API}-clang
ANDROID_CLANGPP=aarch64-linux-androideabi${API}-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++
ANDROID_CLANG=i686-linux-androideabi${API}-clang
ANDROID_CLANGPP=i686-linux-androideabi${API}-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++
"x86_64" )
ANDROID_CLANG=x86_64-linux-androideabi${API}-clang
ANDROID_CLANGPP=x86_64-linux-androideabi${API}-clang++
BUILD_64=ON
TAG="android-x86_64"
ARCH="x86-64"
@ -61,7 +58,25 @@ 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} $FLAGS ../..
cmake \
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} \
-DCMAKE_PREFIX_PATH="${PREFIX}" \
-DCMAKE_FIND_ROOT_PATH="${PREFIX}" \
-DCMAKE_BUILD_TYPE=release \
-DARCH=$ARCH \
-DANDROID=true \
-DANDROID_NATIVE_API_LEVEL=$API \
-DANDROID_ABI=$ARCH_ABI \
-DANDROID_TOOLCHAIN=clang \
-DLRELEASE_PATH="${PREFIX}/bin" \
-DSTATIC=ON \
-DBUILD_64=$BUILD_64 \
-DINSTALL_VENDORED_LIBUNBOUND=ON \
-DUSE_DEVICE_TREZOR=OFF \
-DBUILD_GUI_DEPS=1 \
-DBUILD_TESTS=OFF \
${FLAGS} ../..
make wallet_api -j4
find . -path ./lib -prune -o -name '*.a' -exec cp '{}' lib \;

View file

@ -1,44 +1,62 @@
# /bin/bash
#!/bin/sh
WORKDIR=/opt/android
OPENSSL_FILENAME=openssl-1.0.2p.tar.gz
. ./config.sh
OPENSSL_FILENAME=openssl-1.1.1k.tar.gz
OPENSSL_FILE_PATH=$WORKDIR/$OPENSSL_FILENAME
OPENSSL_SRC_DIR=$WORKDIR/openssl-1.0.2p
OPENSSL_SRC_DIR=$WORKDIR/openssl-1.1.1k
OPENSSL_SHA256="892a0875b9872acd04a9fde79b1f943075d5ea162415de3047c327df33fbaee5"
ZLIB_FILENAME=zlib-1.2.11.tar.gz
ZLIB_FILE_PATH=$WORKDIR/$ZLIB_FILENAME
ZLIB_SRC_DIR=$WORKDIR/zlib-1.2.11
ORIGINAL_PATH=$PATH
TOOLCHAIN_BASE_DIR=${WORKDIR}/toolchain
ZLIB_SHA256="c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1"
curl https://zlib.net/$ZLIB_FILENAME -o $ZLIB_FILE_PATH
echo $ZLIB_SHA256 $ZLIB_FILE_PATH | sha256sum -c - || exit 1
wget https://zlib.net/$ZLIB_FILENAME -O $ZLIB_FILE_PATH
tar -xzf $ZLIB_FILE_PATH -C $WORKDIR
cd $ZLIB_SRC_DIR
CC=clang CXX=clang++ ./configure --static
make
wget https://www.openssl.org/source/$OPENSSL_FILENAME -O $OPENSSL_FILE_PATH
curl https://www.openssl.org/source/$OPENSSL_FILENAME -o $OPENSSL_FILE_PATH
echo $OPENSSL_SHA256 $OPENSSL_FILE_PATH | sha256sum -c - || exit 1
for arch in "aarch" "aarch64" "i686" "x86_64"
do
PREFIX=$WORKDIR/prefix_${arch}
PATH="${TOOLCHAIN_BASE_DIR}_${arch}/bin:${ORIGINAL_PATH}"
case $arch in
"aarch" ) TARGET="armv7";;
* ) TARGET="${arch}";;
esac
"aarch") CLANG=armv7a-linux-androideabi${API}-clang
CXXLANG=armv7a-linux-androideabi${API}-clang++
X_ARCH="android-arm";;
"aarch64") CLANG=${arch}-linux-android${API}-clang
CXXLANG=${arch}-linux-android${API}-clang++
X_ARCH="android-arm64";;
"i686") CLANG=${arch}-linux-android${API}-clang
CXXLANG=${arch}-linux-android${API}-clang++
X_ARCH="android-x86";;
"x86_64") CLANG=${arch}-linux-android${API}-clang
CXXLANG=${arch}-linux-android${API}-clang++
X_ARCH="android-x86_64";;
*) CLANG=${arch}-linux-android${API}-clang
CXXLANG=${arch}-linux-android${API}-clang++
X_ARCH="android-${arch}";;
esac
cd $WORKDIR
rm -rf $OPENSSL_SRC_DIR
tar -xzf $OPENSSL_FILE_PATH -C $WORKDIR
cd $OPENSSL_SRC_DIR
sed -i -e "s/mandroid/target\ ${TARGET}\-linux\-android/" Configure
CC=clang CXX=clang++ ./Configure android no-asm no-shared --static --with-zlib-include=${WORKDIR}/zlib --with-zlib-lib=${ZLIB_SRC_DIR} --prefix=${PREFIX} --openssldir=${PREFIX}
make
./Configure CC=${CLANG} CXX=${CXXLANG} ${X_ARCH} \
no-asm no-shared --static \
--with-zlib-include=${PREFIX}/include \
--with-zlib-lib=${PREFIX}/lib \
--prefix=${PREFIX} \
--openssldir=${PREFIX} \
-D__ANDROID_API__=$API
sed -i 's/CNF_EX_LIBS=-ldl -pthread//g;s/BIN_CFLAGS=-pie $(CNF_CFLAGS) $(CFLAGS)//g' Makefile
make -j4
make install
done

View file

@ -1,21 +1,24 @@
# /bin/bash
#!/bin/sh
WORKDIR=/opt/android
TOOLCHAIN_BASE_DIR=${WORKDIR}/toolchain
. ./config.sh
SODIUM_SRC_DIR=${WORKDIR}/libsodium
SODIUM_BRANCH=1.0.16
ORIGINAL_PATH=$PATH
for arch in "aarch" "aarch64" "i686" "x86_64"
do
PREFIX=$WORKDIR/prefix_${arch}
PATH="${TOOLCHAIN_BASE_DIR}_${arch}/bin:${ORIGINAL_PATH}"
PREFIX=${WORKDIR}/prefix_${arch}
case $arch in
"aarch" ) TARGET="arm";;
"i686" ) TARGET="x86";;
* ) TARGET="${arch}";;
"aarch" ) TARGET="arm"
CC=armv7a-linux-androideabi${API}-clang
CXX=armv7a-linux-androideabi${API}-clang++;;
"i686" ) TARGET="x86"
CC=${arch}-linux-android${API}-clang
CXX=${arch}-linux-android${API}-clang++;;
* ) TARGET="${arch}"
CC=${arch}-linux-android${API}-clang
CXX=${arch}-linux-android${API}-clang++;;
esac
HOST="${TARGET}-linux-android"
@ -24,8 +27,9 @@ rm -rf $SODIUM_SRC_DIR
git clone https://github.com/jedisct1/libsodium.git $SODIUM_SRC_DIR -b $SODIUM_BRANCH
cd $SODIUM_SRC_DIR
./autogen.sh
CC=clang CXX=clang++ ./configure --prefix=${PREFIX} --host=${HOST} --enable-static --disable-shared
./configure --prefix=${PREFIX} --host=${HOST} --enable-static --disable-shared
make
make install
done

View file

@ -1,25 +1,28 @@
# /bin/bash
#!/bin/sh
WORKDIR=/opt/android
TOOLCHAIN_BASE_DIR=${WORKDIR}/toolchain
. ./config.sh
ZMQ_SRC_DIR=$WORKDIR/libzmq
ZMQ_BRANCH=master
ZMQ_COMMIT_HASH=501d0815bf2b0abb93be8214fc66519918ef6c40
ORIGINAL_PATH=$PATH
ZMQ_BRANCH=v4.3.3
ZMQ_COMMIT_HASH=04f5bbedee58c538934374dc45182d8fc5926fa3
for arch in "aarch" "aarch64" "i686" "x86_64"
do
PREFIX=$WORKDIR/prefix_${arch}
PATH="${TOOLCHAIN_BASE_DIR}_${arch}/bin:${ORIGINAL_PATH}"
case $arch in
"aarch" ) TARGET="arm";;
"i686" ) TARGET="x86";;
* ) TARGET="${arch}";;
"aarch" ) TARGET="arm"
ANDROID_CLANG=armv7a-linux-androideabi${API}-clang
ANDROID_CLANGPP=armv7a-linux-androideabi${API}-clang++;;
"i686" ) TARGET="x86"
ANDROID_CLANG=${arch}-linux-android${API}-clang
ANDROID_CLANGPP=${arch}-linux-android${API}-clang++;;
* ) TARGET="${arch}"
ANDROID_CLANG=${arch}-linux-android${API}-clang
ANDROID_CLANGPP=${arch}-linux-android${API}-clang++;;
esac
HOST="${TARGET}-linux-android"
cd $WORKDIR
rm -rf $ZMQ_SRC_DIR
@ -27,7 +30,7 @@ git clone https://github.com/zeromq/libzmq.git ${ZMQ_SRC_DIR} -b ${ZMQ_BRANCH}
cd $ZMQ_SRC_DIR
git checkout ${ZMQ_COMMIT_HASH}
./autogen.sh
CC=clang CXX=clang++ ./configure --prefix=${PREFIX} --host=${HOST} --enable-static --disable-shared
CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} ./configure --prefix=${PREFIX} --host=${HOST} --enable-static --disable-shared
make
make install

13
scripts/android/config.sh Normal file
View file

@ -0,0 +1,13 @@
#!/bin/sh
export API=21
export WORKDIR=/opt/android
export ANDROID_NDK_ZIP=${WORKDIR}/android-ndk-r20b.zip
export ANDROID_NDK_ROOT=${WORKDIR}/android-ndk-r20b
export ANDROID_NDK_HOME=$ANDROID_NDK_ROOT
export TOOLCHAIN_DIR="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64"
case :${PATH:=${TOOLCHAIN_DIR}/bin}: in
(*:"${TOOLCHAIN_DIR}/bin":*) ;; (*)
export PATH=${TOOLCHAIN_DIR}/bin:$PATH
esac;

View file

@ -1,9 +1,9 @@
# /bin/bash
#!/bin/sh
WORKDIR=/opt/android
ARCH=$1
PREFIX="${WORKDIR}/prefix_${ARCH}"
BOOST_SRC_DIR=$WORKDIR/boost_1_68_0
PREFIX=$2
BOOST_SRC_DIR=$3
cd $BOOST_SRC_DIR
./b2 --build-type=minimal link=static runtime-link=static --with-chrono --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread --with-locale --build-dir=android --stagedir=android toolset=clang threading=multi threadapi=pthread target-os=android -sICONV_PATH=${PREFIX} install

View file

@ -1,16 +1,19 @@
# /bin/bash
#!/bin/sh
WORKDIR=/opt/android
ARCH=$1
PREFIX="${WORKDIR}/prefix_${ARCH}"
BOOST_FILENAME=boost_1_68_0.tar.bz2
PREFIX=$2
BOOST_SRC_DIR=$3
BOOST_FILENAME=$4
BOOST_VERSION=$5
BOOST_FILE_PATH=$WORKDIR/$BOOST_FILENAME
BOOST_SRC_DIR=$WORKDIR/boost_1_68_0
BOOST_SHA256="83bfc1507731a0906e387fc28b7ef5417d591429e51e788417fe9ff025e116b1"
if [ ! -e "$BOOST_FILE_PATH" ]; then
wget https://dl.bintray.com/boostorg/release/1.68.0/source/$BOOST_FILENAME -O $BOOST_FILE_PATH
curl -L http://downloads.sourceforge.net/project/boost/boost/${BOOST_VERSION}/${BOOST_FILENAME} > $BOOST_FILE_PATH
fi
echo $BOOST_SHA256 $BOOST_FILE_PATH | sha256sum -c - || exit 1
cd $WORKDIR
rm -rf $BOOST_SRC_DIR
tar -xvf $BOOST_FILE_PATH -C $WORKDIR

View file

@ -1,17 +1,8 @@
# /bin/bash
#!/bin/sh
WORKDIR=/opt/android
ANDROID_NDK_ZIP=${WORKDIR}/android-ndk-r17c.zip
ANDROID_NDK_ROOT=${WORKDIR}/android-ndk-r17c
TOOLCHAIN_DIR=${WORKDIR}/toolchain
TOOLCHAIN_A32_DIR=${TOOLCHAIN_DIR}_aarch
TOOLCHAIN_A64_DIR=${TOOLCHAIN_DIR}_aarch64
TOOLCHAIN_x86_DIR=${TOOLCHAIN_DIR}_i686
TOOLCHAIN_x86_64_DIR=${TOOLCHAIN_DIR}_x86_64
. ./config.sh
ANDROID_NDK_SHA256="8381c440fe61fcbb01e209211ac01b519cd6adf51ab1c2281d5daad6ca4c8c8c"
wget https://dl.google.com/android/repository/android-ndk-r17c-linux-x86_64.zip -O /opt/android/android-ndk-r17c.zip
unzip /opt/android/android-ndk-r17c.zip -d $WORKDIR
${ANDROID_NDK_ROOT}/build/tools/make_standalone_toolchain.py --arch arm64 --api 21 --install-dir ${TOOLCHAIN_A64_DIR} --stl=libc++
${ANDROID_NDK_ROOT}/build/tools/make_standalone_toolchain.py --arch arm --api 21 --install-dir ${TOOLCHAIN_A32_DIR} --stl=libc++
${ANDROID_NDK_ROOT}/build/tools/make_standalone_toolchain.py --arch x86 --api 21 --install-dir ${TOOLCHAIN_x86_DIR} --stl=libc++
${ANDROID_NDK_ROOT}/build/tools/make_standalone_toolchain.py --arch x86_64 --api 21 --install-dir ${TOOLCHAIN_x86_64_DIR} --stl=libc++
curl https://dl.google.com/android/repository/android-ndk-r20b-linux-x86_64.zip -o ${ANDROID_NDK_ZIP}
echo $ANDROID_NDK_SHA256 $ANDROID_NDK_ZIP | sha256sum -c || exit 1
unzip /opt/android/android-ndk-r20b.zip -d $WORKDIR

9
scripts/ios/build_all.sh Executable file
View file

@ -0,0 +1,9 @@
#!/bin/sh
. ./config.sh
./install_missing_headers.sh
./build_openssl.sh
./build_boost.sh
./build_sodium.sh
./build_zmq.sh
./build_monero.sh

23
scripts/ios/build_boost.sh Executable file
View file

@ -0,0 +1,23 @@
#!/bin/sh
. ./config.sh
MIN_IOS_VERSION=10.0
BOOST_URL="https://github.com/cake-tech/Apple-Boost-BuildScript.git"
BOOST_DIR_PATH="${EXTERNAL_IOS_SOURCE_DIR}/Apple-Boost-BuildScript"
BOOST_VERSION=1.74.0
BOOST_LIBS="random regex graph random chrono thread filesystem system date_time locale serialization program_options"
echo "============================ Boost ============================"
echo "Cloning Apple-Boost-BuildScript from - $BOOST_URL"
git clone -b build $BOOST_URL $BOOST_DIR_PATH
cd $BOOST_DIR_PATH
./boost.sh -ios \
--min-ios-version ${MIN_IOS_VERSION} \
--boost-libs "${BOOST_LIBS}" \
--boost-version ${BOOST_VERSION} \
--no-framework
mv ${BOOST_DIR_PATH}/build/boost/${BOOST_VERSION}/ios/release/prefix/include/* $EXTERNAL_IOS_INCLUDE_DIR
mv ${BOOST_DIR_PATH}/build/boost/${BOOST_VERSION}/ios/release/prefix/lib/* $EXTERNAL_IOS_LIB_DIR

61
scripts/ios/build_monero.sh Executable file
View file

@ -0,0 +1,61 @@
#!/bin/sh
. ./config.sh
MONERO_URL="https://github.com/monero-project/monero.git"
MONERO_DIR_PATH="${EXTERNAL_IOS_SOURCE_DIR}/monero"
MONERO_VERSION=tags/v0.17.2.3
BUILD_TYPE=release
PREFIX=${EXTERNAL_IOS_DIR}
echo "Cloning monero from - $MONERO_URL to - $MONERO_DIR_PATH"
git clone $MONERO_URL $MONERO_DIR_PATH
cd $MONERO_DIR_PATH
git checkout $MONERO_VERSION
git submodule update --init --force
mkdir -p build
cd ..
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -z $INSTALL_PREFIX ]; then
INSTALL_PREFIX=${ROOT_DIR}/monero
fi
for arch in "arm64" #"armv7" "arm64"
do
echo "Building IOS ${arch}"
export CMAKE_INCLUDE_PATH="${PREFIX}/include"
export CMAKE_LIBRARY_PATH="${PREFIX}/lib"
case $arch in
"armv7" )
DEST_LIB=../../lib-armv7;;
"arm64" )
DEST_LIB=../../lib-armv8-a;;
esac
rm -r monero/build > /dev/null
mkdir -p monero/build/${BUILD_TYPE}
pushd monero/build/${BUILD_TYPE}
cmake -D IOS=ON \
-DARCH=${arch} \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DSTATIC=ON \
-DBUILD_GUI_DEPS=ON \
-DINSTALL_VENDORED_LIBUNBOUND=ON \
-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}
popd
done
#only for arm64
cp ${MONERO_DIR_PATH}/lib-armv8-a/* $EXTERNAL_IOS_LIB_DIR
cp ${MONERO_DIR_PATH}/include/wallet/api/* $EXTERNAL_IOS_INCLUDE_DIR

16
scripts/ios/build_openssl.sh Executable file
View file

@ -0,0 +1,16 @@
#!/bin/sh
. ./config.sh
OPEN_SSL_URL="https://github.com/x2on/OpenSSL-for-iPhone.git"
OPEN_SSL_DIR_PATH="${EXTERNAL_IOS_SOURCE_DIR}/OpenSSL"
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
mv ${OPEN_SSL_DIR_PATH}/include/* $EXTERNAL_IOS_INCLUDE_DIR
mv ${OPEN_SSL_DIR_PATH}/lib/* $EXTERNAL_IOS_LIB_DIR

16
scripts/ios/build_sodium.sh Executable file
View file

@ -0,0 +1,16 @@
#!/bin/sh
. ./config.sh
SODIUM_PATH="${EXTERNAL_IOS_SOURCE_DIR}/libsodium"
SODIUM_URL="https://github.com/jedisct1/libsodium.git"
echo "============================ SODIUM ============================"
echo "Cloning SODIUM from - $SODIUM_URL"
git clone $SODIUM_URL $SODIUM_PATH --branch stable
cd $SODIUM_PATH
./dist-build/ios.sh
mv ${SODIUM_PATH}/libsodium-ios/include/* $EXTERNAL_IOS_INCLUDE_DIR
mv ${SODIUM_PATH}/libsodium-ios/lib/* $EXTERNAL_IOS_LIB_DIR

13
scripts/ios/build_zmq.sh Executable file
View file

@ -0,0 +1,13 @@
#!/bin/sh
. ./config.sh
ZMQ_PATH="${EXTERNAL_IOS_SOURCE_DIR}/libzmq"
ZMQ_URL="https://github.com/zeromq/libzmq.git"
echo "============================ ZMQ ============================"
echo "Cloning ZMQ from - $ZMQ_URL"
git clone $ZMQ_URL $ZMQ_PATH
cp ${ZMQ_PATH}/include/* $EXTERNAL_IOS_INCLUDE_DIR

12
scripts/ios/config.sh Executable file
View file

@ -0,0 +1,12 @@
#!/bin/sh
export IOS_SCRIPTS_DIR=`pwd`
export CW_ROOT=${IOS_SCRIPTS_DIR}/../..
export EXTERNAL_DIR=${CW_ROOT}/cw_monero/ios/External
export EXTERNAL_IOS_DIR=${EXTERNAL_DIR}/ios
export EXTERNAL_IOS_SOURCE_DIR=${EXTERNAL_IOS_DIR}/sources
export EXTERNAL_IOS_LIB_DIR=${EXTERNAL_IOS_DIR}/lib
export EXTERNAL_IOS_INCLUDE_DIR=${EXTERNAL_IOS_DIR}/include
mkdir -p $EXTERNAL_IOS_LIB_DIR
mkdir -p $EXTERNAL_IOS_INCLUDE_DIR

View file

@ -0,0 +1,63 @@
#!/bin/bash
. ./config.sh
echo "Installing missing headers"
# vmmeter
mkdir -p ${EXTERNAL_IOS_INCLUDE_DIR}/sys
if [ ! -f ${EXTERNAL_IOS_INCLUDE_DIR}/sys/vmmeter.h ]; then
cp /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/vmmeter.h ${EXTERNAL_IOS_INCLUDE_DIR}/sys/vmmeter.h
fi
# netinet
mkdir -p ${EXTERNAL_IOS_INCLUDE_DIR}/netinet
if [ ! -f ${EXTERNAL_IOS_INCLUDE_DIR}/netinet/ip_var.h ]; then
cp /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/netinet/ip_var.h ${EXTERNAL_IOS_INCLUDE_DIR}/netinet/ip_var.h
fi
if [ ! -f ${EXTERNAL_IOS_INCLUDE_DIR}/netinet/udp_var.h ]; then
cp /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/netinet/udp_var.h ${EXTERNAL_IOS_INCLUDE_DIR}/netinet/udp_var.h
fi
# IOKit
mkdir -p ${EXTERNAL_IOS_INCLUDE_DIR}/IOKit
if [ ! -f ${EXTERNAL_IOS_INCLUDE_DIR}/IOKit/IOTypes.h ]; then
cp /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Versions/A/Headers/IOTypes.h ${EXTERNAL_IOS_INCLUDE_DIR}/IOKit/IOTypes.h
fi
if [ ! -f ${EXTERNAL_IOS_INCLUDE_DIR}/IOKit/IOKitLib.h ]; then
cp /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Versions/A/Headers/IOKitLib.h ${EXTERNAL_IOS_INCLUDE_DIR}/IOKit/IOKitLib.h
fi
if [ ! -f ${EXTERNAL_IOS_INCLUDE_DIR}/IOKit/IOReturn.h ]; then
cp /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Versions/A/Headers/IOReturn.h ${EXTERNAL_IOS_INCLUDE_DIR}/IOKit/IOReturn.h
fi
if [ ! -f ${EXTERNAL_IOS_INCLUDE_DIR}/IOKit/OSMessageNotification.h ]; then
cp /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Versions/A/Headers/OSMessageNotification.h ${EXTERNAL_IOS_INCLUDE_DIR}/IOKit/OSMessageNotification.h
fi
# IOKit/ps
mkdir -p ${EXTERNAL_IOS_INCLUDE_DIR}/IOKit/ps
if [ ! -f ${EXTERNAL_IOS_INCLUDE_DIR}/IOKit/ps/IOPSKeys.h ]; then
cp /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Versions/A/Headers/ps/IOPSKeys.h ${EXTERNAL_IOS_INCLUDE_DIR}/IOKit/ps/IOPSKeys.h
fi
if [ ! -f ${EXTERNAL_IOS_INCLUDE_DIR}/IOKit/ps/IOPowerSources.h ]; then
cp /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Versions/A/Headers/ps/IOPowerSources.h ${EXTERNAL_IOS_INCLUDE_DIR}/IOKit/ps/IOPowerSources.h
fi
# libkern
mkdir -p ${EXTERNAL_IOS_INCLUDE_DIR}/libkern
if [ ! -f ${EXTERNAL_IOS_INCLUDE_DIR}/libkern/OSTypes.h ]; then
cp /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libkern/OSTypes.h ${EXTERNAL_IOS_INCLUDE_DIR}/libkern/OSTypes.h
fi
if [ ! -f ${EXTERNAL_IOS_INCLUDE_DIR}/IOKit/IOKitKeys.h ]; then
cp /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Versions/A/Headers/IOKitKeys.h ${EXTERNAL_IOS_INCLUDE_DIR}/IOKit/IOKitKeys.h
fi