#!/usr/bin/env bash # Gera o exo-encounter-667.love do EXO_encounter 667 (Phil Hagelberg, codigo GPL-3.0, musica/arte em licencas Creative # Commons e dominio publico, ver LICENSE.txt do jogo) a partir do commit 5a5037b do sr.ht, sem patch. Como no makefile # do autor: o codigo Fennel (*.fnl da raiz) e compilado para Lua com o compilador dele (lib/fennel, --compile # --correlate; precisa de um `lua` no PATH) e entram *.lua, lib/, assets/ e text/. O .love e um zip deterministico # (ordem alfabetica, data fixa, deflate). # # src/FredGames.Bundler/Builds/build-exo-encounter-667.sh # # Saida: artifacts/build/exo-encounter-667-5a5037b/exo-encounter-667.love set -euo pipefail COMMIT=5a5037b74c1af8e6b41da893df38bfc835505097 SHA256=078041f56cd0abcc84e4ceaaaf1c29031fd5b91122b43cac53e0ad2b75e31896 here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" root="$(git -C "$here" rev-parse --show-toplevel 2>/dev/null || pwd)" out="$root/artifacts/build/exo-encounter-667-5a5037b" cache="$root/artifacts/build/cache" mkdir -p "$cache" tarball="$cache/exo-encounter-667-5a5037b.tar.gz" [ -f "$tarball" ] || curl -fsSL "https://git.sr.ht/~technomancy/exo-encounter-667/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 cd "$out/tree" for f in *.fnl; do lua lib/fennel --compile --correlate "$f" > "$out/game/${f%.fnl}.lua" done cp main.lua conf.lua map.lua license.txt "$out/game/" cp -R lib assets text "$out/game/" python3 -I - "$out/game" "$out/exo-encounter-667.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/exo-encounter-667.love"