#!/bin/sh set -eu cd "$(dirname "$0")/.." # A single preparation pass creates all slices before simultaneous app builds. # Set RUSTC/CARGO explicitly when Rust is installed outside the normal PATH. CARGO=${CARGO:-cargo} if [ -n "${DOCS_LLVM_LIBRARY_PATH:-}" ]; then export DYLD_LIBRARY_PATH="$DOCS_LLVM_LIBRARY_PATH"; fi "$CARGO" build --manifest-path crdt/Cargo.toml --release --target wasm32-unknown-unknown --lib --locked for target in aarch64-apple-darwin x86_64-apple-darwin aarch64-apple-ios aarch64-apple-ios-sim x86_64-apple-ios; do "$CARGO" build --manifest-path host/Cargo.toml --release --target "$target" --lib --locked done mkdir -p build/crdt/mac build/crdt/simulator lipo -create host/target/aarch64-apple-darwin/release/libdocs_native_host.a host/target/x86_64-apple-darwin/release/libdocs_native_host.a -output build/crdt/mac/libdocs_native_host.a lipo -create host/target/aarch64-apple-ios-sim/release/libdocs_native_host.a host/target/x86_64-apple-ios/release/libdocs_native_host.a -output build/crdt/simulator/libdocs_native_host.a rm -rf apple/Artifacts/DocsCRDT.xcframework xcodebuild -create-xcframework \ -library "$PWD/build/crdt/mac/libdocs_native_host.a" -headers "$PWD/host/include" \ -library "$PWD/host/target/aarch64-apple-ios/release/libdocs_native_host.a" -headers "$PWD/host/include" \ -library "$PWD/build/crdt/simulator/libdocs_native_host.a" -headers "$PWD/host/include" \ -output "$PWD/apple/Artifacts/DocsCRDT.xcframework"