R2: Debian package, desktop entry, launcher and application icon

- 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>
This commit is contained in:
2026-11-14 03:12:47 -05:00
co-authored by Claude Opus 5.5
parent 9b5064d7a8
commit f3161bf46c
47 changed files with 1078 additions and 4 deletions
+48
View File
@@ -0,0 +1,48 @@
## R2: renders the application icon, assets/icons/app/tidewall.svg (written by hand),
## to the PNG sizes desktops ask for: assets/icons/app/tidewall-<N>.png. Deterministic,
## so `make app-icon` after editing the SVG and commit what changes.
##
## tools/godot.sh --script res://tools/app_icon.gd [-- --out=DIR]
extends SceneTree
const SOURCE: String = "res://assets/icons/app/tidewall.svg"
const SIZES: Array[int] = [16, 24, 32, 48, 64, 128, 256, 512]
## The SVG's own width and height.
const SVG_SIDE: float = 256.0
func _init() -> void:
var out: String = "res://assets/icons/app"
for arg: String in OS.get_cmdline_user_args():
if arg.begins_with("--out="):
out = arg.get_slice("=", 1)
var svg: String = FileAccess.get_file_as_string(SOURCE)
if svg.is_empty():
push_error("app_icon: can't read %s" % SOURCE)
quit(1)
return
DirAccess.make_dir_recursive_absolute(out)
for side: int in SIZES:
var image: Image = render(svg, side)
if image == null:
quit(1)
return
var path: String = "%s/tidewall-%d.png" % [out, side]
if image.save_png(path) != OK:
push_error("app_icon: can't write %s" % path)
quit(1)
return
print("app_icon: %s" % path)
quit(0)
## The icon at `side` pixels square, or null.
static func render(svg: String, side: int) -> Image:
var image: Image = Image.new()
if image.load_svg_from_string(svg, side / SVG_SIDE) != OK:
push_error("app_icon: the SVG doesn't load")
return null
if image.get_width() != side or image.get_height() != side:
image.resize(side, side, Image.INTERPOLATE_LANCZOS)
image.convert(Image.FORMAT_RGBA8)
return image
+1
View File
@@ -0,0 +1 @@
uid://bcg1243rv4dl5
Executable
+76
View File
@@ -0,0 +1,76 @@
#!/usr/bin/env bash
# R2: builds build/dist/tidewall_<version>-1_amd64.deb from the release package that
# tools/dist.sh makes, with dpkg-deb. Nothing is installed on this machine; see
# tools/deb_check.sh for the check in a clean Debian 13 container.
#
# tools/deb.sh
#
# Layout:
# /usr/games/tidewall, /usr/games/tidewall-server launchers
# /usr/lib/tidewall/ engine, game pack, server wrapper
# /usr/share/applications/tidewall.desktop menu entry
# /usr/share/icons/hicolor/*/apps/tidewall.{png,svg} icons
# /usr/share/man/man6/tidewall{,-server}.6.gz manual pages
# /usr/share/doc/tidewall/ copyright, README, provenance,
# engine licences, example server.cfg
# The desktop and icon caches are refreshed by dpkg triggers, so the package has no
# maintainer scripts.
set -euo pipefail
repo="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$repo"
tools/dist.sh >/dev/null
version="$(sed -n 's/^config\/version="\(.*\)"$/\1/p' project.godot)"
package="build/dist/tidewall-$version-linux-x86_64"
commit="$(sed -n 's/^commit //p' "$package/VERSION")"
debversion="$version-1"
deb="build/dist/tidewall_${debversion}_amd64.deb"
root="build/deb/root"
stamp="$(git log -1 --format=%ct)"
rm -rf build/deb "$deb" "$deb.sha256"
lib="$root/usr/lib/tidewall"
doc="$root/usr/share/doc/tidewall"
mkdir -p "$lib" "$root/usr/games" "$root/usr/share/applications" "$doc/examples" "$root/DEBIAN"
install -m 0755 "$package/tidewall.x86_64" "$lib/tidewall.x86_64"
install -m 0644 "$package/tidewall.pck" "$lib/tidewall.pck"
install -m 0755 "$package/tidewall-server" "$lib/tidewall-server"
install -m 0755 packaging/deb/tidewall "$root/usr/games/tidewall"
install -m 0755 packaging/deb/tidewall-server "$root/usr/games/tidewall-server"
install -m 0644 packaging/deb/tidewall.desktop "$root/usr/share/applications/tidewall.desktop"
for side in 16 24 32 48 64 128 256 512; do
install -D -m 0644 "assets/icons/app/tidewall-$side.png" "$root/usr/share/icons/hicolor/${side}x${side}/apps/tidewall.png"
done
install -D -m 0644 assets/icons/app/tidewall.svg "$root/usr/share/icons/hicolor/scalable/apps/tidewall.svg"
mkdir -p "$root/usr/share/man/man6"
for page in tidewall tidewall-server; do
gzip -9n -c "packaging/deb/man/$page.6" >"$root/usr/share/man/man6/$page.6.gz"
chmod 0644 "$root/usr/share/man/man6/$page.6.gz"
done
install -m 0644 packaging/deb/copyright "$doc/copyright"
install -m 0644 packaging/dist/README.md "$doc/README.md"
install -m 0644 "$package/server.cfg" "$doc/examples/server.cfg"
gzip -9n -c "$package/PROVENANCE.md" >"$doc/PROVENANCE.md.gz"
gzip -9n -c "$package/ENGINE-LICENSES.txt" >"$doc/ENGINE-LICENSES.gz"
{
printf 'tidewall (%s) unstable; urgency=medium\n\n' "$debversion"
printf ' * Release package built from commit %s.\n\n' "$commit"
printf ' -- Tidewall developers <claude@eom.dev> %s\n' "$(LC_ALL=C date -u -R -d "@$stamp")"
} | gzip -9n >"$doc/changelog.Debian.gz"
chmod 0644 "$doc"/*.gz
size="$(du -sk --apparent-size --exclude=DEBIAN "$root" | cut -f1)"
sed -e "s/@VERSION@/$debversion/" -e "s/@SIZE@/$size/" packaging/deb/control >"$root/DEBIAN/control"
(cd "$root" && find usr -type f -print0 | LC_ALL=C sort -z | xargs -0 md5sum) >"$root/DEBIAN/md5sums"
chmod 0644 "$root/DEBIAN/control" "$root/DEBIAN/md5sums"
find "$root" -type d -exec chmod 0755 {} +
find "$root" -exec touch --no-dereference -d "@$stamp" {} +
SOURCE_DATE_EPOCH="$stamp" dpkg-deb --root-owner-group -Zxz --build "$root" "$deb" >/dev/null
(cd build/dist && sha256sum "$(basename "$deb")" >"$(basename "$deb").sha256")
rm -rf build/deb
echo "deb: $deb ($(du -h "$deb" | cut -f1)), commit $commit"
dpkg-deb --info "$deb" | sed -n 's/^ \(Package\|Version\|Installed-Size\|Depends\):/ \1:/p'
+89
View File
@@ -0,0 +1,89 @@
#!/usr/bin/env bash
# R2: builds the .deb (tools/deb.sh) and checks it in a throwaway Debian 13 container,
# never on this machine:
# - it installs with apt, with only its Depends (no recommended graphics libraries);
# - the desktop entry passes desktop-file-validate and its icons are in place;
# - the dedicated server runs a bot match headless as an ordinary user, from PATH;
# - the game itself starts headless, plays an offline match for a few seconds and
# reports that it played;
# - lintian, for information (its findings are printed, see docs/DEVLOG.md);
# - it purges cleanly: no file it installed is left behind.
#
# tools/deb_check.sh about 3 minutes, needs Docker and Debian's mirrors
set -uo pipefail
repo="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$repo"
tools/deb.sh || { echo "deb-check FAIL: tools/deb.sh failed"; exit 1; }
deb="$(ls -t build/dist/tidewall_*_amd64.deb | head -n 1)"
name="tidewall-deb-check-$$"
cleanup() { docker rm -f "$name" >/dev/null 2>&1 || true; }
trap cleanup EXIT
docker run --rm --name "$name" --memory=3g --cpus=4 \
-v "$repo/$deb:/check/tidewall.deb:ro" debian:13 bash -c '
set -uo pipefail
status=0
fail() { echo "deb-check FAIL: $*"; status=1; }
export DEBIAN_FRONTEND=noninteractive
apt-get update -qq >/dev/null || { echo "deb-check FAIL: apt-get update"; exit 1; }
apt-get install -y -qq --no-install-recommends desktop-file-utils lintian >/dev/null 2>&1 || { echo "deb-check FAIL: tools"; exit 1; }
echo "deb-check: install"
apt-get install -y -qq --no-install-recommends /check/tidewall.deb >/tmp/install.log 2>&1 || { tail -n 20 /tmp/install.log; echo "deb-check FAIL: install"; exit 1; }
dpkg -s tidewall | sed -n "s/^\(Status\|Version\): / \1: /p"
dpkg -L tidewall | sort >/tmp/files
echo "deb-check: desktop entry and icons"
desktop-file-validate /usr/share/applications/tidewall.desktop && echo " desktop-file-validate: ok" || fail "desktop-file-validate"
for side in 16 32 48 64 128 256; do
[ -s "/usr/share/icons/hicolor/${side}x${side}/apps/tidewall.png" ] || fail "no ${side}px icon"
done
[ -s /usr/share/icons/hicolor/scalable/apps/tidewall.svg ] || fail "no scalable icon"
[ -s /usr/share/doc/tidewall/copyright ] || fail "no copyright file"
zcat /usr/share/doc/tidewall/ENGINE-LICENSES.gz >/tmp/engine-licenses
grep -q "Permission is hereby granted" /tmp/engine-licenses || fail "no engine licence"
man_ok=1
for page in tidewall tidewall-server; do [ -s "/usr/share/man/man6/$page.6.gz" ] || man_ok=0; done
[ "$man_ok" -eq 1 ] || fail "manual pages missing"
useradd -m player
# A login shell, as the desktop has: its PATH has /usr/games, root'"'"'s does not.
exec_name="$(sed -n "s/^Exec=//p" /usr/share/applications/tidewall.desktop)"
su - player -c "command -v $exec_name" >/dev/null || fail "the entry runs $exec_name, which is not on a user'"'"'s PATH"
echo "deb-check: the server, headless, as a user"
su - player -c "tidewall-server --seed=2 --bots=24 --ticks=900 --unthrottled" >/tmp/server.log 2>&1
code=$?
[ "$code" -eq 0 ] || { tail -n 5 /tmp/server.log; fail "the server exited $code"; }
grep -q "\"event\":\"start\"" /tmp/server.log || fail "the server never started"
grep -q "\"errors\":0,\"event\":\"stop\"" /tmp/server.log || fail "the server logged errors"
grep -m1 "\"event\":\"stop\"" /tmp/server.log | cut -c1-160 | sed "s/^/ /"
echo "deb-check: the game, headless, an offline match"
su - player -c "tidewall --headless -- --offline --autoplay --client-seconds=15" >/tmp/game.log 2>&1
code=$?
report="$(grep -m1 "\"event\":\"client\"" /tmp/game.log || true)"
echo " ${report:0:200}"
[ "$code" -eq 0 ] || { tail -n 5 /tmp/game.log; fail "the game exited $code"; }
[ -n "$report" ] || fail "the game printed no report"
if grep -qE "^(ERROR|SCRIPT ERROR|WARNING: .*leaked)" /tmp/game.log; then grep -m3 -E "^(ERROR|SCRIPT ERROR|WARNING)" /tmp/game.log | sed "s/^/ /"; fail "the game logged errors"; fi
ls -d /home/player/.local/share/godot/app_userdata/Tidewall >/dev/null 2>&1 && echo " user data in ~/.local/share/godot/app_userdata/Tidewall"
echo "deb-check: lintian (for information)"
lintian --tag-display-limit 0 /check/tidewall.deb 2>&1 | sed "s/^/ /" || true
echo "deb-check: purge"
apt-get purge -y -qq tidewall >/tmp/purge.log 2>&1 || fail "purge"
dpkg -s tidewall >/dev/null 2>&1 && fail "still installed after purge"
left=0
while read -r path; do
case "$path" in /.|/|/usr|/usr/share/man|/usr/share/man/man6|/usr/games|/usr/lib|/usr/share|/usr/share/*/|/usr/share/applications|/usr/share/doc|/usr/share/icons|/usr/share/icons/hicolor|/usr/share/icons/hicolor/*/apps|/usr/share/icons/hicolor/*) [ -d "$path" ] && continue ;; esac
if [ -e "$path" ]; then echo " left behind: $path"; left=1; fi
done </tmp/files
[ "$left" -eq 0 ] && echo " nothing left behind" || fail "files left after purge"
exit $status
'
status=$?
[[ "$status" -eq 0 ]] && echo "deb-check: ok ($deb)" || echo "deb-check: FAILED"
exit "$status"
+10
View File
@@ -15,7 +15,11 @@
# 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
@@ -83,6 +87,12 @@ 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.
+25 -1
View File
@@ -37,7 +37,7 @@ package="$work/$name"
export HOME="$work/home" XDG_DATA_HOME="$work/home/data" XDG_CONFIG_HOME="$work/home/config" XDG_CACHE_HOME="$work/home/cache" XDG_STATE_HOME="$work/home/state"
mkdir -p "$HOME"
expected="LICENSE LICENSE-ASSETS PROVENANCE.md README.md VERSION server.cfg tidewall-server tidewall.pck tidewall.x86_64"
expected="ENGINE-LICENSES.txt LICENSE LICENSE-ASSETS PROVENANCE.md README.md VERSION install-desktop-entry.sh server.cfg tidewall tidewall-server tidewall.pck tidewall.png tidewall.x86_64"
actual="$(cd "$package" && ls -A | LC_ALL=C sort | tr '\n' ' ' | sed 's/ $//')"
[[ "$actual" == "$expected" ]] || fail "the package holds '$actual', expected '$expected'"
version="$(sed -n 's/^Tidewall //p' "$package/VERSION")"
@@ -89,6 +89,30 @@ playing="$(sed -n 's/.*"frames_playing":\([0-9]*\).*/\1/p' <<<"$report")"
grep -q '"event":"player_joined".*"name":"Mara"' "$server_log" || fail "the server never saw the game join"
grep -q '"errors":0,"event":"stop"' "$server_log" || fail "the server logged errors"
echo " game: joined, in the match for ${playing:-0} frames"
echo "dist-check: the launcher from another directory, and the menu entry" >&2
mkdir -p "$work/elsewhere"
ln -s "$package/tidewall" "$work/elsewhere/tidewall-link"
launch_log="$work/launch.log"
(cd / && timeout --signal=KILL 120 nice -n 15 "$work/elsewhere/tidewall-link" --headless -- --offline --autoplay --client-seconds=8 >"$launch_log" 2>&1)
launch_code=$?
[[ "$launch_code" -eq 0 ]] || fail "the launcher, through a symlink from /, exited $launch_code"
grep -q '"event":"client"' "$launch_log" || fail "the launcher's game said nothing"
if grep -qE '^(ERROR|SCRIPT ERROR|WARNING: .*leaked)' "$launch_log"; then
grep -m3 -E '^(ERROR|SCRIPT ERROR|WARNING)' "$launch_log" | sed 's/^/ /'
fail "the launcher's game logged errors"
fi
menu="$work/menu"
XDG_DATA_HOME="$menu" "$package/install-desktop-entry.sh" >/dev/null || fail "install-desktop-entry.sh failed"
entry="$menu/applications/tidewall.desktop"
[[ -s "$entry" && -s "$menu/icons/hicolor/256x256/apps/tidewall.png" ]] || fail "no menu entry or icon after install-desktop-entry.sh"
grep -qx "Exec=\"$package/tidewall\"" "$entry" || fail "the menu entry doesn't run this folder's launcher"
if command -v desktop-file-validate >/dev/null; then
desktop-file-validate "$entry" || fail "the menu entry doesn't validate"
fi
XDG_DATA_HOME="$menu" "$package/install-desktop-entry.sh" --remove >/dev/null
[[ ! -e "$entry" ]] || fail "--remove left the menu entry"
echo " launcher: played offline through a symlink from /; menu entry added, validated and removed"
if [[ -n "$(ls -A "$HOME/data" 2>/dev/null | grep -v '^godot$')" ]]; then
fail "the package wrote outside the engine's user data: $(ls -A "$HOME/data")"
fi
+68
View File
@@ -0,0 +1,68 @@
## R2: writes the Godot engine's own licence and the notices of the third-party code
## built into it, as the engine reports them (Engine.get_license_text(),
## get_copyright_info(), get_license_info()). The MIT licence and the others need these
## notices to travel with the binary, so the release package and the .deb ship this file.
##
## tools/godot.sh --script res://tools/engine_licenses.gd -- --out=PATH
extends SceneTree
func _init() -> void:
var out: String = ""
for arg: String in OS.get_cmdline_user_args():
if arg.begins_with("--out="):
out = arg.get_slice("=", 1)
if out.is_empty():
printerr("engine_licenses: --out=PATH is required")
quit(2)
return
var file: FileAccess = FileAccess.open(out, FileAccess.WRITE)
if file == null:
printerr("engine_licenses: can't write %s" % out)
quit(1)
return
file.store_string(text())
file.close()
quit(0)
static func text() -> String:
var version: Dictionary = Engine.get_version_info()
var lines: PackedStringArray = PackedStringArray()
lines.append("Tidewall runs on the Godot Engine %s (https://godotengine.org)." % version["string"])
lines.append("The engine's licence, and the copyright notices and licences of the")
lines.append("third-party code built into it, as the engine itself reports them.")
lines.append("")
lines.append("=" .repeat(78))
lines.append("Godot Engine")
lines.append("=" .repeat(78))
lines.append("")
lines.append(Engine.get_license_text().strip_edges())
lines.append("")
lines.append("=" .repeat(78))
lines.append("Components")
lines.append("=" .repeat(78))
for component: Dictionary in Engine.get_copyright_info():
lines.append("")
lines.append("%s" % component["name"])
for part: Dictionary in component["parts"]:
lines.append(" Files: %s" % ", ".join(PackedStringArray(part["files"])))
for holder: String in part["copyright"]:
lines.append(" Copyright: %s" % holder)
lines.append(" License: %s" % part["license"])
lines.append("")
lines.append("=" .repeat(78))
lines.append("Licence texts")
lines.append("=" .repeat(78))
var licenses: Dictionary = Engine.get_license_info()
var names: Array = licenses.keys()
names.sort()
for name: String in names:
lines.append("")
lines.append("-" .repeat(78))
lines.append(name)
lines.append("-" .repeat(78))
lines.append("")
lines.append(String(licenses[name]).strip_edges())
lines.append("")
return "\n".join(lines)
+1
View File
@@ -0,0 +1 @@
uid://b8awmp8fo2ha3