]> git.proxmox.com Git - swtpm.git/commitdiff
add packaging make file
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 25 May 2023 13:34:19 +0000 (15:34 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 25 May 2023 14:45:37 +0000 (16:45 +0200)
(mis)using the fact that GNU make uses the following Makefile order
GNUmakefile, makefile and Makefile.
https://www.gnu.org/software/make/manual/make.html#Makefile-Names

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
GNUmakefile [new file with mode: 0644]

diff --git a/GNUmakefile b/GNUmakefile
new file mode 100644 (file)
index 0000000..785a4e7
--- /dev/null
@@ -0,0 +1,59 @@
+# NOTE: just for Proxmox packaging and called GNUmakefile to still allow direct (non-packaging) builds
+
+include /usr/share/dpkg/default.mk
+
+PACKAGE=swtpm
+
+BUILDDIR ?= $(PACKAGE)-$(DEB_VERSION)
+ORIG_SRC_TAR=$(PACKAGE)_$(DEB_VERSION_UPSTREAM).orig.tar.gz
+
+GITVERSION:=$(shell git rev-parse HEAD)
+
+DSC = $(PACKAGE)_$(DEB_VERSION).dsc
+DEB = $(PACKAGE)_$(DEB_VERSION)_$(DEB_HOST_ARCH).deb
+DEB_DBG = $(PACKAGE)-dbgsym_$(DEB_VERSION)_$(DEB_HOST_ARCH).deb
+DEB_LIB = swtpm-libs_$(DEB_VERSION)_$(DEB_HOST_ARCH).deb
+DEB_DEV = swtpm-dev_$(DEB_VERSION)_$(DEB_HOST_ARCH).deb
+DEB_TOOLS = swtpm-tools_$(DEB_VERSION)_$(DEB_HOST_ARCH).deb
+
+DEBS=$(DEB) $(DEB_DBG) $(DEB_LIB) $(DEB_DEV) $(DEB_TOOLS)
+
+all:
+
+$(BUILDDIR):
+       rm -rf $@ $@.tmp
+       rsync -a * $@.tmp
+       rm -f $@.tmp/GNUmakefile # just for Proxmox packaging convenience
+       echo "git clone git://git.proxmox.com/git/lxcfs.git\\ngit checkout $(GITVERSION)" > $@.tmp/debian/SOURCE
+       mv $@.tmp $@
+
+.PHONY: deb
+deb: $(DEBS)
+$(DEB_DBG) $(DEB_LIB) $(DEB_DEV) $(DEB_TOOLS): $(DEB)
+$(DEB): $(BUILDDIR)
+       cd $(BUILDDIR); dpkg-buildpackage -rfakeroot -b -us -uc
+       lintian $(DEBS)
+
+sbuild: $(DSC)
+       sbuild $(DSC)
+
+$(ORIG_SRC_TAR): $(BUILDDIR)
+       tar czf $(ORIG_SRC_TAR) --exclude="$(BUILDDIR)/debian" $(BUILDDIR)
+
+.PHONY: dsc
+dsc:
+       $(MAKE) clean
+       $(MAKE) $(DSC)
+       lintian $(DSC)
+
+$(DSC): $(ORIG_SRC_TAR) $(BUILDDIR)
+       cd $(BUILDDIR); dpkg-buildpackage -S -us -uc -d
+
+.PHONY: upload
+upload: UPLOAD_DIST ?= $(DEB_DISTRIBUTION)
+upload: $(DEBS)
+       tar cf - $(DEBS) | ssh repoman@repo.proxmox.com upload --product pve --dist $(UPLOAD_DIST)
+
+.PHONY: clean
+clean:
+       rm -rf $(PACKAGE)-[0-9]*/ $(PACKAGE)*.tar* *.deb *.dsc *.changes *.buildinfo *.build