diff tools/make_dist.sh @ 27:75deda08db90 0.9.1

game debug functions separated into own file; release build option, distribution script
author ark
date 2026-10-20 17:19 +0200
parents
children a464bd43b76c
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/make_dist.sh	Tue Oct 20 17:19:40 2026 +0200
@@ -0,0 +1,43 @@
+#!/bin/sh
+USAGE="$0 [--debug]
+
+build the game and pack www/ into dist/minor_monsters_<version>.tar.gz,
+which unpacks into a directory minor_monsters. the version comes from
+tools/get_version.sh -f: the latest tag, with a timestamp appended when
+the working directory is not clean or not at the tagged revision.
+
+options:
+    -h, --help  show this help
+    --debug     build with the debug code and switches, not as a release
+"
+
+DEBUG=0
+
+while [ "$#" != 0 ]
+do
+    case "$1" in
+        -h|--help) echo "$USAGE"; exit 0 ;;
+        --debug) DEBUG=1 ;;
+        *)
+            echo "unrecognized option '$1'" >&2
+            exit 1
+            ;;
+    esac
+    shift
+done
+
+# build.py and get_version.sh work on the repository root
+cd "$(dirname "$0")/.." &&
+if [ "$DEBUG" = 1 ]
+then
+    python3 tools/build.py
+else
+    python3 tools/build.py --release
+fi &&
+VERSION=$(tools/get_version.sh -f) &&
+ARCHIVE="dist/minor_monsters_$VERSION.tar.gz" &&
+mkdir -p dist &&
+# www/ is stored as minor_monsters/
+tar --no-xattrs --no-mac-metadata --exclude .DS_Store -s ',^www,minor_monsters,' \
+    -czf "$ARCHIVE" www &&
+echo "wrote $ARCHIVE"