aboutsummaryrefslogtreecommitdiffstats
path: root/main/spamassassin/APKBUILD
blob: bab02fa7673545557acf3f6aaaaf2a9571b21438 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Maintainer:  Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=spamassassin
_pkgreal=Mail-SpamAssassin
pkgver=3.4.3
pkgrel=1
pkgdesc="The Powerful #1 Open-Source Spam Filter"
url="https://metacpan.org/pod/Mail::SpamAssassin"
arch="all"
license="Apache-2.0"
cpandepends="perl-html-parser perl-digest-sha1 perl-netaddr-ip perl-net-dns perl-mail-dkim
	perl-mime-base64 perl-db_file perl-time-hires perl-libwww perl gnupg"
cpanmakedepends="$cpandepends"
depends="perl-mail-$pkgname curl"
makedepends="perl-dev $cpanmakedepends re2c"
subpackages="$pkgname-doc $pkgname-client $pkgname-compiler perl-mail-$pkgname:cpan"
source="https://cpan.metacpan.org/authors/id/K/KM/KMCGRAIL/${_pkgreal#*-}/$_pkgreal-$pkgver.tar.gz
	spamd.initd
	spamd.confd
	spamd.crond
	Mail-SpamAssassin.patch
	"
builddir="$srcdir/$_pkgreal-$pkgver"

# secfixes:
#   3.4.3-r0:
#     - CVE-2018-11805
#     - CVE-2019-12420
#   3.4.2-r0:
#     - CVE-2016-1238
#     - CVE-2017-15705
#     - CVE-2018-11780
#     - CVE-2018-11781

build() {
	cd "$builddir"
	rm t/dnsbl_subtests.t
	export CFLAGS="$(perl -MConfig -E 'say $Config{ccflags}')"
	PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor
	make
}

check() {
	cd "$builddir"
	make test
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install || return 1
	find "$pkgdir" \( -name perllocal.pod -o -name .packlist \) -delete
	install -Dm755 "$srcdir"/spamd.crond "$pkgdir"/etc/periodic/daily/$pkgname-update
	install -Dm755 "$srcdir"/spamd.initd "$pkgdir"/etc/init.d/spamd
	install -Dm644 "$srcdir"/spamd.confd "$pkgdir"/etc/conf.d/spamd
	mkdir -p "$pkgdir"/usr/sbin
	mv "$pkgdir"/usr/bin/spamd "$pkgdir"/usr/sbin/spamd
}

client() {
	depends=""
	pkgdesc="SpamAssassin client"
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/spamc "$subpkgdir"/usr/bin
}

compiler() {
	pkgdesc="SpamAssassin rules compiler"
	depends="re2c gcc make libc-dev perl-dev perl-mail-$pkgname"
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/sa-compile "$subpkgdir"/usr/bin/
}

cpan() {
	pkgdesc="SpamAssassin perl library"
	depends="$cpandepends"
	mkdir -p "$subpkgdir"/usr "$subpkgdir"/etc "$subpkgdir"/var/lib/$pkgname
	mv "$pkgdir"/etc/mail "$subpkgdir"/etc
	mv "$pkgdir"/usr/lib "$pkgdir"/usr/share "$subpkgdir"/usr
	find "$subpkgdir" -name *.pod -delete
	mv "$subpkgdir"/usr/share/$pkgname/user_prefs.template \
		"$subpkgdir"/etc/mail/$pkgname/user_prefs
	sed -i '/^#\*/d' "$subpkgdir"/etc/mail/$pkgname/user_prefs
}

sha512sums="d2fd657d3c20273b0c06cb1da083d757d3f2a7f60c7ed6e6ad8f98e6df33c9c5f3824f0531abf5dbc32b0dde22979d7d671231fa2ef0d8b073ea6804c5de0c3a  Mail-SpamAssassin-3.4.3.tar.gz
0a22933290a3abd147689bf3a9de4b6b277628c22966f353c5da932cd98560babf1d0bb9d92c456ea24decfb5af0bbc960192d29a90d9cab437e7986c75c8278  spamd.initd
274d3aa0d9aab05e83c8d5ad3e93a457649360021a67c8cb19088365bed681ebe26889cfa86f8c46a6044c7ee969231f2a71e3227adf8ad9e38d0286b9caf48d  spamd.confd
e0bbdb21020f4b4e5b11fb3ec18ad7e496fa4521d24275d806db96fc91cde3c0b8e8c8215e51b18903bf5916de74e9e2584fe7f62a9ec7da2f185641e533916d  spamd.crond
66a6daa7e9898864497e7d8e17efc6094aabc5a9a94afbc7da08acf4cf2430fad2cb0128b8db4be637f5dcabe3fa9f03490f9d7cbba3c1cc02b7824f63cd0965  Mail-SpamAssassin.patch"