diff --git a/README.md b/README.md index 562dc37..5469751 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,12 @@ meson compile -C builddir sudo meson install -C builddir ``` +### Build Deb package from source + +```bash +./build-deb.sh +``` + ## Usage ```bash @@ -99,6 +105,14 @@ stenmark ~/Notes/todo.md # opens a file directly (sidebar hidden) Settings are stored in `~/.config/stenmark/settings.json` and can be changed from the Preferences dialog. All changes take effect immediately, except the interface language, which applies on restart. +## Troubleshooting + +If you encounter issues or crashes, debug output can be enabled by running the following command in your terminal: + +``` +G_MESSAGES_DEBUG=all PYTHONUNBUFFERED=1 stenmark +``` + ## License GPL-3.0-**only** — version 3 of the GNU General Public License, and not "or any later version". diff --git a/build-deb.sh b/build-deb.sh new file mode 100755 index 0000000..e5d4cdd --- /dev/null +++ b/build-deb.sh @@ -0,0 +1,62 @@ +#!/usr/bin/env bash +set -euo pipefail + +PROJECT_NAME="stenmark" +VERSION=$(grep -oP "^version:\s*'\K[^']+" meson.build || echo "0.8.0") +DEB_STAGING="$(pwd)/deb-staging" +CONFIG_FILE="/tmp/nfpm-stenmark.yaml" + +cleanup() { + rm -rf "$DEB_STAGING" "$CONFIG_FILE" builddir +} +trap cleanup EXIT + +echo "==> Building .deb package for $PROJECT_NAME v$VERSION" + +# 1. Ensure required build tools exist +for cmd in meson ninja nfpm; do + if ! command -v "$cmd" &>/dev/null; then + echo "ERROR: Missing required command '$cmd'. Install meson, ninja-build, and nfpm first." + exit 1 + fi +done + +# 2. Stage the application installation tree +rm -rf "$DEB_STAGING" builddir +meson setup builddir --prefix=/usr +meson compile -C builddir +DESTDIR="$DEB_STAGING" meson install -C builddir --no-rebuild + +# 3. Generate contents list for nFPM +CONTENTS="" +while IFS= read -r file; do + dst="${file#"$DEB_STAGING"}" + CONTENTS+=" - src: $file + dst: $dst +" +done < <(find "$DEB_STAGING" -type f) + +# 4. Write nFPM configuration +cat > "$CONFIG_FILE" < Successfully built package:" +ls -l "${PROJECT_NAME}"_*.deb \ No newline at end of file