#!/usr/bin/env bash # Compila o Furniture: Screws and Blood (Lauren Hetherington, 7DRL 2023, MIT; repositorio laurheth/spooky-7drl) a partir # do commit fbe5cb5, como o package.json do autor manda: "npm ci" (package-lock.json dele, hashes de integridade do # npm; webpack 5, ts-loader, TypeScript 4.9, pixi.js 7 e @pixi/sound 5, MIT) e "webpack --mode=production # --node-env=production", com o Node 24.21.0 de artifacts/tools. Audio e sprites sao do repositorio (a autora diz no # README que arte, efeitos e musica sao dela: GIMP, JFXR e BeepBox). # # Mudancas no jogo (furniture-screws-and-blood/no-external.patch): sem o Google Fonts; a Questrial (SIL OFL 1.1) vem do # google/fonts no commit pinado e o script a copia para src/styles/ antes do build (o webpack a emite como asset). # # src/FredGames.Bundler/Builds/build-furniture-screws-and-blood.sh # # Saida: artifacts/build/furniture-screws-and-blood-fbe5cb5/furniture-screws-and-blood-fbe5cb5-dist.tar.gz (pasta dist/ do webpack; igual em dois builds seguidos). set -euo pipefail COMMIT=fbe5cb516cf7a5e934d07325a920e330a72f07f8 SHA256=430187c054315e72ef54bd650763726d4302f158b81e891fcb0f8b8b954f4e93 NODE=24.21.0 GF=https://raw.githubusercontent.com/google/fonts/9862abc066c9b83bf84c3e8ed1fc2d8d48f9bbf0 here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" root="$(git -C "$here" rev-parse --show-toplevel 2>/dev/null || pwd)" out="$root/artifacts/build/furniture-screws-and-blood-${COMMIT:0:7}" cache="$root/artifacts/build/cache" nodebin="$root/artifacts/tools/node-v$NODE/bin" tarball="furniture-screws-and-blood-${COMMIT:0:7}.tar.gz" [ -x "$nodebin/node" ] && [ "$("$nodebin/node" -v)" = "v$NODE" ] || { echo "Precisa do Node $NODE em $nodebin." >&2; exit 1; } export PATH="$nodebin:$PATH" fetch() { # url sha256 arquivo [ -f "$cache/$3" ] || curl -fsSL --retry 4 "$1" -o "$cache/$3" echo "$2 $cache/$3" | shasum -a 256 -c - >/dev/null } mkdir -p "$cache" fetch "https://github.com/laurheth/spooky-7drl/archive/$COMMIT.tar.gz" "$SHA256" "$tarball" fetch "$GF/ofl/questrial/Questrial-Regular.ttf" 0ee7f2debabb13773fd38468b31820e11fca202a8f98c4d80b6ffcb796899b6f gf-questrial-Questrial-Regular.ttf fetch "$GF/ofl/questrial/OFL.txt" c9bcf9bea97a216657d25325f418f0fe7fd0bc847b3dbb3f1b5a05b207370608 gf-questrial-OFL.txt rm -rf "$out" mkdir -p "$out/tree" tar -xzf "$cache/$tarball" -C "$out/tree" --strip-components 1 patch -s -p1 -d "$out/tree" < "$here/furniture-screws-and-blood/no-external.patch" cp "$cache/gf-questrial-Questrial-Regular.ttf" "$out/tree/src/styles/Questrial-Regular.ttf" cd "$out/tree" export npm_config_cache="$cache/npm-furniture-screws-and-blood" npm_config_update_notifier=false npm ci --ignore-scripts --no-audit --no-fund --loglevel=error npx webpack --mode=production --node-env=production 2>&1 | tail -3 [ -f dist/index.html ] cp -R dist "$out/dist" mkdir -p "$out/dist/fonts" cp "$cache/gf-questrial-OFL.txt" "$out/dist/fonts/Questrial-OFL.txt" cp LICENSE "$out/dist/LICENSE" find "$out/dist" -exec touch -t 202510300000 {} + ( cd "$out" && find dist -type f | LC_ALL=C sort > files.txt \ && COPYFILE_DISABLE=1 tar --format=ustar --uid 0 --gid 0 --uname root --gname root -n -cf - -T files.txt \ | gzip -n -9 > "furniture-screws-and-blood-${COMMIT:0:7}-dist.tar.gz" && rm files.txt ) cd "$root" rm -rf "$out/tree" ls -l "$out/furniture-screws-and-blood-${COMMIT:0:7}-dist.tar.gz" shasum -a 256 "$out/furniture-screws-and-blood-${COMMIT:0:7}-dist.tar.gz"