Two pieces that unblock the on-device cross-CGNAT test:
1. Rendezvous (new `rendezvous/` crate, tether-rendezvous, axum) — the only
server tether still needs on iroh: maps room → {EndpointId}, in-memory, TTL,
content-blind (room is a hash; never sees clipboard data). IrohTransport now
registers under cfg.server and bootstraps gossip from the returned peers, and
re-registers every 30s so late joiners can find it. The TETHER_IROH_BOOTSTRAP
env var is demoted to a test override. Verified: two engines self-discover via
a local rendezvous and sync text + a 200KB photo with zero env wiring.
2. iroh on Apple targets — the iroh-transport feature cross-compiles for
ios-arm64 / ios-sim / macOS once IPHONEOS_DEPLOYMENT_TARGET=26.0 is set (ring/
blake3 prebuilt objects target the newer SDK). build-apple.sh now exports the
deployment targets and takes a TETHER_FEATURES switch;
`TETHER_FEATURES=iroh-transport ./build-apple.sh` assembles + vendors the iroh
xcframework (4891 iroh symbols in the iOS .a). Swift bindings are unchanged —
the app builds on iroh with no Swift changes.
Remaining for the live test: deploy the rendezvous (+ optional self-hosted
iroh-relay) publicly on the homelab, then build TetherApp in Xcode and point its
server field at the rendezvous URL. Default ship build untouched throughout.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
61 lines
2.6 KiB
Bash
Executable File
61 lines
2.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Builds the tethercore Rust engine for Apple targets and refreshes the
|
|
# artifacts both Xcode apps consume: the Swift bindings + a single
|
|
# TetherCore.xcframework (iOS device + iOS sim + macOS arm64).
|
|
# Outputs are git-ignored / regenerated — run after any change to core/src,
|
|
# then build the apps in Xcode.
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")"
|
|
|
|
IOS_APP="../ios/TetherApp"
|
|
MAC_APP="../ios/MacTetherApp"
|
|
IOS=aarch64-apple-ios
|
|
SIM=aarch64-apple-ios-sim
|
|
MAC=aarch64-apple-darwin
|
|
|
|
# Deployment targets — must match the apps (iOS 26). Without this the linker
|
|
# defaults to iOS 10 and the cdylib fails to link against ring/blake3's prebuilt
|
|
# assembly objects (built for the newer SDK).
|
|
export IPHONEOS_DEPLOYMENT_TARGET=26.0
|
|
export MACOSX_DEPLOYMENT_TARGET=26.0
|
|
|
|
# Optional Cargo features, e.g. TETHER_FEATURES=iroh-transport to build the
|
|
# iroh-backed core. Empty → the default (legacy SSE/RTC/LAN) build. Plain string
|
|
# (not an array) so macOS bash 3.2 + `set -u` doesn't choke when it's empty.
|
|
FEATURES="${TETHER_FEATURES:-}"
|
|
FEAT_ARGS=""
|
|
[ -n "$FEATURES" ] && FEAT_ARGS="--features $FEATURES" && echo "▸ features: $FEATURES"
|
|
|
|
echo "▸ building static libs ($IOS, $SIM, $MAC)…"
|
|
rustup target add "$IOS" "$SIM" "$MAC" >/dev/null 2>&1 || true
|
|
# shellcheck disable=SC2086 # intentional word-split of FEAT_ARGS
|
|
cargo build --release --target "$IOS" --lib $FEAT_ARGS
|
|
cargo build --release --target "$SIM" --lib $FEAT_ARGS
|
|
cargo build --release --target "$MAC" --lib $FEAT_ARGS
|
|
|
|
echo "▸ generating Swift bindings…"
|
|
cargo run --release --bin uniffi-bindgen -- \
|
|
generate --library "target/$MAC/release/libtethercore.dylib" \
|
|
--language swift --out-dir bindings/swift
|
|
|
|
echo "▸ assembling TetherCore.xcframework (ios + ios-sim + macos)…"
|
|
rm -rf build-xcframework && mkdir -p build-xcframework/headers
|
|
cp bindings/swift/tethercoreFFI.h build-xcframework/headers/
|
|
cp bindings/swift/tethercoreFFI.modulemap build-xcframework/headers/module.modulemap
|
|
rm -rf TetherCore.xcframework
|
|
xcodebuild -create-xcframework \
|
|
-library "target/$IOS/release/libtethercore.a" -headers build-xcframework/headers \
|
|
-library "target/$SIM/release/libtethercore.a" -headers build-xcframework/headers \
|
|
-library "target/$MAC/release/libtethercore.a" -headers build-xcframework/headers \
|
|
-output TetherCore.xcframework
|
|
|
|
echo "▸ vendoring into both apps…"
|
|
for APP in "$IOS_APP" "$MAC_APP"; do
|
|
rm -rf "$APP/Vendor/TetherCore.xcframework"
|
|
mkdir -p "$APP/Vendor"
|
|
cp -R TetherCore.xcframework "$APP/Vendor/"
|
|
cp bindings/swift/tethercore.swift "$APP/Sources/tethercore.swift"
|
|
done
|
|
|
|
echo "✅ done — build TetherApp (iOS) and MacTetherApp (macOS) in Xcode."
|