#!/usr/bin/env bash set -euo pipefail cd "$(dirname "$0")" manifest=${1:-linuxcnc-rs274-wasm-source-files.txt} preflight_cache_dir=${CNC_SIM_PREFLIGHT_CACHE_DIR:-build/wasm-probe-preflight-cache} probe=$(CNC_SIM_PREFLIGHT_CACHE_DIR="$preflight_cache_dir" ./build-linuxcnc-wasm-link-probe.sh --mode runtime "$manifest") probe_dir=$(dirname "$probe") symbol_file="$probe_dir/runtime.symbols" symbol_signature="$probe_dir/runtime.symbols.signature" symbol_next_signature="$probe_dir/runtime.symbols.signature.next" { printf 'PROBE=%s\n' "$probe" printf 'SYMBOL_RULE_VERSION=1\n' stat -c 'PROBE_STAT=%n:%s:%y' "$probe" } > "$symbol_next_signature" if [[ ! -f "$symbol_file" || ! -f "$symbol_signature" ]] || ! cmp -s "$symbol_signature" "$symbol_next_signature"; then nm -C "$probe" > "$symbol_file" mv "$symbol_next_signature" "$symbol_signature" else rm -f "$symbol_next_signature" fi grep -F "cnc_sim_parse_program" "$symbol_file" >/dev/null grep -F "parse_linuxcnc_rs274_backend" "$symbol_file" >/dev/null grep -F "parse_gcode_with_backend" "$symbol_file" >/dev/null grep -F "Interp::read(char const*)" "$symbol_file" >/dev/null grep -F "Interp::init()" "$symbol_file" >/dev/null grep -E '(^| )wordexp($| )' "$symbol_file" >/dev/null grep -E '(^| )wordfree($| )' "$symbol_file" >/dev/null "$probe" echo "linuxcnc wasm runtime link probe passed"