From fc49c7ce94b16ce4932c57dd3bed78ab9c51f2e7 Mon Sep 17 00:00:00 2001 From: sneurlax Date: Fri, 21 Aug 2026 13:20:52 -0500 Subject: [PATCH 1/3] feat(ios): add simulator slice build script --- scripts/ios/build_sim.sh | 68 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100755 scripts/ios/build_sim.sh diff --git a/scripts/ios/build_sim.sh b/scripts/ios/build_sim.sh new file mode 100755 index 0000000..9482cab --- /dev/null +++ b/scripts/ios/build_sim.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash +# Build the iOS Simulator (arm64) slice of libepic_cash_wallet and package it +# together with the existing device slice (ios/libs/libepic_cash_wallet.a, +# produced by build_all.sh or download.sh) into an XCFramework. +set -e + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PLUGIN_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)" + +DEVICE_LIB="${PLUGIN_ROOT}/ios/libs/libepic_cash_wallet.a" +if [ ! -f "${DEVICE_LIB}" ]; then + echo "Error: ${DEVICE_LIB} not found." + echo "Run scripts/ios/build_all.sh or scripts/ios/download.sh first to produce the device slice." + exit 1 +fi + +mkdir -p "${SCRIPT_DIR}/build" +echo ''$(git log -1 --pretty=format:"%H")' '$(date) >> "${SCRIPT_DIR}/build/git_commit_version.txt" + +VERSIONS_FILE="${PLUGIN_ROOT}/lib/git_versions.dart" +EXAMPLE_VERSIONS_FILE="${PLUGIN_ROOT}/lib/git_versions_example.dart" +if [ ! -f "$VERSIONS_FILE" ]; then + cp "$EXAMPLE_VERSIONS_FILE" "$VERSIONS_FILE" +fi +COMMIT=$(git log -1 --pretty=format:"%H") +OS="IOS" +sed -i '' '/\/\*${OS}_VERSION/c\'$'\n''/\*${OS}_VERSION\*\/ const ${OS}_VERSION = "'"$COMMIT"'";' "$VERSIONS_FILE" + +# Copy the rust sources next to this script the same way build_all.sh does. +rm -rf "${SCRIPT_DIR}/build/rust" +cp -r "${PLUGIN_ROOT}/rust" "${SCRIPT_DIR}/build/rust" +cd "${SCRIPT_DIR}/build/rust" + +rustup target add aarch64-apple-ios-sim + +export IPHONEOS_DEPLOYMENT_TARGET=15.0 +export CARGO_TARGET_AARCH64_APPLE_IOS_SIM_RUSTFLAGS="-C link-arg=-mios-simulator-version-min=15.0" +cargo build --release --target aarch64-apple-ios-sim + +# Merge librandomx.a (simulator build) with libepic_cash_wallet.a. +SIM_LIB="target/aarch64-apple-ios-sim/release/libepic_cash_wallet.a" +RANDOMX_LIB=$(find target/aarch64-apple-ios-sim/release/build -name "librandomx.a" | head -n 1) +if [ -f "$RANDOMX_LIB" ]; then + echo "Found RandomX library at: $RANDOMX_LIB" + libtool -static -o target/aarch64-apple-ios-sim/release/libepic_cash_wallet_combined.a \ + "$SIM_LIB" \ + "$RANDOMX_LIB" + SIM_LIB=target/aarch64-apple-ios-sim/release/libepic_cash_wallet_combined.a +else + echo "Warning: librandomx.a not found, using libepic_cash_wallet.a only" +fi + +# XCFramework slices must share the same library filename as the device +# slice (libepic_cash_wallet.a); stage the simulator slice accordingly. +SIM_STAGING=target/aarch64-apple-ios-sim/release/sim_staging +rm -rf "$SIM_STAGING" +mkdir -p "$SIM_STAGING" +cp "$SIM_LIB" "$SIM_STAGING/libepic_cash_wallet.a" + +# Package device + simulator slices as an XCFramework (both are arm64, so +# lipo cannot combine them). +rm -rf "${PLUGIN_ROOT}/ios/libs/epiccash.xcframework" +xcodebuild -create-xcframework \ + -library "${DEVICE_LIB}" -headers "${PLUGIN_ROOT}/ios/include" \ + -library "${SIM_STAGING}/libepic_cash_wallet.a" -headers "${PLUGIN_ROOT}/ios/include" \ + -output "${PLUGIN_ROOT}/ios/libs/epiccash.xcframework" + +echo "Done: ${PLUGIN_ROOT}/ios/libs/epiccash.xcframework" From 57e5c930c63ee11739db1396c8b89cb40bac1faf Mon Sep 17 00:00:00 2001 From: sneurlax Date: Fri, 21 Aug 2026 13:20:52 -0500 Subject: [PATCH 2/3] feat(ios): vend epiccash xcframework in podspec --- ios/flutter_libepiccash.podspec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ios/flutter_libepiccash.podspec b/ios/flutter_libepiccash.podspec index e713133..8f82276 100644 --- a/ios/flutter_libepiccash.podspec +++ b/ios/flutter_libepiccash.podspec @@ -16,7 +16,10 @@ A new Flutter plugin project. s.public_header_files = 'Classes**/*.h' s.source_files = 'Classes/**/*' s.static_framework = true - s.vendored_libraries = 'libs/*.a' + # epiccash.xcframework carries arm64 device and arm64 simulator slices. + # Produced by scripts/ios/build_all.sh or download.sh (device slice) plus + # scripts/ios/build_sim.sh (simulator slice + XCFramework packaging). + s.vendored_frameworks = 'libs/epiccash.xcframework' s.dependency 'Flutter' s.library = 'sqlite3', 'c++' s.platform = :ios, '9.0' From 1f75024641af15621353a645c5b23222efb56034 Mon Sep 17 00:00:00 2001 From: sneurlax Date: Fri, 21 Aug 2026 13:20:52 -0500 Subject: [PATCH 3/3] chore(ios): wrap device artifact as xcframework in download.sh --- scripts/ios/download.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/ios/download.sh b/scripts/ios/download.sh index ebfbe6d..1e35a8d 100755 --- a/scripts/ios/download.sh +++ b/scripts/ios/download.sh @@ -30,3 +30,13 @@ download_and_verify "libepic_cash_wallet.h" mkdir -p "$LIB_ROOT/ios/libs" "$LIB_ROOT/ios/include" cp "$TMPDIR/libepic_cash_wallet-ios-aarch64.a" "$LIB_ROOT/ios/libs/libepic_cash_wallet.a" cp "$TMPDIR/libepic_cash_wallet.h" "$LIB_ROOT/ios/include/libepic_cash_wallet.h" + +# Release artifacts are device-only; wrap the device slice in an XCFramework +# so the podspec's vendored_frameworks entry resolves. Simulator consumers +# must additionally run scripts/ios/build_sim.sh. +PLUGIN_ROOT="$(cd "$LIB_ROOT" && pwd)" +rm -rf "$PLUGIN_ROOT/ios/libs/epiccash.xcframework" +xcodebuild -create-xcframework \ + -library "$PLUGIN_ROOT/ios/libs/libepic_cash_wallet.a" \ + -headers "$PLUGIN_ROOT/ios/include" \ + -output "$PLUGIN_ROOT/ios/libs/epiccash.xcframework"