#!/usr/bin/env bash # Exporta o Blutfest (hepfnepf, clone de Crimsonland em Godot 3.x; codigo GPL-3.0, sprites e sons de varios autores em # CC0, CC BY 3.0/4.0 e um missil GPL-2.0, creditos no Credits.txt e na tela de creditos do jogo; musicas do FreePD; # github.com/hepfnepf/Blutfest, commit 53ce9cc) para a web com o Godot 3.5.3 oficial: renderer GLES2 do projeto, modelo # webassembly_release (sem threads), sem PWA. O preset de exportacao e nosso. Por ser GPL, o fonte exato vai junto (o # repositorio sem android/, o modelo de build do Android que nao entra no jogo web, e sem .import/, cache de importacao # gerado, com nomes longos demais para o ustar) e as mudancas no projeto sao as de blutfest/patch.py (creditos sem links, traducoes sem reimportar, sprite do # gelo nosso no lugar do original sem licenca clara, botao Exit escondido). # # src/FredGames.Bundler/Builds/build-blutfest.sh # # Saida: artifacts/build/blutfest-53ce9cc/{web/,blutfest-53ce9cc.tar.gz}. set -euo pipefail SLUG=blutfest COMMIT=53ce9cc9c8c2acb0a1f53d829d6a3367e9fd1c25 SHORT=${COMMIT:0:7} SHA256=69911cf3c4b73123f96daa45592c49f4c6d2041462823292f6ee0f96e39896b6 GODOT=3.5.3 GODOT_URL=https://github.com/godotengine/godot/releases/download/$GODOT-stable GODOT_MAC_SHA256=d448bf70a438edfd506c6878963327d7814d83fd636d132294fb7abb1f971246 GODOT_TPZ_SHA256=ae3c1f6fbd431b9e3b67c1f9e42539a6d270a0ccc35558f13072f04b968312d1 here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" root="$(git -C "$here" rev-parse --show-toplevel 2>/dev/null || pwd)" out="$root/artifacts/build/$SLUG-$SHORT" cache="$root/artifacts/build/cache" tools="$root/artifacts/tools" mkdir -p "$cache" fetch() { if [ ! -f "$cache/$2" ]; then curl -fsSL --retry 4 "$1" -o "$cache/$2.partial" && mv "$cache/$2.partial" "$cache/$2" fi echo "$3 $cache/$2" | shasum -a 256 -c - } install_godot() { [ -d "$tools/godot-$GODOT" ] && return 0 fetch "$GODOT_URL/Godot_v$GODOT-stable_osx.universal.zip" "Godot_v$GODOT-stable_osx.universal.zip" "$GODOT_MAC_SHA256" fetch "$GODOT_URL/Godot_v$GODOT-stable_export_templates.tpz" "Godot_v$GODOT-stable_export_templates.tpz" "$GODOT_TPZ_SHA256" rm -rf "$tools/godot-$GODOT.tmp" mkdir -p "$tools/godot-$GODOT.tmp" unzip -q "$cache/Godot_v$GODOT-stable_osx.universal.zip" -d "$tools/godot-$GODOT.tmp" unzip -q "$cache/Godot_v$GODOT-stable_export_templates.tpz" templates/webassembly_release.zip templates/version.txt \ -d "$tools/godot-$GODOT.tmp" mv "$tools/godot-$GODOT.tmp" "$tools/godot-$GODOT" } if [ "${1:-}" = "--install" ]; then install_godot; exit 0; fi fetch "https://github.com/hepfnepf/Blutfest/archive/$COMMIT.tar.gz" "$SLUG-$SHORT.tar.gz" "$SHA256" if [ ! -d "$tools/godot-$GODOT" ]; then lockf -k "$root/artifacts/godot-$GODOT.lock" bash "${BASH_SOURCE[0]}" --install fi rm -rf "$out" mkdir -p "$out/tree" "$out/web" tar -xzf "$cache/$SLUG-$SHORT.tar.gz" -C "$out/tree" --strip-components 1 rm -rf "$out/tree/android" project="$out/tree" # Mudancas no projeto (ver patch.py): sem links para sites externos; aviso de modificacao (AGPL). python3 -I "$here/$SLUG/patch.py" "$project" cat > "$out/tree/FREDYGAMES-CHANGES.txt" <<'EOF' This is Blutfest (https://github.com/hepfnepf/Blutfest, commit 53ce9cc9c8c2acb0a1f53d829d6a3367e9fd1c25), changed for FredyGames on 2026-11-06 (GPL-3.0). The changes: the android/ folder (the Android build template, not part of the web game) was left out, the credits screen no longer opens links, the translation CSV is not re-imported, the sprite of the icicle projectile is a drawing of ours (blutfest-icicle.png, made by blutfest-make_icicle.py, CC0) and the Exit button is hidden (see blutfest-patch.py, published next to this archive). Nothing else was changed. EOF # Data fixa nos arquivos e fonte publicado: o projeto (ja com as mudancas acima), em tar deterministico # (ordem, dono e data fixos), sem o export_presets.cfg do autor. TZ=UTC find "$out/tree" -exec touch -t 202001010000 {} + ( cd "$out/tree" && find . -type f | sed 's|^\./||' | grep -v '^\.import/' | LC_ALL=C sort > "$out/files.txt" ) ( cd "$out/tree" && COPYFILE_DISABLE=1 tar --format=ustar --uid 0 --gid 0 --uname root --gname root -n \ -cf - -T "$out/files.txt" ) | gzip -n -9 > "$out/$SLUG-$SHORT.tar.gz" cp "$here/$SLUG/export_presets.cfg" "$project/export_presets.cfg" export HOME="$out/home" TZ=UTC LC_ALL=C templates="$HOME/Library/Application Support/Godot/templates/$GODOT.stable" mkdir -p "$templates" cp "$tools/godot-$GODOT/templates/webassembly_release.zip" "$tools/godot-$GODOT/templates/version.txt" "$templates/" godot="$tools/godot-$GODOT/Godot.app/Contents/MacOS/Godot" cd "$project" # O editor do Godot 3 sai do --quit antes de terminar de importar ("Scan thread aborted"): o que falta # (audio, modelos) so e importado durante um export. Por isso: uma passada do editor, um export descartavel # (que termina de importar) e o export final, que nao pode ter reimportado nada nem falhado em abrir um # recurso importado. "$godot" --path . --editor --quit --no-window > "$out/import.log" 2>&1 || true mkdir -p "$out/warmup" "$godot" --path . --export "Web" "$out/warmup/index.html" --no-window > "$out/warmup.log" 2>&1 || true rm -rf "$out/warmup" "$godot" --path . --export "Web" "$out/web/index.html" --no-window > "$out/export.log" 2>&1 if grep -q -E "Cannot open file|reimport: begin|Scan thread aborted" "$out/export.log"; then echo "export com importacao incompleta, veja $out/export.log" >&2; exit 1 fi ls -l "$out/web"