releases: tolerate rexglue codegen exit crash; ship actual runtime lib name

The rexglue codegen tool segfaults/aborts during static teardown AFTER
writing its output (cvar registry SIOF + heap corruption at exit). The
generated source is complete and valid, so generate-skate3/generate-eawebkit
now wrap the invocation with bash -c that verifies the written output files
instead of the exit code - a genuine failure (unresolved calls without the
Title Update package) produces no output and is still caught. Fixes the
release build on toolchains that hit the teardown bug (also applies to CI).

release.sh: glob the actual rexglue runtime lib name (librexruntimerd.so for
relwithdebinfo vs librexruntime.so for release) so packaging ships the lib
the binary links.
This commit is contained in:
MiTHRAL 2026-08-27 12:42:04 -04:00
parent babb887d4b
commit e3a9fa0b99
2 changed files with 25 additions and 11 deletions

View file

@ -1,7 +1,11 @@
add_custom_target(generate-skate3
COMMAND $<TARGET_FILE:rex::rexglue> codegen
${SKATE3_CODEGEN_ARGS}
"${CMAKE_CURRENT_BINARY_DIR}/manifests/skate3.toml"
# The rexglue codegen tool writes its output and THEN crashes during
# static teardown (SIOF / heap-corruption at exit - the cvar registry and
# friends are freed out of order). The output is complete and valid, so
# wrap the invocation to verify the written files instead of the exit
# code: a genuine failure (e.g. unresolved calls without the Title Update
# package) produces no output and is still caught.
COMMAND bash -c "$<TARGET_FILE:rex::rexglue> codegen ${SKATE3_CODEGEN_ARGS} \"${CMAKE_CURRENT_BINARY_DIR}/manifests/skate3.toml\"; rc=\$?; [ -f \"${CMAKE_CURRENT_SOURCE_DIR}/generated/sources.cmake\" ] || exit \$rc; exit 0"
COMMAND "${CMAKE_COMMAND}"
"-DSKATE3_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}"
-P "${CMAKE_CURRENT_SOURCE_DIR}/cmake/ApplySkate3CodegenPatches.cmake"
@ -11,9 +15,7 @@ add_custom_target(generate-skate3
)
add_custom_target(generate-eawebkit
COMMAND $<TARGET_FILE:rex::rexglue> codegen
${SKATE3_CODEGEN_ARGS}
"${CMAKE_CURRENT_BINARY_DIR}/manifests/eawebkit.toml"
COMMAND bash -c "$<TARGET_FILE:rex::rexglue> codegen ${SKATE3_CODEGEN_ARGS} \"${CMAKE_CURRENT_BINARY_DIR}/manifests/eawebkit.toml\"; rc=\$?; [ -f \"${CMAKE_CURRENT_SOURCE_DIR}/generated/eawebkit/sources.cmake\" ] || exit \$rc; exit 0"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Generating recompiled code for EAWebkit.xex"
VERBATIM

View file

@ -19,6 +19,10 @@
# --game-root DIR extracted game dump (default: $REPO/game)
# --tu FILE optional Title Update STFS package for codegen
# --os linux|windows|macos override platform (default: host OS)
# --cmake-args "..." extra flags appended to every cmake configure
# call (e.g. -DCMAKE_C_COMPILER=clang-22
# -DCMAKE_CXX_COMPILER=clang++-22
# -DCMAKE_LINKER=ld.lld on distros without clang-20)
# --upload publish the zip to a Forgejo Release
#
# Env for --upload:
@ -36,6 +40,7 @@ TAG=""
GAME_ROOT="${SKATE3_GAME_DATA_ROOT:-$REPO/game}"
TU="${SKATE3_TITLE_UPDATE_PACKAGE:-}"
OS_ARG=""
CMAKE_ARGS=""
while [ $# -gt 0 ]; do
case "$1" in
@ -43,9 +48,10 @@ while [ $# -gt 0 ]; do
--game-root) GAME_ROOT="$2"; shift 2;;
--tu) TU="$2"; shift 2;;
--os) OS_ARG="$2"; shift 2;;
--cmake-args) CMAKE_ARGS="$2"; shift 2;;
--upload) UPLOAD=1; shift;;
-h|--help)
sed -n '2,30p' "$0"; exit 0;;
sed -n '2,32p' "$0"; exit 0;;
*) echo "unknown argument: $1"; exit 2;;
esac
done
@ -79,12 +85,12 @@ if [ -n "$TU" ]; then
fi
echo "==> Release $TAG ($EXT) preset=$PRESET game=$GAME_ROOT"
echo "==> Configure"
cmake --preset "$PRESET" -DSKATE3_GAME_DATA_ROOT="$GAME_ROOT" $TU_ARGS
echo "==> Configure (extra args: ${CMAKE_ARGS:-none})"
cmake --preset "$PRESET" -DSKATE3_GAME_DATA_ROOT="$GAME_ROOT" $TU_ARGS $CMAKE_ARGS
echo "==> Generate recompiled code"
cmake --build --preset "$PRESET" --target generate-all --parallel
echo "==> Reconfigure (generated sources)"
cmake --preset "$PRESET" -DSKATE3_GAME_DATA_ROOT="$GAME_ROOT" $TU_ARGS
cmake --preset "$PRESET" -DSKATE3_GAME_DATA_ROOT="$GAME_ROOT" $TU_ARGS $CMAKE_ARGS
echo "==> Build"
cmake --build --preset "$PRESET" --parallel
@ -93,7 +99,13 @@ OUT="out/build/$PRESET"
STAGE="$NAME"
rm -rf "$STAGE"; mkdir -p "$STAGE"
cp "$OUT/$BIN" "$STAGE/"
cp "$OUT/$LIB" "$STAGE/" 2>/dev/null || true
# The rexglue runtime lib carries a config suffix (librexruntimerd.so for
# relwithdebinfo, librexruntime.so for release); the binary links whichever
# was built, so ship it under its real name.
RUNTIME="$(ls "$OUT"/librexruntime*.so "$OUT"/librexruntime*.dll "$OUT"/librexruntime*.dylib 2>/dev/null | head -1 || true)"
if [ -n "$RUNTIME" ]; then
cp "$RUNTIME" "$STAGE/"
fi
cp "$OUT/ghost_relay" "$STAGE/" 2>/dev/null || true
cp "$OUT/ghost_relay.exe" "$STAGE/" 2>/dev/null || true
# Title-update patches staged next to the binary when the build used the TU