dmenupatches - commit e54dd6c
feat: buildscripte54dd6c87a18b8a6631b60995ef1687d8fd3b362LukeJ<luke.jones.2567@gmail.com>2026-09-28T19:23:56+01:00diff --git a/build.sh b/build.sh
new file mode 100644
index 0000000..92663c8
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+set -eu
+
+if [ "$#" -ne 1 ]; then
+ printf 'Usage: %s /path/to/dmenu\n' "$0" >&2
+ exit 1
+fi
+
+DMENU_SRC=$1
+
+if [ ! -d "$DMENU_SRC" ]; then
+ printf 'Error: dmenu source directory does not exist: %s\n' "$DMENU_SRC" >&2
+ exit 1
+fi
+
+if [ ! -f "$DMENU_SRC/config.mk" ] || [ ! -f "$DMENU_SRC/dmenu.c" ]; then
+ printf 'Error: %s does not appear to be a dmenu source tree\n' "$DMENU_SRC" >&2
+ exit 1
+fi
+
+# Resolve the directory containing this script before changing directory.
+SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
+
+cd "$DMENU_SRC"
+
+printf '%s\n' "Applying patches from: $SCRIPT_DIR"
+
+found=0
+
+for patch in "$SCRIPT_DIR"/*.diff "$SCRIPT_DIR"/*.patch; do
+ [ -f "$patch" ] || continue
+
+ found=1
+ printf 'Applying %s...\n' "$(basename "$patch")"
+ patch -p1 < "$patch"
+done
+
+if [ "$found" -eq 0 ]; then
+ printf 'Error: no .diff or .patch files found in %s\n' "$SCRIPT_DIR" >&2
+ exit 1
+fi
+
+printf '%s\n' "Building dmenu..."
+
+make clean
+make
+
+printf '%s\n' "Installing dmenu..."
+
+make install
+
+printf '%s\n' "Done."