v1.0.7-r001: Cross-platform builds, FFI expansion, license, and bug fixes
- Version all crates at 1.0.7-r001 (tracking Salvium C++ 1.0.7)
- Source-available license: free for author/designees and non-commercial
use; annual commercial license required for any revenue-generating use
- Build scripts for Android/iOS/Linux/macOS/Windows producing both
libsalvium_crypto and libsalvium_ffi
- CI workflow publishes platform archives to salvium-rs-releases
- 23 new FFI functions: storage ops, address book, tx notes, attributes,
staked balance, key derivation, mnemonic
- Fix stake detection: count owned outputs regardless of spent state
- Auto-resume testnet integration tests from current chain height
This commit is contained in:
+48
-24
@@ -1,16 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build libsalvium_crypto.a for iOS (device + simulator) as an xcframework.
|
||||
# Build Salvium static libraries for iOS (device + simulator) as xcframeworks.
|
||||
#
|
||||
# Produces:
|
||||
# prebuilt/ios/SalviumCrypto.xcframework
|
||||
# prebuilt/ios/SalviumFfi.xcframework
|
||||
#
|
||||
# Prerequisites:
|
||||
# rustup target add aarch64-apple-ios aarch64-apple-ios-sim x86_64-apple-ios
|
||||
#
|
||||
# Produces: prebuilt/ios/SalviumCrypto.xcframework
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
ROOT_DIR="$SCRIPT_DIR/.."
|
||||
CRATE_DIR="$ROOT_DIR/crates/salvium-crypto"
|
||||
OUT_DIR="$ROOT_DIR/prebuilt/ios"
|
||||
WORK_DIR="$OUT_DIR/build"
|
||||
|
||||
@@ -20,37 +21,60 @@ TARGETS=(
|
||||
x86_64-apple-ios # Simulator (Intel)
|
||||
)
|
||||
|
||||
echo "==> Building salvium-crypto for iOS targets..."
|
||||
# Libraries to build and package
|
||||
declare -A LIB_NAMES=(
|
||||
[salvium-crypto]="libsalvium_crypto"
|
||||
[salvium-ffi]="libsalvium_ffi"
|
||||
)
|
||||
|
||||
declare -A FRAMEWORK_NAMES=(
|
||||
[salvium-crypto]="SalviumCrypto"
|
||||
[salvium-ffi]="SalviumFfi"
|
||||
)
|
||||
|
||||
echo "==> Building Salvium libraries for iOS targets..."
|
||||
|
||||
for target in "${TARGETS[@]}"; do
|
||||
echo " -> $target"
|
||||
cargo build --release --target "$target" --manifest-path "$CRATE_DIR/Cargo.toml"
|
||||
for crate in "${!LIB_NAMES[@]}"; do
|
||||
cargo build --release \
|
||||
--target "$target" \
|
||||
-p "$crate" \
|
||||
--manifest-path "$ROOT_DIR/Cargo.toml"
|
||||
done
|
||||
done
|
||||
|
||||
echo "==> Creating xcframework..."
|
||||
echo "==> Creating xcframeworks..."
|
||||
mkdir -p "$WORK_DIR"
|
||||
|
||||
# Device .a (single arch, no lipo needed)
|
||||
DEVICE_LIB="$CRATE_DIR/target/aarch64-apple-ios/release/libsalvium_crypto.a"
|
||||
for crate in "${!LIB_NAMES[@]}"; do
|
||||
lib="${LIB_NAMES[$crate]}"
|
||||
framework="${FRAMEWORK_NAMES[$crate]}"
|
||||
|
||||
# Merge simulator slices (aarch64-sim + x86_64) into one fat .a
|
||||
SIM_FAT="$WORK_DIR/libsalvium_crypto-sim.a"
|
||||
lipo -create \
|
||||
"$CRATE_DIR/target/aarch64-apple-ios-sim/release/libsalvium_crypto.a" \
|
||||
"$CRATE_DIR/target/x86_64-apple-ios/release/libsalvium_crypto.a" \
|
||||
-output "$SIM_FAT"
|
||||
echo " -> $framework.xcframework"
|
||||
|
||||
# Remove old xcframework if present
|
||||
rm -rf "$OUT_DIR/SalviumCrypto.xcframework"
|
||||
# Device .a (single arch, no lipo needed)
|
||||
DEVICE_LIB="$ROOT_DIR/target/aarch64-apple-ios/release/${lib}.a"
|
||||
|
||||
# Create xcframework from device .a + simulator fat .a
|
||||
xcodebuild -create-xcframework \
|
||||
-library "$DEVICE_LIB" \
|
||||
-library "$SIM_FAT" \
|
||||
-output "$OUT_DIR/SalviumCrypto.xcframework"
|
||||
# Merge simulator slices (aarch64-sim + x86_64) into one fat .a
|
||||
SIM_FAT="$WORK_DIR/${lib}-sim.a"
|
||||
lipo -create \
|
||||
"$ROOT_DIR/target/aarch64-apple-ios-sim/release/${lib}.a" \
|
||||
"$ROOT_DIR/target/x86_64-apple-ios/release/${lib}.a" \
|
||||
-output "$SIM_FAT"
|
||||
|
||||
# Remove old xcframework if present
|
||||
rm -rf "$OUT_DIR/$framework.xcframework"
|
||||
|
||||
# Create xcframework from device .a + simulator fat .a
|
||||
xcodebuild -create-xcframework \
|
||||
-library "$DEVICE_LIB" \
|
||||
-library "$SIM_FAT" \
|
||||
-output "$OUT_DIR/$framework.xcframework"
|
||||
done
|
||||
|
||||
# Clean up work dir
|
||||
rm -rf "$WORK_DIR"
|
||||
|
||||
echo "==> Done: $OUT_DIR/SalviumCrypto.xcframework"
|
||||
|
||||
echo "==> Done:"
|
||||
ls -d "$OUT_DIR"/*.xcframework
|
||||
|
||||
Reference in New Issue
Block a user