CakeWallet/scripts/macos/build_boost_common.sh
Omar Hatem 0ba54fa602
Add decred (#1938)
* decred: Add decred. (#1322)

* multi: Add initial decred screens. (#1165)

Use a mock libwallet for now.

* cw_decred: add libdcrwallet dependency and link library for android, ios and macos (#1240)

* change cw_decred from package to plugin

* add libdcrwallet dependency and link library for android, ios and macos

* remove spvwallet, make some libdcrwallet fns async, light refactor

* libdcrwallet: use json payload returns

* use specific libwallet commit hash

* decred: fix Rename wallet.

---------

Co-authored-by: JoeGruff <joegruffins@gmail.com>

* decred: Add sync.

* decred: Add send transaction.

* decred: Fix fee estimation.

* decred: List transactions.

* decred: Add rescan.

* decred: Sign message.

* decred: Add new addr and addrs.

* decred: Add change wallet pass.

* decred: Add restore from seed.

* decred: Add watching only wallets.

* decred: Enable mainnet.

* decred: Allow using blank node address.

This allows a persistent peer to be unset, falling back to decred
seeders.

* decred: Rescan from wallet birthday.

* add and update macos build scripts, update build readme, gitignore macos project.pbxproj

Signed-off-by: Philemon Ukane <ukanephilemon@gmail.com>

* multi: hide decred rescan page if it's not ready

-  move hasRescan method to WalletBase and implement for decred

Signed-off-by: Philemon Ukane <ukanephilemon@gmail.com>

* cw_decred: fix bug where decred wallets are not loaded after app restart

Signed-off-by: Philemon Ukane <ukanephilemon@gmail.com>

* add buy and sell for decred via onramp

Signed-off-by: Philemon Ukane <ukanephilemon@gmail.com>

* bug-fix: account for other send outputs that are part of the same tx

Signed-off-by: Philemon Ukane <ukanephilemon@gmail.com>

* decred: Return address with no peers.

* decred: Update pubspec.

* decred: Add verify message.

* upgrade hive_generator dep in cw_decred

* decred: Clean up code.

---------

Signed-off-by: Philemon Ukane <ukanephilemon@gmail.com>
Co-authored-by: Wisdom Arerosuoghene <wisdom.arerosuoghene@gmail.com>
Co-authored-by: Philemon Ukane <ukanephilemon@gmail.com>

* fix extracted addresses not used
fix conflicts with main

* remove print [skip ci]

* minor formatting

* fix initial migration version

* add build decred script to workflow

* install go before build decred
fix switch cases

* trial 2 to fix decred build

* re-install go

* revert build script change

* refactor/clean nodes functions

* Fix address book issue
Fix send ALL (to be continued with the fees point)

* Fix transactions display issues
Add missing file

* Fix unconfirmed balance not displayed
Change Wallet order
Minor cleanup

* Fix workflow

* Fix workflow

* Fix workflow

* test

* hardcode path for now

* fix + cleanup decred build script to work on mac and linux

* Update decred build script

* Run actions on pull requests, extract commit message

* run after checkout

* add safe directory

* Get commit message from base.sha instead of last commit

* base -> head

* Do not merge main branch into pr

* [skip slack] [run tests] clone by sha

* Proper name for decred library in the build script

* Throw an error when ANDROID_HOME or ANDROID_NDK_VERSION is missing

* Fix conflicts with main

* minor code enhancement

* decred: Add used address history.  (#1941)

* decred: Update pubspec.

* decred testnet

* decred: Add used address history.

* decred: Remove default node list.

* populate transaction history before sync begins

* decred: Add some awaits.

* decred: Fix send all.

* decred: Add clang export to build script.

* decred: Update logo colors.

* cleanup cw_decred.dart

* make decred wallet addresses selectable in receive page

* decred: Always set default addr when used.

* decred: Add back default node list.

* decred: Allow creating addresses manually.

---------

Co-authored-by: Wisdom Arerosuoghene <wisdom.arerosuoghene@gmail.com>
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>

* minor fixes and cleanup

* minor fix, feel free to test now

* - Fix transaction details
- Fix Nodes
- Add processing sync status

* Add decred info card

* push missing file

* Add missing text for decred info card

* minor: change docs link [skip ci]

* decred: Update derivation info. (#2013)

* decred: Update derivation info.

* decred: Allow unsynced unused addresses.

* decred: Update dcrwallet dep to 4.3.0.

* Merge main and fix conflicts

* Merge main and fix conflicts

* decred: Fix background sync panic. (#2080)

* decred: Run libwallet in isolate. (#2077)

* decred: Fix contact save inquiry. (#2083)

Also fix tx time and the fee shown on pending transactions.

* Disable send button in view only decred wallets

* - Fix frozen coins
- Add URI support
- Fix fees in tx details
- Handle empty coins send
- Handle wallets in address book

* Merge main

* remove print [skip ci]

* Fix restore from QR

* minor improvement for QR restore

* minor fixes [skip ci]

* decred: Get slip44 addrs before sync completes. (#2092)

* - Fix loading wallet more than one time
- Fix minor UI issue

---------

Signed-off-by: Philemon Ukane <ukanephilemon@gmail.com>
Co-authored-by: JoeGruffins <34998433+JoeGruffins@users.noreply.github.com>
Co-authored-by: Wisdom Arerosuoghene <wisdom.arerosuoghene@gmail.com>
Co-authored-by: Philemon Ukane <ukanephilemon@gmail.com>
Co-authored-by: Czarek Nakamoto <cyjan@mrcyjanek.net>
2025-03-21 04:18:47 +02:00

214 lines
No EOL
5.1 KiB
Bash
Executable file

#!/bin/sh
. ./config.sh
# Boost combined
BOOST_CXXFLAGS_COMBINED="-arch x86_64 -arch arm64"
BOOST_CFLAGS_COMBINED="-arch x86_64 -arch arm64"
BOOST_LINKFLAGS_COMBINED="-arch x86_64 -arch arm64"
# Boost arm64
BOOST_CXXFLAGS_ARM64="-arch arm64"
BOOST_CFLAGS_ARM64="-arch arm64"
BOOST_LINKFLAGS_ARM64="-arch arm64"
# Boost x86_64
BOOST_CXXFLAGS_X86_64="-arch x86_64"
BOOST_CFLAGS_X86_64="-arch x86_64"
BOOST_LINKFLAGS_X86_64="-arch x86_64"
# Boost B2 arm64
BOOST_B2_CXXFLAGS_ARM_64="-arch arm64"
BOOST_B2_CFLAGS_ARM_64="-arch arm64"
BOOST_B2_LINKFLAGS_ARM_64="-arch arm64"
BOOST_B2_BUILD_DIR_ARM_64=macos-arm64
# Boost B2 x86_64
BOOST_B2_CXXFLAGS_X86_64="-arch x86_64"
BOOST_B2_CFLAGS_X86_64="-arch x86_64"
BOOST_B2_LINKFLAGS_X86_64="-arch x86_64"
BOOST_B2_BUILD_DIR_X86_64=macos-x86_64
build_boost_init_common() {
echo "
============================ BOOST ============================
"
CXXFLAGS=$1
CFLAGS=$2
LINKFLAGS=$3
BOOST_SRC_DIR=${EXTERNAL_MACOS_SOURCE_DIR}/boost_1_72_0
BOOST_FILENAME=boost_1_72_0.tar.bz2
BOOST_VERSION=1.72.0
BOOST_FILE_PATH=${EXTERNAL_MACOS_SOURCE_DIR}/${BOOST_FILENAME}
BOOST_SHA256="59c9b274bc451cf91a9ba1dd2c7fdcaf5d60b1b3aa83f2c9fa143417cc660722"
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 | shasum -a 256 -c - || exit 1
cd $EXTERNAL_MACOS_SOURCE_DIR
rm -rf $BOOST_SRC_DIR
tar -xvf $BOOST_FILE_PATH -C $EXTERNAL_MACOS_SOURCE_DIR
cd $BOOST_SRC_DIR
./bootstrap.sh --with-toolset=clang-darwin cxxflags="${CXXFLAGS}" cflags="${CFLAGS}" linkflags="${LINKFLAGS}"
}
build_boost_init_arm64() {
CXXFLAGS="-arch arm64"
CFLAGS="-arch arm64"
LINKFLAGS="-arch arm64"
build_boost_init_common "${CXXFLAGS}" "${CFLAGS}" "${LINKFLAGS}"
}
build_boost_init_x86_64() {
CXXFLAGS="-arch x86_64"
CFLAGS="-arch x86_64"
LINKFLAGS="-arch x86_64"
build_boost_init_common "${CXXFLAGS}" "${CFLAGS}" "${LINKFLAGS}"
}
build_boost_init_universal() {
CXXFLAGS="-arch x86_64 -arch arm64"
CFLAGS="-arch x86_64 -arch arm64"
LINKFLAGS="-arch x86_64 -arch arm64"
build_boost_init_common "${CXXFLAGS}" "${CFLAGS}" "${LINKFLAGS}"
}
build_boost_compile_common() {
ARCH=$1
ABI=$2
CXXFLAGS=$3
CFLAGS=$4
LINKFLAGS=$5
FLAGS=$6
BUILD_DIR=$7
./b2 toolset=clang-darwin target-os=darwin architecture="${ARCH}" cxxflags="${CXXFLAGS}" cflags="${CFLAGS}" linkflags="${LINKFLAGS}" abi="${ABI}" "${FLAGS}" -a \
--with-chrono \
--with-date_time \
--with-filesystem \
--with-program_options \
--with-regex \
--with-serialization \
--with-system \
--with-thread \
--with-locale \
--build-dir=$BUILD_DIR \
--stagedir=${BUILD_DIR}/stage \
link=static
}
build_boost_compile_arm64() {
ARCH="arm"
ABI="aapcs"
CXXFLAGS="-arch arm64"
CFLAGS="-arch arm64"
LINKFLAGS="-arch arm64"
FLAGS=""
BUILD_DIR="macos-arm64"
build_boost_compile_common "${ARCH}" "${ABI}" "${CXXFLAGS}" "${CFLAGS}" "${LINKFLAGS}" "${FLAGS}" "${BUILD_DIR}"
}
build_boost_compile_x86_64() {
ARCH="x86"
ABI="sysv"
CXXFLAGS="-arch x86_64"
CFLAGS="-arch x86_64"
LINKFLAGS="-arch x86_64"
FLAGS="binary-format=mach-o"
BUILD_DIR="macos-x86_64"
build_boost_compile_common "${ARCH}" "${ABI}" "${CXXFLAGS}" "${CFLAGS}" "${LINKFLAGS}" "${FLAGS}" "${BUILD_DIR}"
}
build_boost_compile_universal() {
ARCHES=(arm x86)
for ARCH in ${ARCHES[@]}; do
ABI=""
CXXFLAGS=""
CFLAGS=""
LINKFLAGS=""
FLAGS=""
BUILD_DIR=""
case $ARCH in
arm)
ABI="aapcs"
CXXFLAGS="-arch arm64"
CFLAGS="-arch arm64"
LINKFLAGS="-arch arm64"
FLAGS=""
BUILD_DIR="macos-arm64";;
x86)
ABI="sysv"
CXXFLAGS="-arch x86_64"
CFLAGS="-arch x86_64"
LINKFLAGS="-arch x86_64"
FLAGS="binary-format=mach-o"
BUILD_DIR="macos-x86_64"
esac
build_boost_compile_common "${ARCH}" "${ABI}" "${CXXFLAGS}" "${CFLAGS}" "${LINKFLAGS}" "${FLAGS}" "${BUILD_DIR}"
done
}
build_boost_install_common() {
ARCH=$1
LIB_DIR=""
mkdir -p $EXTERNAL_MACOS_LIB_DIR
mkdir -p $EXTERNAL_MACOS_INCLUDE_DIR
case $ARCH in
arm64) LIB_DIR="${BOOST_B2_BUILD_DIR_ARM_64}/stage/lib";;
x86_64) LIB_DIR="${BOOST_B2_BUILD_DIR_X86_64}/stage/lib";;
*) LIB_DIR="lib";;
esac
cp -r ${LIB_DIR}/*.a ${EXTERNAL_MACOS_LIB_DIR}
cp -r boost ${EXTERNAL_MACOS_INCLUDE_DIR}
}
build_boost_install_arm64() {
ARCH="arm64"
build_boost_install_common $ARCH
}
build_boost_install_x86_64() {
ARCH="x86_64"
build_boost_install_common $ARCH
}
build_boost_install_universal() {
mkdir lib
for blib in ${BOOST_B2_BUILD_DIR_ARM_64}/stage/lib/*.a; do
lipo -create -arch arm64 $blib -arch x86_64 ${BOOST_B2_BUILD_DIR_X86_64}/stage/lib/$(basename $blib) -output lib/$(basename $blib);
done
cp -r lib/* ${EXTERNAL_MACOS_LIB_DIR}
cp -r boost ${EXTERNAL_MACOS_INCLUDE_DIR}
}
build_boost_arm64() {
build_boost_init_arm64
build_boost_compile_arm64
build_boost_install_arm64
}
build_boost_x86_64() {
build_boost_init_x86_64
build_boost_compile_x86_64
build_boost_install_x86_64
}
build_boost_universal() {
build_boost_init_universal
build_boost_compile_universal
build_boost_install_universal
}