summaryrefslogtreecommitdiff
path: root/scripts/crunch_demo.sh
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-01-28 02:17:04 +0100
committerskal <pascal.massimino@gmail.com>2026-01-28 02:17:04 +0100
commit5722d68a3e529fb22886c2430dc0d268c33424e7 (patch)
tree0ebc89443ef5a92b8284bcd8c60f88eabb3e6e72 /scripts/crunch_demo.sh
parent78ec37484b92efee1627e934a6e4e43c74968f88 (diff)
feat(crunch): Add UPX-based binary packer script
Adds 'scripts/crunch_demo.sh' to automate building a stripped binary and compressing it with UPX. Updates 'FETCH_DEPS.md' with UPX installation instructions and 'HOWTO.md' with usage guide. This addresses Task 3 (add binary crunchers).
Diffstat (limited to 'scripts/crunch_demo.sh')
-rwxr-xr-xscripts/crunch_demo.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/crunch_demo.sh b/scripts/crunch_demo.sh
new file mode 100755
index 0000000..333faa9
--- /dev/null
+++ b/scripts/crunch_demo.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+# Build a size-optimized binary and compress it with UPX.
+
+set -e
+
+if ! command -v upx >/dev/null 2>&1; then
+ echo "Error: upx is not installed or not in PATH."
+ echo "Please install it using 'brew install upx' or from https://github.com/upx/upx"
+ exit 1
+fi
+
+echo "Building stripped binary..."
+cmake -S . -B build_strip -DDEMO_STRIP_ALL=ON
+cmake --build build_strip
+
+SRC_BIN="build_strip/demo64k"
+OUT_BIN="build_strip/demo64k_packed"
+
+echo "Compressing with UPX..."
+upx --best --lzma -o "$OUT_BIN" "$SRC_BIN"
+
+echo "Done."
+ls -lh "$SRC_BIN" "$OUT_BIN"