ludic/selfhost/game-build.sh
Orkuncakilkaya 985f9ad8f2 Baseline: Ludic compiler + toolchain, Phase 1 syntax fixes complete
Self-hosted compiler (selfhost/*.ludic), runtime, examples, editor tooling,
and docs. Phase 1 of the syntax-redesign cohesion pass has landed:
edge-system fix, signature-query, when-alias, and the documentation truth-pass.
Suite green (14/14), C-free bootstrap fixpoint holds.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-27 15:15:35 +03:00

16 lines
873 B
Bash
Executable file

#!/bin/bash
# game-build.sh — compile a Ludic GAME with the self-hosted compiler. The
# compiler resolves the game's own `import`s and auto-splices the Ludic runtime
# (runtime/native/core.ludic + its imports), exactly as the C compiler does.
# Headless only for now (renders to out.ppm). Run from the repo root.
# ./selfhost/game-build.sh <selfhost-bin> <game.ludic> <out-binary>
set -u
cd "$(dirname "$0")/.."
SH="$1"; GAME="$2"; OUT="$3"
CC="${LUDIC_CC:-clang}"
ERR="$(mktemp)"
"$SH" "$GAME" > "$OUT.ll" 2>"$ERR" || { echo "self-host failed:"; head -5 "$ERR"; rm -f "$ERR"; exit 1; }
# -O2 removes the dead windowing branches (is_windowed()==0) so win_* need no defs
$CC -O2 "$OUT.ll" -o "$OUT" 2>"$ERR" || { echo "link failed:"; grep -i error "$ERR" | head -5; rm -f "$ERR"; exit 1; }
rm -f "$ERR" "$OUT.ll" # keep only the binary
echo "built $OUT"