]> git.proxmox.com Git - proxmox-spamassassin.git/blame - Makefile
buildsys: use more telling BUILDDIR variable name
[proxmox-spamassassin.git] / Makefile
CommitLineData
9e1a2302 1include /usr/share/dpkg/default.mk
63a37115
TL
2
3# howto add rule updates:
f803c821 4
df264c7c
SI
5# running `make update-sa` updates the core SA rules (in the sa-updates directory)
6# running `make update-kam` updates the KAM ruleset (in the kam-updates directory)
7
454d7acb 8PACKAGE = proxmox-spamassassin
7b922beb 9
3e32306b 10OPKGNAME = Mail-SpamAssassin-$(DEB_VERSION_UPSTREAM)
184cb476
TL
11
12BUILDDIR = $(PACKAGE)-$(DEB_VERSION_UPSTREAM)
13DSC = $(PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION).dsc
14
454d7acb
TL
15DEB = $(PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION)_amd64.deb
16DBG_DEB = $(PACKAGE)-dbgsym_$(DEB_VERSION_UPSTREAM_REVISION)_amd64.deb
3e32306b 17DEBS = $(DEB) $(DBG_DEB)
7b922beb 18
bbb32883 19KAM_CHANNEL_FILE = debian/tree/etc/mail/spamassassin/channel.d/KAM_channel.conf
3e32306b 20KAM_KEYID = $(shell awk -F '=' '/^KEYID/ { print $$2 }' $(KAM_CHANNEL_FILE))
bbb32883 21
7a367109 22
ae1e4fd8
SI
23SA_UPDATE_GPG_DIR = .sa-update-gpghome
24
3e32306b 25deb: $(DEB)
f8a626c3 26
184cb476
TL
27$(DEB) $(DBG_DEB): $(BUILDDIR)
28 cd $(BUILDDIR); dpkg-buildpackage -b -us -uc
3e32306b 29 lintian $(DEB)
7b922beb 30
b870b07a
SI
31dsc:
32 $(MAKE) $(DSC)
33 lintian $(DSC)
73ae04ad 34
184cb476
TL
35$(DSC): $(BUILDDIR)
36 cd $(BUILDDIR); dpkg-buildpackage -S -us -uc -d
b870b07a
SI
37
38.PHONY: sbuild
39sbuild: $(DSC)
40 sbuild $(DSC)
426b8f0a 41
4da3759d 42.PHONY: update-upstream
3e32306b 43update-upstream: $(OPKGNAME).tar.gz
4da3759d 44 rm -rf upstream
426b8f0a 45 tar -xzf $<
3e32306b 46 mv $(OPKGNAME) upstream
14fcd860 47
184cb476 48$(BUILDDIR).orig.tar.gz: upstream/
3e32306b
SI
49 rm -rf $(NPKGNAME)
50 cp -a upstream $(NPKGNAME)
51 tar -czf $@ $(NPKGNAME)
426b8f0a 52
184cb476 53$(BUILDDIR): sa-updates kam-updates $(NPKGNAME).orig.tar.gz
426b8f0a
SI
54 cp -a debian $@
55 mkdir -p $@/debian/tree/usr/share/spamassassin
054f24db 56 rsync -av sa-updates/ $@/debian/tree/usr/share/spamassassin
426b8f0a 57 mkdir -p $@/debian/tree/usr/share/spamassassin-extra
bbb32883 58 rsync -av kam-updates/ $@/debian/tree/usr/share/spamassassin-extra
426b8f0a 59
3e32306b 60$(OPKGNAME).tar.gz:
ac5080f9
SI
61 rm -f $@*
62 curl -L -o '$@#1.tmp' 'https://www-eu.apache.org/dist/spamassassin/source/$@{,.asc}'
63 mv $@.tmp $@
64 mv $@.asc.tmp $@.asc
65 gpgv --keyring ./sa-releasekey.gpg $@.asc $@
66
3e32306b
SI
67$(SA_UPDATE_GPG_DIR)/.prepared: $(OPKGNAME).tar.gz
68 rm -rf $(SA_UPDATE_GPG_DIR)
69 mkdir --mode=0700 -p $(SA_UPDATE_GPG_DIR)
70 tar --strip-components 2 -xzf $(OPKGNAME).tar.gz $(OPKGNAME)/rules/sa-update-pubkey.txt
71 sa-update --gpghomedir $(SA_UPDATE_GPG_DIR) --import sa-update-pubkey.txt
72 sa-update --gpghomedir $(SA_UPDATE_GPG_DIR) --import $(KAM_CHANNEL_FILE)
ae1e4fd8
SI
73 rm sa-update-pubkey.txt
74 touch $@
75
27e14884 76.PHONY: update-sa
3e32306b 77update-sa: $(SA_UPDATE_GPG_DIR)/.prepared
d2ab4c52 78 rm -rf updates.tmp
3e32306b 79 sa-update --gpghomedir $(SA_UPDATE_GPG_DIR) --updatedir updates.tmp --channel updates.spamassassin.org
054f24db 80 rsync -av --delete --exclude=local.cf --exclude=regression_tests.cf --exclude=*.txt --exclude=MIRRORED.BY updates.tmp/updates_spamassassin_org/ sa-updates
7b922beb 81
bbb32883 82.PHONY: update-kam
3e32306b 83update-kam: $(SA_UPDATE_GPG_DIR)/.prepared
701fc746 84 rm -rf kam-updates.tmp kam-updates
3e32306b 85 sa-update --gpghomedir $(SA_UPDATE_GPG_DIR) --gpgkey $(KAM_KEYID) --updatedir kam-updates.tmp --channel kam.sa-channels.mcgrail.com
bbb32883
SI
86 rm -rf kam-updates.tmp/kam_sa-channels_mcgrail_com/MIRRORED.BY
87 mv kam-updates.tmp kam-updates
88
7b922beb 89.PHONY: upload
9e1a2302 90upload: UPLOAD_DIST ?= $(DEB_DISTRIBUTION)
3e32306b 91upload: $(DEBS)
9e1a2302 92 tar cf - $(DEBS) | ssh -X repoman@repo.proxmox.com -- upload --product pmg --dist $(UPLOAD_DIST)
7b922beb 93
feec84ce
TL
94.PHONY: clean distclean
95clean:
454d7acb 96 rm -rf *~ debian/*~ *.deb $(PACKAGE)_* updates.tmp kam-updates.tmp $(SA_UPDATE_GPG_DIR) $(OPKGNAME).tar.gz.*
7b922beb 97
feec84ce 98distclean: clean
3e32306b 99 rm -rf $(OPKGNAME).*
19fb7ca6
DM
100
101.PHONY: dinstall
3e32306b
SI
102dinstall: $(DEB)
103 dpkg -i $(DEB)