CakeWallet/scripts/ios/build_decred.sh
JoeGruffins 65402ba1eb
dcr: Always fetch the current dir path. (#2242)
* dcr: Always fetch the current dir path.

On ios devices the path will change between updates breaking decred.
Never save the path and always check to ensure it is up to date.
Previous wallets were also not creating a directory in the correct
place. Move those when found.

* Update cw_decred/lib/wallet_service.dart

* dcr: Update libwallet dep.

---------

Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
2025-06-17 01:37:49 +03:00

35 lines
1 KiB
Bash
Executable file

#!/bin/bash
set -e
. ./config.sh
LIBWALLET_PATH="${EXTERNAL_IOS_SOURCE_DIR}/libwallet"
LIBWALLET_URL="https://github.com/decred/libwallet.git"
LIBWALLET_VERSION="05f8d7374999400fe4d525eb365c39b77d307b14"
if [[ -e $LIBWALLET_PATH ]]; then
rm -fr $LIBWALLET_PATH
fi
mkdir -p $LIBWALLET_PATH
git clone $LIBWALLET_URL $LIBWALLET_PATH
cd $LIBWALLET_PATH
git checkout $LIBWALLET_VERSION
SYSROOT=`xcrun --sdk iphoneos --show-sdk-path`
CLANG="clang -target arm64-apple-ios -isysroot ${SYSROOT}"
CLANGXX="clang++ -target arm64-apple-ios -isysroot ${SYSROOT}"
if [[ -e ./build ]]; then
rm -fr ./build
fi
CGO_ENABLED=1 GOOS=ios GOARCH=arm64 CC=$CLANG CXX=$CLANGXX \
go build -v -buildmode=c-archive -o ./build/libdcrwallet.a ./cgo || exit 1
CW_DECRED_DIR=${CW_ROOT}/cw_decred
HEADER_DIR=$CW_DECRED_DIR/lib/api
mv ${LIBWALLET_PATH}/build/libdcrwallet.h $HEADER_DIR
DEST_LIB_DIR=${CW_DECRED_DIR}/ios/External/lib
mkdir -p $DEST_LIB_DIR
mv ${LIBWALLET_PATH}/build/libdcrwallet.a $DEST_LIB_DIR
cd $CW_DECRED_DIR
dart run ffigen