montana/Монтана-iOS/RustBridge/build-rust-xcframework.sh

47 lines
2.1 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# spec, раздел "FFI-мост Rust ↔ Dart" (адаптировано на Rust ↔ Swift)
# Будущая итерация: build mt-mnemonic + mt-crypto Rust crates как XCFramework
# для iOS arm64 (real device) + arm64-sim (simulator).
#
# Требования:
# - rustup target add aarch64-apple-ios
# - rustup target add aarch64-apple-ios-sim
# - rustup target add x86_64-apple-ios (опционально для Intel сим)
# - cbindgen для генерации C header
#
# Использование:
# bash RustBridge/build-rust-xcframework.sh /path/to/efir369999/Montana/Код
#
# Результат:
# RustBridge/MontanaCrypto.xcframework
# RustBridge/MontanaCrypto.h (cbindgen output, заменит placeholder)
#
# В первой итерации iOS app использует Apple CryptoKit + CommonCrypto для
# PBKDF2/HKDF/SHA-256 (byte-exact с spec M-1). ML-DSA-65 + ML-KEM-768
# подключатся через этот xcframework в Phase 2 (после первого MVP).
set -euo pipefail
if [ $# -ne 1 ]; then
echo "usage: $0 <path-to-rust-workspace>"
echo "пример: $0 /Users/kh./Python/Ничто/Монтана/Русский/Протокол/Код"
exit 1
fi
WORKSPACE="$1"
[ -f "$WORKSPACE/Cargo.toml" ] || { echo "Cargo.toml не найден в $WORKSPACE"; exit 1; }
cd "$WORKSPACE"
echo "[xcframework] target: aarch64-apple-ios + aarch64-apple-ios-sim"
echo "[xcframework] crates: mt-mnemonic, mt-crypto (через mt-crypto-native)"
echo ""
echo "TODO Phase 2:"
echo " rustup target add aarch64-apple-ios aarch64-apple-ios-sim"
echo " cargo build --release --target aarch64-apple-ios -p mt-mnemonic -p mt-crypto"
echo " cargo build --release --target aarch64-apple-ios-sim -p mt-mnemonic -p mt-crypto"
echo " cbindgen --crate mt-mnemonic --output \$THIS/MontanaCrypto.h"
echo " xcodebuild -create-xcframework \\"
echo " -library target/aarch64-apple-ios/release/libmt_mnemonic.a \\"
echo " -library target/aarch64-apple-ios-sim/release/libmt_mnemonic.a \\"
echo " -output \$THIS/MontanaCrypto.xcframework"