mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-18 05:51:34 +02:00
use ffi for mweb (#2456)
* chore: add ffi and ffigen dependencies to pubspec.yaml * refactor: replace method channel with FFI implementation for MWeb module * fix: correct `cd` command in build_mwebd.sh script * chore: add go.sum file with dependency checksums * fix: ensure ANDROID_NDK_VERSION is set before building and dynamically update NDK_BIN path * fix: update NDK_BIN path to dynamically detect platform in build_mwebd.sh script * refactor: remove unused mwebd dependencies and clean up CwMwebPlugin code * Update scripts/android/build_mwebd.sh Co-authored-by: cyan <cyjan@mrcyjanek.net> * refactor: replace iOS MoneroWallet framework with Mwebd.xcframework and clean up plugin implementation [skip-ci] * fix: mwebd ffi ios * refactor: update MWebFfi class to use non-nullable `lib` and improve address debug logging * chore: remove unused iOS/Android build scripts for mwebd * refactor: replace mweb.so with libmweb.so, use sync methods in MWebFfi, and update iOS/Android frameworks/scripts accordingly * chore: unify mwebd build process in workflows, remove unused gomobile init command --------- Co-authored-by: cyan <cyjan@mrcyjanek.net>
This commit is contained in:
co-authored by
cyan
parent
52e778f275
commit
309ad1836e
@@ -6,14 +6,43 @@ else
|
||||
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.24.1.linux-amd64.tar.gz
|
||||
export PATH=$PATH:/usr/local/go/bin
|
||||
export PATH=$PATH:~/go/bin
|
||||
go install golang.org/x/mobile/cmd/gomobile@latest
|
||||
gomobile init
|
||||
fi
|
||||
|
||||
# build mwebd:
|
||||
git clone https://github.com/ltcmweb/mwebd
|
||||
cd mwebd
|
||||
git reset --hard f75cb9edef07d03360ee2d33e6edae4243a890b1
|
||||
gomobile bind -target=android -androidapi 21 .
|
||||
mkdir -p ../../../cw_mweb/android/libs/
|
||||
cp ./mwebd.aar $_
|
||||
cd ../../cw_mweb/go
|
||||
|
||||
if [[ "x$ANDROID_NDK_VERSION" == "x" ]];
|
||||
then
|
||||
echo "ANDROID_NDK_VERSION is missing, please declare it before building"
|
||||
echo "You have these versions installed on your system currently:"
|
||||
ls ${ANDROID_HOME}/ndk/ | cat | awk '{ print "- " $1 }'
|
||||
echo "echo > ~/.zprofile"
|
||||
echo "echo 'export ANDROID_NDK_VERSION=..... > ~/.zprofile"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export ANDROID_OUT=../android/src/main/jniLibs
|
||||
export ANDROID_SDK="${HOME}/Library/Android/sdk"
|
||||
export NDK_BIN="${ANDROID_HOME}/ndk/${ANDROID_NDK_VERSION}/toolchains/llvm/prebuilt/$(uname | tr '[:upper:]' '[:lower:]')-x86_64/bin"
|
||||
|
||||
# Compile for x86_64 architecture and place the binary file in the android/src/main/jniLibs/x86_64 folder
|
||||
CGO_ENABLED=1 \
|
||||
GOOS=android \
|
||||
GOARCH=amd64 \
|
||||
CC=${NDK_BIN}/x86_64-linux-android21-clang \
|
||||
go build -buildmode=c-shared -o ${ANDROID_OUT}/x86_64/libmweb.so .
|
||||
|
||||
# Compile for arm64 architecture and place the binary file in the android/src/main/jniLibs/arm64-v8a folder
|
||||
CGO_ENABLED=1 \
|
||||
GOOS=android \
|
||||
GOARCH=arm64 \
|
||||
CC=${NDK_BIN}/aarch64-linux-android21-clang \
|
||||
go build -buildmode=c-shared -o ${ANDROID_OUT}/arm64-v8a/libmweb.so .
|
||||
|
||||
# Compile for armv7a architecture and place the binary file in the android/src/main/jniLibs/armeabi-v7a folder
|
||||
CGO_ENABLED=1 \
|
||||
GOOS=android \
|
||||
GOARCH=arm \
|
||||
CC=${NDK_BIN}/armv7a-linux-androideabi21-clang \
|
||||
go build -buildmode=c-shared -o ${ANDROID_OUT}/armeabi-v7a/libmweb.so .
|
||||
cd ../
|
||||
dart run ffigen --config ffigen_config.yaml
|
||||
|
||||
Reference in New Issue
Block a user