]> git.proxmox.com Git - proxmox-mailgateway.git/blobdiff - Makefile
meta: add systemd-sysv to dependencies
[proxmox-mailgateway.git] / Makefile
index 8a5432247b71af8795c67fb6c2339b150365d89d..9282da4a39ff2726a48a0f2af6f2b09530171f67 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,49 +1,50 @@
-RELEASE=5.0
-PKGREL=2
+include /usr/share/dpkg/pkg-info.mk
 
 PACKAGE=proxmox-mailgateway
 
-DEB=${PACKAGE}_${RELEASE}-${PKGREL}_all.deb
+BUILDDIR=$(PACKAGE)-$(DEB_VERSION)
+DSC=$(PACKAGE)_$(DEB_VERSION).dsc
 
-KERNEL_VER=4.13.4
-KREL=1
+DEB=$(PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION)_all.deb
+CT_DEB=$(PACKAGE)-container_$(DEB_VERSION_UPSTREAM_REVISION)_all.deb
+HEADER_DEB=pve-headers_$(DEB_VERSION_UPSTREAM_REVISION)_all.deb
 
-EXTRAVERSION=-${KREL}-pve
-KVNAME=${KERNEL_VER}${EXTRAVERSION}
+DEBS=$(DEB) $(CT_DEB) $(HEADER_DEB)
 
-ARCH=amd64
-DIST=stretch
-STAGING_REPO=/pve/repoman/staging/pmg/dists/${DIST}/pmg-${RELEASE}/binary-${ARCH}/
+all: $(DEB)
 
-KERNEL:=$(shell  find ${STAGING_REPO} -name "pve-kernel-${KVNAME}_*deb")
+.PHONY: deb
+deb $(CT_DEB) $(HEADER_DEB): $(DEB)
 
-all: ${DEB}
+$(BUILDDIR): debian
+       rm -rf $@ $@.tmp
+       mkdir -p $@.tmp/debian
+       cp -a debian/ $@.tmp/
+       echo "git clone git://git.proxmox.com/git/proxmox-mailgateway.git\\ngit checkout $(shell git rev-parse HEAD)" > $@.tmp/debian/SOURCE
+       mv $@.tmp $@
 
-${DEB}: control copyright changelog.Debian postinst postrm proxmox-release-5.x.pubkey
-       rm -rf build
-       test -n "${KERNEL}" || false "kernel not found"
-       mkdir -p build/DEBIAN
-       mkdir -p build/usr/share/doc/${PACKAGE}
-       mkdir -p build/etc/apt/trusted.gpg.d
-       install -m 0644 proxmox-release-5.x.pubkey build/etc/apt/trusted.gpg.d/proxmox-ve-release-5.x.gpg
-       install -m 0644 conffiles build/DEBIAN/conffiles
-       install -m 0644 control build/DEBIAN/control
-       install -m 0755 postinst build/DEBIAN/postinst
-       install -m 0755 postrm build/DEBIAN/postrm
-       install -m 0644 copyright build/usr/share/doc/${PACKAGE}
-       install -m 0644 changelog.Debian build/usr/share/doc/${PACKAGE}
-       install -D -m 0644 grub-defaults.cfg build/etc/default/grub.d/proxmox-mailgateway.cfg
-       gzip -n --best build/usr/share/doc/${PACKAGE}/changelog.Debian
-       dpkg-deb --build build ${DEB}
-       lintian ${DEB}
+$(DEB): $(BUILDDIR)
+       cd $(BUILDDIR); dpkg-buildpackage -b -uc -us
+       lintian $(DEBS)
 
-%: %.in
-       sed -e 's/@KVNAME@/${KVNAME}/' -e 's/@KERNEL_VER@/${KERNEL_VER}/' -e 's/@RELEASE@/${RELEASE}/' -e 's/@PKGREL@/${PKGREL}/' <$< >$@
+$(DSC): $(BUILDDIR)
+       cd $(BUILDDIR); dpkg-buildpackage -S -uc -us
+
+.PHONY:dsc
+dsc: $(DSC)
+       $(MAKE) clean
+       $(MAKE) $(DSC)
+       lintian $(DSC)
+
+.PHONY: sbuild
+sbuild: $(DSC)
+       sbuild $(DSC)
 
 .PHONY: upload
-upload: ${DEB}
-       tar cf - ${DEB}|ssh repoman@repo.proxmox.com -- upload --product pmg --dist ${DIST} --arch ${ARCH}
+upload: UPLOAD_DIST ?= $(DEB_DISTRIBUTION)
+upload: $(DEBS)
+       tar cf - $(DEBS)|ssh -X repoman@repo.proxmox.com -- upload --product pmg --dist $(UPLOAD_DIST)
 
 clean:
-       rm -rf build control postinst postrm *.deb
-       find . -name '*~' -exec rm {} ';'
+       rm -rf $(PACKAGE)-[0-9]*/
+       rm -f $(PACKAGE)*.tar.* *.deb *.dsc *.build *.buildinfo *.changes