#!/usr/bin/env bash # Assert the three baked copies of the boot-EXE name agree. # # A game project carries the boot-EXE name in three places, all filled from # the same @BOOT_EXE@ token at instantiation: game.toml ([prepare_disc] # boot_exe, or the basename of [game] exe), CMakeLists.txt (GEN_MARKER), # and codegen_setup.c (.gen_marker_relpath). generate names its output # after game.toml while the build and the launcher gate on the other two, # so a skew makes every player's self-build loop generate+build forever. # The CLI also refuses the skew at generate time; failing the release here # is cheaper than failing the player. # # Usage: check_boot_exe.sh [game-repo-root] (default: .) # Runs on bash 3.2+ (macOS runners) — no associative arrays. set -euo pipefail ROOT="${1:-.}" toml_get() { #
— first quoted value of key inside [section] awk -v sec="$1" -v key="$2" ' /^[[:space:]]*\[/ { in_sec = ($0 ~ ("^[[:space:]]*\\[" sec "\\]")) } in_sec && $0 ~ ("^[[:space:]]*" key "[[:space:]]*=") { if (match($0, /"[^"]*"/)) { print substr($0, RSTART + 1, RLENGTH - 2) } exit }' "${ROOT}/game.toml" } n_toml="" n_cmake="" n_setup="" if [[ -f "${ROOT}/game.toml" ]]; then n_toml="$(toml_get prepare_disc boot_exe || true)" if [[ -z "${n_toml}" ]]; then exe="$(toml_get game exe || true)" n_toml="${exe##*/}" fi fi if [[ -f "${ROOT}/CMakeLists.txt" ]]; then n_cmake="$(sed -n \ 's/.*GEN_MARKER[[:space:]]*"generated\/\(.*\)_dispatch\.c".*/\1/p' \ "${ROOT}/CMakeLists.txt" | head -n1)" fi if [[ -f "${ROOT}/codegen_setup.c" ]]; then n_setup="$(sed -n \ 's/.*\.gen_marker_relpath[[:space:]]*=[[:space:]]*"generated\/\(.*\)_dispatch\.c".*/\1/p' \ "${ROOT}/codegen_setup.c" | head -n1)" fi found=0 ref="" mismatch=0 report() { #