CW-676 Add Linux scripts to build monero_c for linux platform (#1527)

* Revert "Revert btc address types"

This reverts commit a49e57e3

* Re-add Bitcoin Address types
Fix conflicts with main

* fix: label issues, clear spent utxo

* chore: deps

* fix: build

* fix: missing types

* feat: new electrs API & changes, fixes for last block scanning

* Update Monero

* not sure why it's failing

* Enable Exolix
Improve service updates indicator
New versions

* Add exolix Api token to limits api

* Ignore reporting network issues

* Change default bitcoin node

* Merge main and update linux version

* Update app version [skip ci]

* New versions

* Fix conflicts and update linux version

* minor fix

* feat: Scan Silent Payments homepage toggle

* chore: build configure

* feat: generic fixes, testnet UI improvements, useSSL on bitcoin nodes

* fix: invalid Object in sendData

* feat: improve addresses page & address book displays

* feat: silent payments labeled addresses disclaimer

* fix: missing i18n

* chore: print

* feat: single block scan, rescan by date working for btc mainnet

* feat: new cake features page replace market page, move sp scan toggle, auto switch node pop up alert

* feat: delete silent addresses

* fix: red dot in non ssl nodes

* fix: inconsistent connection states, fix tx history

* fix: tx & balance displays, cpfp sending

* feat: new rust lib

* chore: node path

* fix: check node based on network

* fix: missing txcount from addresses

* style: padding in feature page cards

* fix: restore not getting all wallet addresses by type

* fix: auto switch node broken

* fix: silent payment txs not being restored

* update linux version

* feat: change scanning to subscription model, sync improvements

* fix: scan re-subscription

* fix: default nodes

* fix: improve scanning by date, fix single block scan

* refactor: common function for input tx selection

* various fixes for build issues

* initial monero.dart implementation

* ...

* multiple wallets
new lib
minor fixes

* other fixes from monero.dart and monero_c

* fix: nodes & build

* update build scripts
fix polyseed

* remove unnecessary code

* Add windows app, build scripts and build guide for it.

* Minor fix in generated monero configs

* Merge and fix main

* fix: send all with multiple outs

* add missing monero_c command

* add android build script

* update version

* Merge and fix main

* undo android ndk removal

* Fix modified exception_handler.dart

* Temporarily remove haven

* fix build issues

* fix pr script

* Fixes for build monero.dart (monero_c) for windows.

* monero build script

* wip: ios build script

* refactor: unchanged file

* Added build guides for iOS and macOS. Replaced nproc call on macOS. Added macOS configuration for configure_cake_wallet.sh script.

* Update monero.dart and monero_c versions.

* Add missed windows build scripts

* Update the application configuration for windows build script.

* Update cw_monero pubspec lock file for monero.dart

* Update pr_test_build.yml

* chore: upgrade

* chore: merge changes

* refactor: unchanged files [skip ci]

* Fix conflicts with main

* fix for multiple wallets

* update app version [skip ci]

* Add tron to windows application configuration.

* Add macOS option for description message in configure_cake_wallet.sh

* fix missing encryption utils in hardware wallet functions [skip ci]

* fix conflicts

* Include missed monero dll for windows.

* reformatting [skip ci]

* fix conflicts with main

* Disable haven configuration for iOS as default. Add ability to configure cakewallet for iOS with  for configuration script. Remove cw_shared configuration for cw_monero.

* fix: scan fixes, add date, allow sending while scanning

* add missing nano secrets file [skip ci]

* ios library

* don't pull prebuilds android

* Add auto generation of manifest file for android project even for iOS, macOS, Windows.

* remove tron

* feat: sync fixes, sp settings

* feat: fix resyncing

* store crash fix

* make init async so it won't lag
disable print starts

* fix monero_c build issues

* libstdc++

* merge main and update version

* Fix MacOS saving wallet file issue
Fix Secure Storage issue (somehow)

* update pubspec.lock

* fix build script

* Use dylib as iOS framework. Use custom path for loading of iOS framework for monero.dart. Add script for generate iOS framework for monero wallet.

* fix: date from height logic, status disconnected & chain tip get

* fix: params

* feat: electrum migration if using cake electrum

* fix nodes
update versions

* re-enable tron

* update sp_scanner to work on iOS [skip ci]

* bump monero_c hash

* bump monero_c commit

* bump moneroc version

* bump monero_c commit

* Add ability to build monero wallet lib as universal lib. Update macOS build guide. Change default arch for macOS project to .

* fix: wrong socket for old electrum nodes

* update version

* Fix unchecked wallet type call

* get App Dir correctly in default_settings_migration.dart

* handle previous issue with fetching linux documents directory [skip ci]

* backup fix

* fix NTFS issues

* Add Tron
Update Linux version

* Close the wallet when the wallet gets changed

* fix: double balance

* feat: node domain

* fix: menu name

* bump monero_c commit

* fix: update tip on set scanning

* fix: connection switching back and forth

* feat: check if node is electrs, and supports sp

* chore: fix build

* minor enhancements

* fixes and enhancements

* solve conflicts with main

* Only stop wallet on rename and delete

* fix: status toggle

* minor enhancement

* Monero.com fixes

* bump monero_c commit

* update sp_scanner to include windows and linux

* merge main

* Update macOS build guide. Change brew dependencies for build unbound locally.

* fix: Tron file write, build scripts

* - merge linux with Monero Dart
- Temporarily disable Monero

* fix other issues with linux

* linux ci
fix build script

* Update pr_test_build_linux.yml

install required packages

* add linux desktop dependencies

* don't use apk in linux build releases

* don't copy the file to test-apk

* fix linux runtime issues

* remove libc++_shared.so

* fix issues with linux

* prepare both android and linux (because otherwise it will fail)

* ci script updates

* run apt update

* bump image to ubuntu 22.04
note: remember to put it down later

* bump python version

* remove some dependencies

* remove unused import

* add missing dependencies

* fix dependencies

* some fixes

* remove print [skip ci]

* Add back RunnerBase.entitlements
minor fixes [skip ci]

* fix memory leak / infinite recurrsion when opening xmr wallet

* url_launcher_linux: 3.1.1 # https://github.com/flutter/flutter/issues/153083

* fix conflicts with main

* handle walletKeysFile with encryptionUtils

* update app version [skip ci]

* add wownero [skip ci]

---------

Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
Co-authored-by: Rafael Saes <git@rafael.saes.dev>
Co-authored-by: M <m@cakewallet.com>
Co-authored-by: Konstantin Ullrich <konstantinullrich12@gmail.com>
This commit is contained in:
cyan 2024-08-13 00:18:14 +02:00 committed by GitHub
parent 3b635218a5
commit 1ce60d62b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
178 changed files with 3955 additions and 563 deletions

25
scripts/linux/app_config.sh Executable file
View file

@ -0,0 +1,25 @@
#!/bin/bash
CAKEWALLET="cakewallet"
DIR=`pwd`
if [ -z "$APP_LINUX_TYPE" ]; then
echo "Please set APP_LINUX_TYPE"
exit 1
fi
cd ../.. # go to root
CONFIG_ARGS=""
case $APP_LINUX_TYPE in
$CAKEWALLET)
CONFIG_ARGS="--monero --bitcoin --ethereum --polygon --nano --bitcoinCash --solana --tron --wownero --excludeFlutterSecureStorage";;
esac
cp -rf pubspec_description.yaml pubspec.yaml
flutter pub get
flutter pub run tool/generate_pubspec.dart
flutter pub get
flutter packages pub run tool/configure.dart $CONFIG_ARGS
sed -i '0,/version: 0.0.0/s//version: '"${APP_LINUX_VERSION}"'+'"${APP_LINUX_BUILD_NUMBER}"'/' pubspec.yaml
cd $DIR

View file

@ -0,0 +1,35 @@
#!/usr/bin/env fish
set -g APP_LINUX_NAME ""
set -g APP_LINUX_VERSION ""
set -g APP_LINUX_BUILD_NUMBER ""
set -g CAKEWALLET "cakewallet"
set -g TYPES $CAKEWALLET
set -g APP_LINUX_TYPE $CAKEWALLET
if test -n "$argv[1]"
set -g APP_LINUX_TYPE $argv[1]
end
set -g CAKEWALLET_NAME "Cake Wallet"
set -g CAKEWALLET_VERSION "1.9.0"
set -g CAKEWALLET_BUILD_NUMBER 29
if not contains -- $APP_LINUX_TYPE $TYPES
echo "Wrong app type."
exit 1
end
switch $APP_LINUX_TYPE
case $CAKEWALLET
set -g APP_LINUX_NAME $CAKEWALLET_NAME
set -g APP_LINUX_VERSION $CAKEWALLET_VERSION
set -g APP_LINUX_BUILD_NUMBER $CAKEWALLET_BUILD_NUMBER
end
export APP_LINUX_TYPE
export APP_LINUX_NAME
export APP_LINUX_VERSION
export APP_LINUX_BUILD_NUMBER

35
scripts/linux/app_env.sh Executable file
View file

@ -0,0 +1,35 @@
#!/bin/sh
APP_LINUX_NAME=""
APP_LINUX_VERSION=""
APP_LINUX_BUILD_VERSION=""
CAKEWALLET="cakewallet"
TYPES=($CAKEWALLET)
APP_LINUX_TYPE=$CAKEWALLET
if [ -n "$1" ]; then
APP_LINUX_TYPE=$1
fi
CAKEWALLET_NAME="Cake Wallet"
CAKEWALLET_VERSION="1.9.2"
CAKEWALLET_BUILD_NUMBER=30
if ! [[ " ${TYPES[*]} " =~ " ${APP_LINUX_TYPE} " ]]; then
echo "Wrong app type."
exit 1
fi
case $APP_LINUX_TYPE in
$CAKEWALLET)
APP_LINUX_NAME=$CAKEWALLET_NAME
APP_LINUX_VERSION=$CAKEWALLET_VERSION
APP_LINUX_BUILD_NUMBER=$CAKEWALLET_BUILD_NUMBER;;
esac
export APP_LINUX_TYPE
export APP_LINUX_NAME
export APP_LINUX_VERSION
export APP_LINUX_BUILD_NUMBER

3
scripts/linux/build_all.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
./build_monero_all.sh

36
scripts/linux/build_boost.sh Executable file
View file

@ -0,0 +1,36 @@
#!/bin/sh
set -e
. ./config.sh
BOOST_SRC_DIR=${EXTERNAL_LINUX_SOURCE_DIR}/boost_1_82_0
BOOST_FILENAME=boost_1_82_0.tar.bz2
BOOST_VERSION=1.82.0
BOOST_FILE_PATH=${EXTERNAL_LINUX_SOURCE_DIR}/$BOOST_FILENAME
BOOST_SHA256="a6e1ab9b0860e6a2881dd7b21fe9f737a095e5f33a3a874afc6a345228597ee6"
if [ ! -e "$BOOST_FILE_PATH" ]; then
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 $EXTERNAL_LINUX_SOURCE_DIR
rm -rf $BOOST_SRC_DIR
tar -xvf $BOOST_FILE_PATH -C $EXTERNAL_LINUX_SOURCE_DIR
cd $BOOST_SRC_DIR
./bootstrap.sh --prefix=${EXTERNAL_LINUX_DIR}
./b2 cxxflags=-fPIC cflags=-fPIC \
--with-chrono \
--with-date_time \
--with-filesystem \
--with-program_options \
--with-regex \
--with-serialization \
--with-system \
--with-thread \
--with-locale \
link=static \
install

20
scripts/linux/build_expat.sh Executable file
View file

@ -0,0 +1,20 @@
#!/bin/sh
set -e
. ./config.sh
EXPAT_VERSION=R_2_4_8
EXPAT_HASH="3bab6c09bbe8bf42d84b81563ddbcf4cca4be838"
EXPAT_SRC_DIR=${EXTERNAL_LINUX_SOURCE_DIR}/libexpat
git clone https://github.com/libexpat/libexpat.git -b ${EXPAT_VERSION} ${EXPAT_SRC_DIR}
cd $EXPAT_SRC_DIR
test `git rev-parse HEAD` = ${EXPAT_HASH} || exit 1
cd $EXPAT_SRC_DIR/expat
./buildconf.sh
./configure --enable-static --disable-shared --prefix=${EXTERNAL_LINUX_DIR}
make
make install

22
scripts/linux/build_iconv.sh Executable file
View file

@ -0,0 +1,22 @@
#!/bin/sh
set -e
. ./config.sh
export ICONV_FILENAME=libiconv-1.16.tar.gz
export ICONV_FILE_PATH=${EXTERNAL_LINUX_SOURCE_DIR}/${ICONV_FILENAME}
export ICONV_SRC_DIR=${EXTERNAL_LINUX_SOURCE_DIR}/libiconv-1.16
ICONV_SHA256="e6a1b1b589654277ee790cce3734f07876ac4ccfaecbee8afa0b649cf529cc04"
curl http://ftp.gnu.org/pub/gnu/libiconv/${ICONV_FILENAME} -o $ICONV_FILE_PATH
echo $ICONV_SHA256 $ICONV_FILE_PATH | sha256sum -c - || exit 1
cd $EXTERNAL_LINUX_SOURCE_DIR
rm -rf $ICONV_SRC_DIR
tar -xzf $ICONV_FILE_PATH -C $EXTERNAL_LINUX_SOURCE_DIR
cd $ICONV_SRC_DIR
./configure --prefix=${EXTERNAL_LINUX_DIR}
make
make install

40
scripts/linux/build_monero.sh Executable file
View file

@ -0,0 +1,40 @@
#!/bin/sh
. ./config.sh
MONERO_URL="https://github.com/cake-tech/monero.git"
MONERO_DIR_PATH="${EXTERNAL_LINUX_SOURCE_DIR}/monero"
MONERO_VERSION=release-v0.18.3.2
PREFIX=${EXTERNAL_LINUX_DIR}
DEST_LIB_DIR=${EXTERNAL_LINUX_LIB_DIR}/monero
DEST_INCLUDE_DIR=${EXTERNAL_LINUX_INCLUDE_DIR}/monero
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
rm -rf ./build/release
mkdir -p ./build/release
cd ./build/release
mkdir -p $DEST_LIB_DIR
mkdir -p $DEST_INCLUDE_DIR
echo "Building LINUX"
export CMAKE_INCLUDE_PATH="${PREFIX}/include"
export CMAKE_LIBRARY_PATH="${PREFIX}/lib"
cmake -DSTATIC=ON \
-DBUILD_GUI_DEPS=ON \
-DUNBOUND_INCLUDE_DIR=${EXTERNAL_LINUX_INCLUDE_DIR} \
-DCMAKE_INSTALL_PREFIX=${PREFIX} \
-DUSE_DEVICE_TREZOR=OFF \
-DMANUAL_SUBMODULES=1 \
../..
make wallet_api -j$(($(nproc) / 2))
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

View file

@ -0,0 +1,21 @@
#!/bin/bash
. ./config.sh
set -x -e
cd "$(dirname "$0")"
NPROC="-j$(nproc)"
../prepare_moneroc.sh
for COIN in monero wownero;
do
pushd ../monero_c
./build_single.sh ${COIN} $(gcc -dumpmachine) $NPROC
popd
unxz -f ../monero_c/release/${COIN}/$(gcc -dumpmachine)_libwallet2_api_c.so.xz
done

19
scripts/linux/build_openssl.sh Executable file
View file

@ -0,0 +1,19 @@
#!/bin/sh
set -e
. ./config.sh
OPENSSL_FILENAME=openssl-1.1.1q.tar.gz
OPENSSL_FILE_PATH=${EXTERNAL_LINUX_SOURCE_DIR}/${OPENSSL_FILENAME}
OPENSSL_SRC_DIR=${EXTERNAL_LINUX_SOURCE_DIR}/openssl-1.1.1q
OPENSSL_SHA256="d7939ce614029cdff0b6c20f0e2e5703158a489a72b2507b8bd51bf8c8fd10ca"
curl https://www.openssl.org/source/${OPENSSL_FILENAME} -o ${OPENSSL_FILE_PATH}
rm -rf $OPENSSL_SRC_DIR
tar -xzf $OPENSSL_FILE_PATH -C $EXTERNAL_LINUX_SOURCE_DIR
cd $OPENSSL_SRC_DIR
export CFLAGS=-fPIC
./config -fPIC shared --prefix=${EXTERNAL_LINUX_DIR}
make install

19
scripts/linux/build_sodium.sh Executable file
View file

@ -0,0 +1,19 @@
#!/bin/sh
set -e
. ./config.sh
SODIUM_PATH="${EXTERNAL_LINUX_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
./configure --prefix=${EXTERNAL_LINUX_DIR}
make
make install

25
scripts/linux/build_unbound.sh Executable file
View file

@ -0,0 +1,25 @@
#!/bin/sh
set -e
. ./config.sh
UNBOUND_VERSION=release-1.16.2
UNBOUND_HASH="cbed768b8ff9bfcf11089a5f1699b7e5707f1ea5"
UNBOUND_DIR_PATH="${EXTERNAL_LINUX_SOURCE_DIR}/unbound-1.16.2"
echo "============================ Unbound ============================"
rm -rf ${UNBOUND_DIR_PATH}
git clone https://github.com/NLnetLabs/unbound.git -b ${UNBOUND_VERSION} ${UNBOUND_DIR_PATH}
cd $UNBOUND_DIR_PATH
test `git rev-parse HEAD` = ${UNBOUND_HASH} || exit 1
export CFLAGS=-fPIC
./configure cxxflags=-fPIC cflags=-fPIC \
--prefix="${EXTERNAL_LINUX_DIR}" \
--with-ssl="${EXTERNAL_LINUX_DIR}" \
--with-libexpat="${EXTERNAL_LINUX_DIR}" \
--enable-static \
--disable-flto
make
make install

17
scripts/linux/build_zmq.sh Executable file
View file

@ -0,0 +1,17 @@
#!/bin/sh
. ./config.sh
ZMQ_PATH="${EXTERNAL_LINUX_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
cd $ZMQ_PATH
mkdir cmake-build
cd cmake-build
cmake .. -DCMAKE_INSTALL_PREFIX="${EXTERNAL_LINUX_DIR}"
make
make install

4
scripts/linux/cakewallet.sh Executable file
View file

@ -0,0 +1,4 @@
#!/bin/bash
. ./app_env.sh "cakewallet"
. ./app_config.sh

13
scripts/linux/config.sh Executable file
View file

@ -0,0 +1,13 @@
#!/bin/sh
export LINUX_SCRIPTS_DIR=`pwd`
export CW_ROOT=${LINUX_SCRIPTS_DIR}/../..
export EXTERNAL_DIR=${CW_ROOT}/cw_shared_external/ios/External
export EXTERNAL_LINUX_DIR=${EXTERNAL_DIR}/linux
export EXTERNAL_LINUX_SOURCE_DIR=${EXTERNAL_LINUX_DIR}/sources
export EXTERNAL_LINUX_LIB_DIR=${EXTERNAL_LINUX_DIR}/lib
export EXTERNAL_LINUX_INCLUDE_DIR=${EXTERNAL_LINUX_DIR}/include
mkdir -p $EXTERNAL_LINUX_LIB_DIR
mkdir -p $EXTERNAL_LINUX_INCLUDE_DIR
mkdir -p $EXTERNAL_LINUX_SOURCE_DIR

12
scripts/linux/gcc10.nix Normal file
View file

@ -0,0 +1,12 @@
with import <nixpkgs> {};
gcc10Stdenv.mkDerivation {
name="gcc10-stdenv";
buildInputs = [
pkgs.cmake
pkgs.pkg-config
pkgs.autoconf
pkgs.libtool
pkgs.expat
];
}

9
scripts/linux/setup.sh Executable file
View file

@ -0,0 +1,9 @@
#!/bin/sh
. ./config.sh
CW_EXTERNAL_DIR=${CW_ROOT}/cw_monero/ios/External/linux
CW_EXTERNAL_DIR_INCLUDE=${CW_EXTERNAL_DIR}/include
mkdir -p $CW_EXTERNAL_DIR_INCLUDE
cp $EXTERNAL_LINUX_INCLUDE_DIR/monero/wallet2_api.h $CW_EXTERNAL_DIR_INCLUDE