Files
DS4Server/tools/mojo-spike/check.sh
2026-08-31 15:25:04 +02:00

42 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
set -eu
cd "$(dirname "$0")/../.."
output_dir=target/mojo-spike
mkdir -p "$output_dir"
uv sync --frozen
version=$(uv run --frozen --no-sync mojo --version)
test "$version" = "Mojo 1.0.0 (ed45d567)"
uv run --frozen --no-sync mojo build --emit object \
-o "$output_dir/abi.o" tools/mojo-spike/abi.mojo
uv run --frozen --no-sync mojo build --emit shared-lib \
-o "$output_dir/libds4_mojo_probe.dylib" tools/mojo-spike/abi.mojo
otool -L "$output_dir/libds4_mojo_probe.dylib" \
> "$output_dir/abi-closure.txt"
nm -u "$output_dir/libds4_mojo_probe.dylib" \
> "$output_dir/abi-undefined.txt"
grep -F '@rpath/libKGENCompilerRTShared.dylib' \
"$output_dir/abi-closure.txt" >/dev/null
if uv run --frozen --no-sync mojo build \
-o "$output_dir/gpu-host" tools/mojo-spike/gpu_host.mojo \
> "$output_dir/gpu-host-build.txt" 2>&1; then
echo "unexpectedly found a GPU host runtime in the compiler-only environment" >&2
exit 1
fi
grep -F "unable to locate module 'max'" \
"$output_dir/gpu-host-build.txt" >/dev/null
printf '%s\n' \
"Mojo 1.0 compiler and C ABI: verified" \
"Open Metal GPU host path: unavailable" \
"Shared-library runtime closure: @rpath/libKGENCompilerRTShared.dylib" \
"Decision: STOP until the runtime closure is explicitly redistributable"