#!/usr/bin/env bash # Gera o waiting-for-a-bite.love do Waiting for a Bite (Alexander Griffith, codigo GPL-3.0-or-later, arte e musica # CC BY, ver LICENSE.txt do jogo) a partir do commit 506eeb6 do sr.ht, com um patch nosso # (publicado junto do fonte): waiting-for-a-bite/windowed.patch tira o inicio em tela cheia (conf.lua) e a tecla Esc que # alternava a tela cheia (o quadro da pagina ja cuida disso; o Esc cancela o lance da vara). Como no makefile do autor (alvo # $(LOVEFILE)) entram *.lua, src/, lib/ e assets/; o Fennel nao e compilado antes: o main.lua do autor carrega os # .fnl em tempo de execucao, igual ao build web dele. Entram tambem license.txt e credits. O .love e um zip # deterministico (ordem alfabetica, data fixa, deflate). # # src/FredGames.Bundler/Builds/build-waiting-for-a-bite.sh # # Saida: artifacts/build/waiting-for-a-bite-506eeb6/waiting-for-a-bite.love set -euo pipefail COMMIT=506eeb6d49f403b779a344257f1402e673943c9d SHA256=ac9eba0cacb56b7df61f9e529a55269bd178ec7ce67d0909b2676f4eaeb13e93 here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" root="$(git -C "$here" rev-parse --show-toplevel 2>/dev/null || pwd)" out="$root/artifacts/build/waiting-for-a-bite-506eeb6" cache="$root/artifacts/build/cache" mkdir -p "$cache" tarball="$cache/waiting-for-a-bite-506eeb6.tar.gz" [ -f "$tarball" ] || curl -fsSL "https://git.sr.ht/~alexjgriffith/bite/archive/$COMMIT.tar.gz" -o "$tarball" echo "$SHA256 $tarball" | shasum -a 256 -c - rm -rf "$out" mkdir -p "$out/tree" "$out/game" tar -xzf "$tarball" -C "$out/tree" --strip-components 1 patch -d "$out/tree" -p1 < "$here/waiting-for-a-bite/windowed.patch" cd "$out/tree" cp main.lua conf.lua license.txt credits "$out/game/" cp -R src lib assets "$out/game/" python3 -I - "$out/game" "$out/waiting-for-a-bite.love" <<'PY' import os, sys, zipfile src, dest = sys.argv[1:] names = [] for base, dirs, files in os.walk(src): for f in files: names.append(os.path.relpath(os.path.join(base, f), src).replace(os.sep, '/')) with zipfile.ZipFile(dest, 'w', zipfile.ZIP_DEFLATED, compresslevel=9) as z: for rel in sorted(names): info = zipfile.ZipInfo(rel, (1980, 1, 1, 0, 0, 0)) info.compress_type = zipfile.ZIP_DEFLATED info.external_attr = 0o644 << 16 info.create_system = 3 with open(os.path.join(src, rel), 'rb') as fh: z.writestr(info, fh.read(), compresslevel=9) PY shasum -a 256 "$out/waiting-for-a-bite.love"