#!/usr/bin/env bash # Compila o crisp-game-lib para Vircon32 (joyrider3774; MIT, a partir do crisp-game-lib de ABA Games; 266 minijogos em um # cartucho) do repositorio do autor (github.com/joyrider3774/crisp-game-lib-portable_vircon32, commit 9c18ea5) com a toolchain # oficial pinada (Builds/vircon32/). Sem mudancas no fonte; o passo opcional v32opt do Make.sh fica desligado (SKIP_V32OPT=1). # Dois builds seguidos; os dois .v32 precisam ter o mesmo SHA-256. # src/FredGames.Bundler/Builds/vircon32/install-toolchain.sh # uma vez # src/FredGames.Bundler/Builds/build-crisp-game-lib-vircon32.sh # Saida: artifacts/build/crisp-game-lib-vircon32/crisp-game-lib-vircon32-9c18ea5.v32 e ...-src.tar.gz set -euo pipefail here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" . "$here/vircon32/env.sh" [ -x "$V32_TOOLS/compile" ] || "$here/vircon32/install-toolchain.sh" SLUG=crisp-game-lib-vircon32 SRC_URL=https://github.com/joyrider3774/crisp-game-lib-portable_vircon32/archive/9c18ea52e4c60b0fd631ffdeb4a0dab6f12f3194.tar.gz SRC_SHA256=70d87d30fb78f9a5b4ebdf71a64df29c4ef50f6ed802a65726ce229c3982a531 OUT_NAME=crisp-game-lib-vircon32-9c18ea5 out="$v32_root/artifacts/build/$SLUG" tgz="$out/cache/crisp-game-lib-portable_vircon32-9c18ea5.tar.gz" mkdir -p "$out/cache" [ -f "$tgz" ] || curl -fsSL "$SRC_URL" -o "$tgz" echo "$SRC_SHA256 $tgz" | shasum -a 256 -c - >/dev/null prepare() { # $1 = pasta rm -rf "$1"; mkdir -p "$1/crisp-game-lib" tar -xzf "$tgz" -C "$1/crisp-game-lib" --strip-components 1 } for i in 1 2; do prepare "$out/tree$i" ( cd "$out/tree$i/crisp-game-lib" && SKIP_V32OPT=1 PATH="$V32_TOOLS:$PATH" bash Make.sh >"$out/build$i.log" 2>&1 ) \ || { tail -20 "$out/build$i.log" >&2; exit 1; } done a="$(shasum -a 256 "$out/tree1/crisp-game-lib/bin/crisp-game-lib.v32" | cut -d' ' -f1)" b="$(shasum -a 256 "$out/tree2/crisp-game-lib/bin/crisp-game-lib.v32" | cut -d' ' -f1)" [ "$a" = "$b" ] || { echo "Dois builds deram ROMs diferentes ($a x $b)" >&2; exit 1; } cp "$out/tree1/crisp-game-lib/bin/crisp-game-lib.v32" "$out/$OUT_NAME.v32" prepare "$out/srctree" files=(); while IFS= read -r -d '' f; do files+=("$f"); done < <(cd "$out/srctree" && find crisp-game-lib -type f -print0) python3 -I "$here/sprig-web/pack-source.py" "$out/$OUT_NAME-src.tar.gz" "$out/srctree" "${files[@]}" rm -rf "$out/tree1" "$out/tree2" "$out/srctree" echo "$a $out/$OUT_NAME.v32 (dois builds iguais)"