#!/usr/bin/env bash set -euo pipefail cd "$(dirname "$0")" linuxcnc_root=${LINUXCNC_ROOT:-../linuxcnc} manifest=${1:-linuxcnc-rs274-wasm-source-files.txt} preflight_cache_dir=${CNC_SIM_PREFLIGHT_CACHE_DIR:-build/wasm-probe-preflight-cache} shim_output=$(./list-linuxcnc-wasm-safe-shims.sh) mapfile -t shim_sources <<<"$shim_output" object_output=$(CNC_SIM_PREFLIGHT_CACHE_DIR="$preflight_cache_dir" LINUXCNC_ROOT="$linuxcnc_root" ./build-linuxcnc-wasm-probe-objects.sh --mode source-objects "$manifest") mapfile -t objects <<<"$object_output" if [[ "${#objects[@]}" -lt "${#shim_sources[@]}" ]]; then echo "unexpected wasm-safe object cache count: got ${#objects[@]} fewer than ${#shim_sources[@]} shims" >&2 exit 1 fi linuxcnc_object_count=$((${#objects[@]} - ${#shim_sources[@]})) echo "linuxcnc wasm-safe source object probe passed ($linuxcnc_object_count linuxcnc objects + ${#shim_sources[@]} shims)"