12# Cross-build the vendored iroh-js napi addon for lofi-node's platform matrix.3#4# Linux + Windows build on any x86_64 Linux host via cargo-zigbuild; macOS5# targets build natively on a mac (Apple SDK is not redistributable). Run6# inside the flake dev shell: nix develop -c ./scripts/cross-build.sh7#8# Artifacts land in dist/<triple>/ (cargo names; the Deno loader stages its9# own .node shim at load time).10set -euo pipefail11cd "$(dirname "$0")/.."1213# Windows is NOT in this matrix: napi-build's *-gnu path needs a libnode.dll14# import library (upstream ships Windows as msvc, delay-loaded against the15# host exe). A Windows artifact of OUR crate needs cargo-xwin (msvc cross) or16# a Windows CI runner — tracked in README.17linux_targets=(18 x86_64-unknown-linux-gnu19 aarch64-unknown-linux-gnu20)2122artifact_name() {23 echo "libnumber0_iroh.so"24}2526for t in "${linux_targets[@]}"; do27 echo "==> cargo zigbuild --release --target $t"28 cargo zigbuild --release --target "$t"29 name="$(artifact_name "$t")"30 mkdir -p "dist/$t"31 cp "target/$t/release/$name" "dist/$t/$name"32 echo " -> dist/$t/$name"33done3435cat <<'EOF'3637macOS targets build on a mac (native toolchain, no Nix needed):38 cargo build --release # -> target/release/libnumber0_iroh.dylib39EOF