From a85a1e4ece301d629d47120f019645a1af93a05d Mon Sep 17 00:00:00 2001 From: Tom Goff Date: Tue, 6 Sep 2016 11:14:16 -0400 Subject: [PATCH] packaging: Add a makefile to directly build Debian packages. --- .gitignore | 1 + packaging/deb.mk | 56 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 packaging/deb.mk diff --git a/.gitignore b/.gitignore index a403186e..8a56c67a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.debbuild .deps .version .version.date diff --git a/packaging/deb.mk b/packaging/deb.mk new file mode 100644 index 00000000..14116c12 --- /dev/null +++ b/packaging/deb.mk @@ -0,0 +1,56 @@ +DEBBUILD = .debbuild + +CORE_VERSION = $(shell cat .version 2> /dev/null) + +COREBUILD = $(DEBBUILD)/core-$(CORE_VERSION) + +.PHONY: all +all: clean .version build + +.PHONY: clean +clean: + rm -rf $(DEBBUILD) + +.PHONY: build +build: changelog + cd $(COREBUILD) && dpkg-buildpackage -b -us -uc + @printf "\ndebian packages built in $(DEBBUILD)\n\n" + +.PHONY: changelog +changelog: debian + echo "core ($(CORE_VERSION)-1) unstable; urgency=low" > $(COREBUILD)/debian/changelog.generated + echo " * interim package generated from source" >> $(COREBUILD)/debian/changelog.generated + echo " -- CORE Developers $$(date -R)" >> $(COREBUILD)/debian/changelog.generated + cd $(COREBUILD)/debian && \ + { test ! -L changelog && mv -f changelog changelog.save; } && \ + { test "$$(readlink changelog)" = "changelog.generated" || \ + ln -sf changelog.generated changelog; } + +.PHONY: debian +debian: corebuild + cd $(COREBUILD) && ln -s packaging/deb debian + +.PHONY: corebuild +corebuild: $(DEBBUILD) dist + tar -C $(DEBBUILD) -xzf core-$(CORE_VERSION).tar.gz + +.PHONY: dist +dist: Makefile + $(MAKE) dist + +Makefile: configure + ./configure + +configure: bootstrap.sh + ./bootstrap.sh + +bootstrap.sh: + @printf "\nERROR: make must be called from the top-level directory:\n" + @printf " make -f packaging/$(lastword $(MAKEFILE_LIST))\n\n" + @false + +.version: Makefile + $(MAKE) $@ + +$(DEBBUILD): + mkdir -p $@