#!/usr/bin/env bash # Compila VIRUS LQP-79 (homebrew de Arduboy de TEAM a.r.g., MIT) do commit 9f664f0 de # github.com/Team-ARG-Museum/ID-40-VIRUS-LQP-79, com versoes fixas: o nucleo Arduino AVR 1.8.6 (LGPL-2.1; avr-gcc 7.3.0) e as # bibliotecas Arduboy2 6.0.0 (BSD-3); ArduboyTones 1.0.3 (MIT), pelo arduino-cli 1.5.1. O .hex publicado pelo autor nao e reproduzivel # (as versoes das bibliotecas e do nucleo que ele usou nao estao registradas); servimos este, cujo # fonte completo hospedamos junto: o jogo no commit, as bibliotecas, o nucleo AVR e este script. # # src/FredGames.Bundler/Builds/build-virus-lqp-79.sh # # Saida: artifacts/build/virus-lqp-79-9f664f0/VirusLQP79.hex set -euo pipefail CLI=1.5.1 CLI_SHA256=cb952e8c1621c95ef5f1d17831c945e3d0ec5973f89c557a7ec8feb9c4f7d4c9 CORE=1.8.6 GAME_URL=https://github.com/Team-ARG-Museum/ID-40-VIRUS-LQP-79/archive/9f664f0f7b87aca7654d8113b98e41e53c8f5ed0.tar.gz GAME_SHA256=61b9c5449d79afd2d0d8b644d1b3c82a348b4793886b4a522aeafbe5ce764d57 SKETCH_DIR="VLQP_AB" SKETCH=VLQP_AB LIB0=("Arduboy2" "https://github.com/MLXXXp/Arduboy2/archive/refs/tags/6.0.0.tar.gz" "34c5530b98167106f7fa7f5e7568e39512f689bf819b370abc9f6a212077bf06" "Arduboy2-6.0.0.tar.gz") LIB1=("ArduboyTones" "https://github.com/MLXXXp/ArduboyTones/archive/refs/tags/1.0.3.tar.gz" "d8d0482040a2aa8be31409309ebb89fdb74538dd74c506db1aa0a215bbca1532" "ArduboyTones-1.0.3.tar.gz") here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" root="$(git -C "$here" rev-parse --show-toplevel 2>/dev/null || pwd)" out="$root/artifacts/build/virus-lqp-79-9f664f0" cache="$root/artifacts/build/cache" tools="$root/artifacts/tools/arduino-$CLI" fetch() { # url sha256 arquivo [ -f "$cache/$3" ] || curl -fsSL "$1" -o "$cache/$3" echo "$2 $cache/$3" | shasum -a 256 -c - >/dev/null } mkdir -p "$cache" "$tools" fetch "https://github.com/arduino/arduino-cli/releases/download/v$CLI/arduino-cli_${CLI}_macOS_ARM64.tar.gz" "$CLI_SHA256" "arduino-cli_${CLI}_macOS_ARM64.tar.gz" fetch "$GAME_URL" "$GAME_SHA256" "ID-40-VIRUS-LQP-79-9f664f0.tar.gz" tar -xzf "$cache/arduino-cli_${CLI}_macOS_ARM64.tar.gz" -C "$tools" arduino-cli export ARDUINO_DIRECTORIES_DATA="$tools/data" ARDUINO_DIRECTORIES_DOWNLOADS="$tools/staging" ARDUINO_DIRECTORIES_USER="$tools/user" "$tools/arduino-cli" core update-index >/dev/null "$tools/arduino-cli" core install "arduino:avr@$CORE" >/dev/null rm -rf "$out" mkdir -p "$out/repo" "$out/src/$SKETCH" "$out/lib" "$out/hex" tar -xzf "$cache/ID-40-VIRUS-LQP-79-9f664f0.tar.gz" -C "$out/repo" --strip-components 1 cp -R "$out/repo/$SKETCH_DIR/." "$out/src/$SKETCH/" libs=() for v in LIB0 LIB1; do eval "lib=(\"\${$v[@]}\")" fetch "${lib[1]}" "${lib[2]}" "${lib[3]}" mkdir -p "$out/lib/${lib[0]}" tar -xzf "$cache/${lib[3]}" -C "$out/lib/${lib[0]}" --strip-components 1 libs+=(--library "$out/lib/${lib[0]}") done "$tools/arduino-cli" compile -b arduino:avr:leonardo "${libs[@]}" \ --output-dir "$out/hex" "$out/src/$SKETCH" >/dev/null cp "$out/hex/$SKETCH.ino.hex" "$out/VirusLQP79.hex" shasum -a 256 "$out/VirusLQP79.hex"