2026-06-28 00:10:15 +01:00
|
|
|
# Makefile for the postit Debian package.
|
|
|
|
|
#
|
|
|
|
|
# Targets:
|
|
|
|
|
# make deb : build a .deb in the parent directory (or
|
|
|
|
|
# $POSTIT_OUT_DIR if set). Equivalent to
|
|
|
|
|
# dpkg-buildpackage -us -uc -b.
|
2026-06-28 13:47:15 +01:00
|
|
|
# make test : run the non-regression tests under tests/.
|
|
|
|
|
# The fetch test pins the upstream Git mechanics
|
|
|
|
|
# that previously regressed on tag-vs-branch
|
|
|
|
|
# handling (1.0.1-rc02). Set SKIP_NETWORK_TESTS=1
|
|
|
|
|
# to skip the GitHub-egress parts.
|
2026-06-28 00:10:15 +01:00
|
|
|
# make clean : rm -rf build/ and the per-package staging tree
|
|
|
|
|
# under debian/postit.
|
|
|
|
|
# make source : fetch the upstream yavsc source tree under
|
|
|
|
|
# build/yavsc-src (no packaging step). Useful for
|
|
|
|
|
# debugging the publish step.
|
|
|
|
|
#
|
|
|
|
|
# Environment overrides (or pass on the make command line):
|
2026-06-28 00:51:14 +01:00
|
|
|
# POSTIT_GIT_URL default: https://github.com/pazof/yavsc.git
|
|
|
|
|
# POSTIT_GIT_TAG default: 1.0.0
|
|
|
|
|
# POSTIT_RUNTIME default: linux-x64 (override to linux-arm64 etc.)
|
|
|
|
|
# POSTIT_OUT_DIR default: $(CURDIR)/.. (artifacts land here)
|
2026-06-28 00:10:15 +01:00
|
|
|
|
|
|
|
|
POSTIT_GIT_URL ?= https://github.com/pazof/yavsc.git
|
2026-08-17 14:53:07 +01:00
|
|
|
POSTIT_GIT_TAG ?= 1.0.6
|
2026-06-28 00:51:14 +01:00
|
|
|
POSTIT_RUNTIME ?= linux-x64
|
2026-06-28 00:10:15 +01:00
|
|
|
POSTIT_OUT_DIR ?= $(CURDIR)/..
|
|
|
|
|
|
2026-06-28 13:47:15 +01:00
|
|
|
.PHONY: deb clean source test
|
2026-06-28 00:10:15 +01:00
|
|
|
|
|
|
|
|
deb:
|
2026-06-28 13:20:17 +01:00
|
|
|
@echo " POSTIT_GIT_TAG=$(POSTIT_GIT_TAG) POSTIT_RUNTIME=$(POSTIT_RUNTIME) POSTIT_GIT_URL=$(POSTIT_GIT_URL)"
|
|
|
|
|
# Render debian/changelog from debian/changelog.in so the package
|
|
|
|
|
# version follows the upstream tag, not the version pinned in the
|
|
|
|
|
# repo. dpkg-buildpackage reads debian/changelog before any rule
|
|
|
|
|
# runs (in dpkg-source --before-build), so the template must be
|
|
|
|
|
# expanded in the Makefile, not in debian/rules. Without this
|
|
|
|
|
# step the .deb always comes out as the version hardcoded in
|
|
|
|
|
# debian/changelog.in, regardless of POSTIT_GIT_TAG.
|
|
|
|
|
sed 's/@VERSION@/$(POSTIT_GIT_TAG)/g' debian/changelog.in > debian/changelog
|
2026-08-17 17:35:42 +01:00
|
|
|
# Remove any residual .deb from previous runs (same name
|
2026-08-17 17:39:38 +01:00
|
|
|
# pattern would otherwise be re-used by dpkg-deb if the
|
|
|
|
|
# previous run left it lying around).
|
2026-08-17 17:35:42 +01:00
|
|
|
rm -f ../postit_*$(POSTIT_GIT_TAG)-1*.deb ../postit_*.buildinfo ../postit_*.changes
|
2026-08-17 17:48:47 +01:00
|
|
|
# Use dpkg-architecture to set the target arch correctly for
|
|
|
|
|
# cross-builds. For POSTIT_RUNTIME=linux-arm64, this exports
|
|
|
|
|
# DEB_HOST_ARCH=arm64 (and friends) so dpkg-buildpackage names
|
|
|
|
|
# the .deb postit_*_arm64.deb instead of postit_*_amd64.deb.
|
|
|
|
|
# For linux-x64, it sets the host arch to amd64 explicitly
|
|
|
|
|
# (which matches the runner — no-op, but keeps the call site
|
|
|
|
|
# uniform). Other RIDs are rejected.
|
2026-08-17 18:12:09 +01:00
|
|
|
# Compute DPKG_ARCH_ARGS, eval dpkg-architecture, then call
|
|
|
|
|
# dpkg-buildpackage — all in ONE shell invocation so the
|
|
|
|
|
# vars set by dpkg-architecture are visible to dpkg-buildpackage.
|
|
|
|
|
# make runs each recipe line in its own shell, so we use
|
|
|
|
|
# backslash continuation to glue everything together.
|
2026-08-17 18:25:28 +01:00
|
|
|
DPKG_ARCH_ARGS=$$(case "$(POSTIT_RUNTIME)" in linux-arm64) echo "-aarm64" ;; linux-x64) echo "-aamd64" ;; *) echo "unsupported POSTIT_RUNTIME=$(POSTIT_RUNTIME)" >&2; exit 1 ;; esac); eval $$(dpkg-architecture $$DPKG_ARCH_ARGS); POSTIT_GIT_URL=$(POSTIT_GIT_URL) POSTIT_GIT_TAG=$(POSTIT_GIT_TAG) POSTIT_RUNTIME=$(POSTIT_RUNTIME) dpkg-buildpackage -us -uc -b
|
2026-08-17 17:39:38 +01:00
|
|
|
# dpkg-buildpackage already writes the produced .deb to
|
|
|
|
|
# /src/_src/../ = $POSTIT_OUT_DIR (its default — there's no
|
|
|
|
|
# flag to change it). So no 'mv' is needed. The old 'mv'
|
|
|
|
|
# caused a 'same file' error when the destination was the
|
|
|
|
|
# same as the source (which it always is). Just verify the
|
|
|
|
|
# .deb was actually produced.
|
|
|
|
|
if ! ls ../postit_*$(POSTIT_GIT_TAG)-1*.deb >/dev/null 2>&1; then \
|
|
|
|
|
echo " ERROR: dpkg-buildpackage produced no .deb for POSTIT_GIT_TAG=$(POSTIT_GIT_TAG)" >&2; \
|
|
|
|
|
exit 1; \
|
|
|
|
|
fi
|
|
|
|
|
@echo " ✓ artifacts in $(POSTIT_OUT_DIR)"
|
2026-06-28 00:10:15 +01:00
|
|
|
|
|
|
|
|
clean:
|
|
|
|
|
rm -rf build debian/postit
|
|
|
|
|
|
|
|
|
|
source:
|
|
|
|
|
mkdir -p build
|
|
|
|
|
git clone --depth=1 --branch $(POSTIT_GIT_TAG) \
|
|
|
|
|
$(POSTIT_GIT_URL) build/yavsc-src
|
2026-06-28 13:47:15 +01:00
|
|
|
|
|
|
|
|
test:
|
|
|
|
|
@bash tests/test-fetch-upstream.sh
|