#!/usr/bin/env bash # Monta o Fifty Six LilyPads (Dimitri Masson, Ludum Dare 56 compo, MIT; p5.js 1.10.0, LGPL-2.1; p5.sound 1.0.1, MIT; p5.touchgui, LGPL-2.1 # segundo o package.json do autor, L05; Javascript-Voronoi 0.98, MIT, Raymond Hill) a partir do commit 82f11b6 de # github.com/dhmmasson/lilyFrogs. O autor publica um site Quarto; aqui entra so o jogo, numa pagina nossa (fifty-six-lilypads/index.html) com # os mesmos scripts do index.qmd, sem o buttons.github.io e com a fonte Cabin Sketch (SIL OFL 1.1, TTF original do google/fonts, commit # 6392e4f) servida da pasta no lugar do Google Fonts. O jogo em si (src/ e assets/) fica sem mudancas. O p5.min.js e o p5.sound.min.js do # repositorio sao iguais byte a byte aos de p5@1.10.0 do npm; o p5.touchgui.js e Voronoi sao os do repositorio (JavaScript legivel, sem # minificar). Ficam de fora a coverArt.png, o tema scss, os .kra e os demais fontes de arte (resources/). # O p5.js e LGPL: o fonte da versao servida (tag v1.10.0 de processing/p5.js) vai junto em "sources". # # src/FredGames.Bundler/Builds/build-fifty-six-lilypads.sh # # Saida: artifacts/build/fifty-six-lilypads-82f11b6/{dist.tar.gz,licenses.txt}; o tar.gz sai igual em dois builds seguidos. set -euo pipefail COMMIT=82f11b6154508be6bf7707b6d0843046f3172c69 SHA256=e67dbca94cb72f94b502048f084c12c56b292959c7f33e3a585137586e4ef324 P5=1.10.0 P5_NPM_SHA256=8dd481a013e221f367a9ada2a70d3be670e217a6733754965e74ba1fe02d1d40 P5_SRC_SHA256=5d98391f1420e1c7e138e7f822500cd6fce104cc7c5db5da2208f1b0889ba1b6 SOUND_SRC_SHA256=afea4bb4babd13766a771639bb3fd7bfd6aaca96113fff05f6f36707f6a413b4 GF=6392e4f212bab750be373234f29966cb268e1cfd here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" root="$(git -C "$here" rev-parse --show-toplevel 2>/dev/null || pwd)" out="$root/artifacts/build/fifty-six-lilypads-${COMMIT:0:7}" cache="$root/artifacts/build/cache" 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 - >/dev/null } fetch "https://github.com/dhmmasson/lilyFrogs/archive/$COMMIT.tar.gz" "dhmmasson_lilyFrogs-${COMMIT:0:7}.tar.gz" "$SHA256" fetch "https://registry.npmjs.org/p5/-/p5-$P5.tgz" "p5-$P5.tgz" "$P5_NPM_SHA256" fetch "https://github.com/processing/p5.js/archive/refs/tags/v$P5.tar.gz" "processing_p5.js-v$P5.tar.gz" "$P5_SRC_SHA256" fetch "https://github.com/processing/p5.js-sound/archive/refs/tags/v1.0.1.tar.gz" "processing_p5.js-sound-v1.0.1.tar.gz" "$SOUND_SRC_SHA256" fetch "https://raw.githubusercontent.com/google/fonts/$GF/ofl/cabinsketch/CabinSketch-Regular.ttf" "gf-${GF:0:7}-ofl_cabinsketch_CabinSketch-Regular.ttf" a6f989fcc910ca321e06cd6a20dbcab20f9e41bce084911432857cfe286355e7 fetch "https://raw.githubusercontent.com/google/fonts/$GF/ofl/cabinsketch/CabinSketch-Bold.ttf" "gf-${GF:0:7}-ofl_cabinsketch_CabinSketch-Bold.ttf" 0961688037b97947495c2e35e6e5a93f2b234490514e33346605ffedf9c7e6be fetch "https://raw.githubusercontent.com/google/fonts/$GF/ofl/cabinsketch/OFL.txt" "gf-${GF:0:7}-ofl_cabinsketch_OFL.txt" f6fc9fbae062e4efc1b0306e27715d43cd64a48b8ffba81c22034b8efee4fce2 rm -rf "$out"; mkdir -p "$out/tree" "$out/dist/libraries" "$out/dist/fonts" "$out/dist/assets" t="$out/tree"; d="$out/dist" tar -xzf "$cache/dhmmasson_lilyFrogs-${COMMIT:0:7}.tar.gz" -C "$t" --strip-components 1 tar -xzOf "$cache/p5-$P5.tgz" package/lib/p5.min.js > "$d/libraries/p5.min.js" tar -xzOf "$cache/p5-$P5.tgz" package/lib/addons/p5.sound.min.js > "$d/libraries/p5.sound.min.js" cmp "$d/libraries/p5.min.js" "$t/libraries/p5/p5.min.js" cmp "$d/libraries/p5.sound.min.js" "$t/libraries/p5/p5.sound.min.js" cp "$t/libraries/p5.touchgui.js" "$t/libraries/rhill-voronoi-core.js" "$d/libraries/" cp "$cache/gf-${GF:0:7}-ofl_cabinsketch_CabinSketch-Regular.ttf" "$d/fonts/CabinSketch-Regular.ttf" cp "$cache/gf-${GF:0:7}-ofl_cabinsketch_CabinSketch-Bold.ttf" "$d/fonts/CabinSketch-Bold.ttf" cp -R "$t/src" "$d/src" cp "$t"/assets/*.png "$t"/assets/*.mp3 "$t"/assets/*.wav "$d/assets/" rm "$d/assets/coverArt.png" cp "$here/fifty-six-lilypads/index.html" "$d/index.html" { echo "== Fifty Six LilyPads (LICENSE do repositorio, MIT)"; cat "$t/LICENSE" echo; echo "== p5.js $P5 (libraries/p5.min.js): license.txt do fonte (LGPL-2.1)" tar -xzOf "$cache/processing_p5.js-v$P5.tar.gz" "p5.js-$P5/license.txt" echo; echo "== p5.sound 1.0.1 (libraries/p5.sound.min.js): LICENSE do fonte (MIT)" tar -xzOf "$cache/processing_p5.js-sound-v1.0.1.tar.gz" p5.js-sound-1.0.1/LICENSE echo; echo "== p5.touchgui (libraries/p5.touchgui.js, L05): o package.json do projeto declara \"license\": \"LGPL-2.1\" (texto igual ao do p5.js acima); o arquivo servido e o JavaScript legivel do repositorio do jogo" echo; echo "== Javascript-Voronoi 0.98 (libraries/rhill-voronoi-core.js): MIT, o cabecalho do arquivo diz \"Copyright (C) 2010-2013 Raymond Hill ... MIT License\"" cat <<'MIT' Copyright (C) 2010-2013 Raymond Hill Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. MIT echo; echo "== Cabin Sketch (fonts/): OFL.txt do google/fonts" cat "$cache/gf-${GF:0:7}-ofl_cabinsketch_OFL.txt" } > "$out/licenses.txt" find "$d" -exec touch -t 202510070000 {} + ( 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 > dist.tar.gz && rm files.txt ) rm -rf "$t" "$d" ls -l "$out/dist.tar.gz"; shasum -a 256 "$out/dist.tar.gz" "$out/licenses.txt"