#!/usr/bin/env bash # Gera o the-last-space-fighter.pyxapp de The Last Space Fighter (Antony Templier, MIT, MIT) a partir do commit 06cc263 do repositorio yuiio/last-space-fighter, # com mudancas nossas (publicadas junto do fonte): # the-last-space-fighter/web.patch sem a tecla Q (sair) e sem px.fullscreen(True), quit_key desligada, e as melhores pontuacoes # (JSON, o Pyodide nao tem dbm/shelve) vao para /saves/the-last-space-fighter, a pasta que o play/pyxel.html guarda no IndexedDB. # O .pyxapp leva so src/ (codigo e assets/shooter.pyxres) e o LICENSE. # Zip deterministico (Builds/pyxapp.py): dois builds seguidos dao o mesmo sha256. # # src/FredGames.Bundler/Builds/build-the-last-space-fighter.sh # # Saida: artifacts/build/the-last-space-fighter-06cc263/the-last-space-fighter.pyxapp set -euo pipefail COMMIT=06cc26395579ad3a73a3136732c751444430bef4 SHA256=145e637d3628472d8e871952ac59fa0b3b827bd3c6d8ac7a9ae5c99bb1dba5e4 here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" root="$(git -C "$here" rev-parse --show-toplevel 2>/dev/null || pwd)" out="$root/artifacts/build/the-last-space-fighter-06cc263" cache="$root/artifacts/build/cache" mkdir -p "$cache" tarball="$cache/the-last-space-fighter-06cc263.tar.gz" [ -f "$tarball" ] || curl -fsSL "https://github.com/yuiio/last-space-fighter/archive/$COMMIT.tar.gz" -o "$tarball" echo "$SHA256 $tarball" | shasum -a 256 -c - rm -rf "$out" mkdir -p "$out/tree" "$out/app/last-space-fighter" tar -xzf "$tarball" -C "$out/tree" --strip-components 1 patch -d "$out/tree" -p1 < "$here/the-last-space-fighter/web.patch" cp -R "$out/tree/src" "$out/tree/LICENSE" "$out/app/last-space-fighter/" python3 -I "$here/pyxapp.py" "$out/app/last-space-fighter" src/shooter.py "$out/the-last-space-fighter.pyxapp" shasum -a 256 "$out/the-last-space-fighter.pyxapp"