From 693ac6e677ccc793b840d7687b5d70b842868ef4 Mon Sep 17 00:00:00 2001 From: Ryan Cavicchioni Date: Fri, 9 Apr 2021 00:06:28 +0000 Subject: [PATCH] Generate Debian package from template Refs #7 --- .gitignore | 3 +++ Makefile | 14 +++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index cfed330..f786bf3 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,6 @@ .vscode/configurationCache.log .vscode/dryrun.log .vscode/targets.log + +# packaging +/debian diff --git a/Makefile b/Makefile index 378da4e..6f73ebe 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ build: $(Q) go build -o $(EXE) -ldflags="$(LDFLAGS)" ./cmd/lume .PHONY: clean -clean: +clean: deb-clean $(Q) $(RM) $(EXE) .PHONY: install @@ -34,6 +34,18 @@ install: $(Q) install -p -D -m 0755 $(EXE) $(DESTDIR)${PREFIX}/bin/lume $(Q) install -p -D -m 0644 .lumerc.sample $(DESTDIR)${PREFIX}/share/lume/lumerc +DEBDIR=$(CURDIR)/debian +TMPLDIR=$(CURDIR)/packaging/debian +DEBDATE=$(shell date -R) + .PHONY: deb deb: + $(Q) mkdir -p $(DEBDIR) + $(Q) sed -e 's/__VERSION__/$(LUME_VERSION)/g' $(TMPLDIR)/rules > $(DEBDIR)/rules + $(Q) sed -e 's/__VERSION__/$(LUME_VERSION)/g' -e 's/__DATE__/$(DEBDATE)/g' $(TMPLDIR)/changelog > $(DEBDIR)/changelog + $(Q) echo 9 > $(DEBDIR)/compat + $(Q) cp $(TMPLDIR)/control $(DEBDIR)/control $(Q) dpkg-buildpackage -us -uc -b + +deb-clean: + $(Q) rm -rf $(CURDIR)/debian