- make deb (tools/deb.sh) builds tidewall_<version>-1_amd64.deb with dpkg-deb: launchers in /usr/games, the game in /usr/lib/tidewall, a validated desktop entry, hicolor icons, man pages, a DEP-5 copyright, the engine's licences and md5sums. No maintainer scripts. Depends on libc6 (>= 2.28), from the binary's GLIBC symbol versions. - make deb-check (tools/deb_check.sh) checks it in a throwaway debian:13 container: apt install with no recommends, desktop-file-validate, icons, man pages and licences, tidewall on a user's PATH, the server and the game headless as a user, lintian, and a purge that leaves nothing behind. - The tarball gains a tidewall launcher (any directory, through a symlink), install-desktop-entry.sh (per-user menu entry, --remove), tidewall.png and ENGINE-LICENSES.txt (Godot's MIT text and bundled notices, which R1 lacked). make dist-check covers the launcher and the menu entry. - Application icon: a hand-written SVG in palette colours, rendered to 16-512 px by make app-icon, and set as the window icon. test_app_icon checks the renders, the colours and the setting. - Fix: looping ambience played into the Dummy audio driver could be reported as resources in use at exit. Directors play nothing without real audio output (SoundBank.has_output()) and stop their voices on exit. Tests: make check (648), make dist-check, make deb-check all pass. Closes #61 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
107 lines
5.5 KiB
Bash
Executable File
107 lines
5.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# R1: exports the Linux x86_64 game, which is also the dedicated server, with the
|
|
# official Godot export templates and packs them into build/dist/tidewall-<version>-linux-x86_64.tar.gz.
|
|
#
|
|
# tools/dist.sh
|
|
#
|
|
# The templates come from tools/godot/ (git-ignored), checked against
|
|
# tools/engine.sha512 before use, and are installed into the repo-local engine data
|
|
# (.godot-home/), never the user's home. The version is project.godot's
|
|
# application/config/version; the commit is written into the export as
|
|
# build_commit.txt, which BuildInfo reads.
|
|
#
|
|
# The package holds:
|
|
# tidewall.x86_64 the engine (the official release template)
|
|
# tidewall.pck the game
|
|
# tidewall-server runs the same game headless as a dedicated server, with
|
|
# clean SIGTERM handling
|
|
# tidewall starts the game from this folder, from any directory (R2)
|
|
# install-desktop-entry.sh adds it to the user's application menu (R2)
|
|
# tidewall.png the application icon
|
|
# server.cfg an example server configuration
|
|
# ENGINE-LICENSES.txt the Godot engine's licence and its third-party notices
|
|
# LICENSE, LICENSE-ASSETS, README.md, PROVENANCE.md, VERSION
|
|
set -euo pipefail
|
|
|
|
repo="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
cd "$repo"
|
|
|
|
engine_version="$(cut -d. -f1-3 tools/engine.version)" # 4.7.2
|
|
engine_tag="${engine_version}.$(cut -d. -f4 tools/engine.version)" # 4.7.2.stable
|
|
templates_zip="tools/godot/Godot_v${engine_version}-stable_export_templates.tpz"
|
|
templates_dir=".godot-home/data/godot/export_templates/$engine_tag"
|
|
|
|
version="$(sed -n 's/^config\/version="\(.*\)"$/\1/p' project.godot)"
|
|
[[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "dist FAIL: no version in project.godot" >&2; exit 1; }
|
|
commit="$(git rev-parse --short=12 HEAD)"
|
|
if [[ -n "$(git status --porcelain --untracked-files=no)" ]]; then
|
|
commit="$commit-dirty"
|
|
fi
|
|
name="tidewall-$version-linux-x86_64"
|
|
out="build/dist"
|
|
stage="$out/stage"
|
|
package="$out/$name"
|
|
|
|
tools/godot.sh --verify >/dev/null
|
|
|
|
# The official templates, checked, then only the Linux x86_64 ones installed.
|
|
if [[ ! -f "$templates_dir/linux_release.x86_64" || "$(cat "$templates_dir/.verified" 2>/dev/null)" != "$(grep 'export_templates\.tpz$' tools/engine.sha512 | cut -d' ' -f1)" ]]; then
|
|
[[ -f "$templates_zip" ]] || { echo "dist FAIL: missing $templates_zip (see tools/godot.sh)" >&2; exit 1; }
|
|
echo "dist: checking the export templates against tools/engine.sha512" >&2
|
|
grep 'export_templates\.tpz$' tools/engine.sha512 | sha512sum --check --quiet
|
|
mkdir -p "$templates_dir"
|
|
unzip -q -o -j "$templates_zip" templates/linux_release.x86_64 templates/linux_debug.x86_64 templates/version.txt -d "$templates_dir"
|
|
[[ "$(cat "$templates_dir/version.txt")" == "$engine_tag" ]] || { echo "dist FAIL: templates are for $(cat "$templates_dir/version.txt"), not $engine_tag" >&2; exit 1; }
|
|
grep 'export_templates\.tpz$' tools/engine.sha512 | cut -d' ' -f1 >"$templates_dir/.verified"
|
|
fi
|
|
|
|
rm -rf "$stage" "$package" "$out/$name.tar.gz" "$out/$name.tar.gz.sha256"
|
|
mkdir -p "$stage" "$package"
|
|
trap 'rm -f "$repo/build_commit.txt"' EXIT
|
|
printf '%s\n' "$commit" >build_commit.txt
|
|
tools/godot.sh --import --quit >/dev/null 2>&1 || true
|
|
|
|
export_preset() {
|
|
local preset="$1" target="$2" raw
|
|
echo "dist: exporting '$preset'" >&2
|
|
if ! raw="$(tools/godot.sh --export-release "$preset" "$repo/$target" 2>&1)"; then
|
|
echo "dist FAIL: exporting '$preset' failed" >&2
|
|
tail -n 20 <<<"$raw" >&2
|
|
exit 1
|
|
fi
|
|
if grep -E '^(ERROR|SCRIPT ERROR)' <<<"$raw" >&2; then
|
|
echo "dist FAIL: errors while exporting '$preset'" >&2
|
|
exit 1
|
|
fi
|
|
[[ -f "$repo/$target" ]] || { echo "dist FAIL: '$preset' wrote no $target" >&2; exit 1; }
|
|
}
|
|
export_preset "Linux" "$stage/tidewall.x86_64"
|
|
rm -f build_commit.txt
|
|
|
|
# The exported binary must be the verified official template, unchanged.
|
|
cmp -s "$stage/tidewall.x86_64" "$templates_dir/linux_release.x86_64" || { echo "dist FAIL: the exported binary isn't the release template" >&2; exit 1; }
|
|
install -m 0755 "$stage/tidewall.x86_64" "$package/tidewall.x86_64"
|
|
install -m 0644 "$stage/tidewall.pck" "$package/tidewall.pck"
|
|
install -m 0755 packaging/dist/tidewall-server "$package/tidewall-server"
|
|
install -m 0644 LICENSE LICENSE-ASSETS "$package/"
|
|
install -m 0644 packaging/server/server.cfg "$package/server.cfg"
|
|
install -m 0644 packaging/dist/README.md "$package/README.md"
|
|
install -m 0644 assets/PROVENANCE.md "$package/PROVENANCE.md"
|
|
install -m 0755 packaging/dist/tidewall "$package/tidewall"
|
|
install -m 0755 packaging/dist/install-desktop-entry.sh "$package/install-desktop-entry.sh"
|
|
install -m 0644 assets/icons/app/tidewall-256.png "$package/tidewall.png"
|
|
tools/godot.sh --script res://tools/engine_licenses.gd -- --out="$repo/$package/ENGINE-LICENSES.txt" >/dev/null 2>&1
|
|
grep -q "Permission is hereby granted" "$package/ENGINE-LICENSES.txt" || { echo "dist FAIL: no engine licence text" >&2; exit 1; }
|
|
chmod 0644 "$package/ENGINE-LICENSES.txt"
|
|
printf 'Tidewall %s\ncommit %s\nengine Godot %s\n' "$version" "$commit" "$(cat tools/engine.version)" >"$package/VERSION"
|
|
|
|
# Reproducible-ish archive: fixed owner, sorted names, mtimes from the commit.
|
|
stamp="$(git log -1 --format=%ct)"
|
|
tar --sort=name --owner=0 --group=0 --numeric-owner --mtime="@$stamp" \
|
|
-C "$out" -czf "$out/$name.tar.gz" "$name"
|
|
(cd "$out" && sha256sum "$name.tar.gz" >"$name.tar.gz.sha256")
|
|
rm -rf "$stage"
|
|
|
|
echo "dist: $out/$name.tar.gz ($(du -h "$out/$name.tar.gz" | cut -f1)), commit $commit"
|
|
tar -tzvf "$out/$name.tar.gz" | awk '{print " " $3 "\t" $6}'
|