build(debian): add a Debian and Ubuntu package definition

Add a debhelper-free debian/ tree so a .deb can be built with the Go toolchain and dpkg-dev alone. debian/rules compiles the binary with -trimpath and the version from debian/changelog, then stages the binary, the lazyntfy(1) man page, the license, and the README. The package Depends on ca-certificates for TLS to the ntfy server.
This commit is contained in:
ahp
2026-10-11 12:20:34 +03:30
parent ee9e130a92
commit e6499b50bb
5 changed files with 85 additions and 0 deletions
Vendored Executable
+37
View File
@@ -0,0 +1,37 @@
#!/usr/bin/make -f
# Debian packaging without debhelper: the Go toolchain builds the binary and
# the rules stage it by hand. This keeps the build dependencies to just Go.
export CGO_ENABLED = 0
PACKAGE := lazyntfy
VERSION := $(shell dpkg-parsechangelog -SVersion)
PKGDIR := debian/$(PACKAGE)
.PHONY: clean build build-arch build-indep binary binary-arch binary-indep
clean:
rm -rf $(PKGDIR) $(PACKAGE)
rm -f debian/files
build: build-arch build-indep
build-arch: $(PACKAGE)
build-indep:
$(PACKAGE):
go build -trimpath -ldflags "-s -w -X main.version=$(VERSION)" -o $(PACKAGE) ./cmd/$(PACKAGE)
binary: binary-arch binary-indep
binary-arch: build-arch
install -d $(PKGDIR)/DEBIAN
install -Dm755 $(PACKAGE) $(PKGDIR)/usr/bin/$(PACKAGE)
install -Dm644 man/lazyntfy.1 $(PKGDIR)/usr/share/man/man1/lazyntfy.1
install -Dm644 LICENSE $(PKGDIR)/usr/share/doc/$(PACKAGE)/copyright
install -Dm644 README.md $(PKGDIR)/usr/share/doc/$(PACKAGE)/README.md
dpkg-gencontrol -p$(PACKAGE) -P$(PKGDIR)
dpkg-deb --build --root-owner-group $(PKGDIR) ..
binary-indep: