#!/bin/sh
# Rebuild the Play engines. The WASM binaries in public/play/engines are what
# the site serves. Vercel does not compile these. Corresponding source is the
# upstream revision below, plus the patches in scripts/patches.
set -eu

echo "Chocolate Doom a2dfd51fcc00d272dc8a17a97ccd6683333ff4ea"
echo "  emsdk 3.1.74"
echo "  autoreconf -fi && emconfigure ./configure --disable-sdl2net --disable-doc --disable-bash-completion"
echo "  emmake make -j2"
echo "  copy src/chocolate-doom.js and src/chocolate-doom.wasm"

echo "EDuke32-WASM 37b56eefaf8125eaa853c417512019cc7ad94b81"
echo "  emsdk 3.1.74"
echo "  apply scripts/patches/eduke32-emscripten.patch  # stdout redirect, INITIAL_MEMORY 128MB"
echo "  make PLATFORM=EMSCRIPTEN EM_SINGLE_FILE=0 NETDUKE32=1 NETNATIVE=0 GAME_DATA= obj=obj-em -j2"
echo "  NETNATIVE=0 leaves the Nostr transport out. GAME_DATA empty keeps the shareware GRP out of the binary."
echo "  The page does not load the upstream multiplayer bundle or the retail GRP picker."
echo "  copy eduke32.js and eduke32.wasm"

echo "ScummVM v2026.4.0 7d2709da5136866589f7602f5f5a7b17de03420e"
echo "  apply scripts/patches/scummvm-shell-pre.patch"
echo "  apply scripts/patches/scummvm-ini-path.patch"
echo "  dists/emscripten/build.sh setup   # emsdk 4.0.10"
echo "  dists/emscripten/build.sh configure --disable-all-engines --enable-engine=sky,lure \\"
echo "    --disable-cloud --disable-updates --disable-flac --disable-vorbis --disable-mad \\"
echo "    --disable-png --disable-jpeg --disable-theoradec --disable-faad --disable-mpeg2 \\"
echo "    --disable-a52 --disable-fluidsynth --disable-sdlnet --opengl-mode=none"
echo "  emmake make -j2 && emmake make dist-emscripten"
echo "  copy scummvm.js, scummvm.wasm, scummvm.ini, and build-emscripten/data (without index.json)"
