archrelease: copy trunk to extra-x86_64
[arch-packages.git] / spamassassin / trunk / PKGBUILD
blobb2252079dacaa85e0ad4c6c68916cb8a57f4058f
1 # Maintainer: Florian Pritz <bluewind@xinu.at>
2 # Contributor: Dale Blount <dale@archlinux.org>
3 # Contributor: Manolis Tzanidakis
4 pkgname=spamassassin
5 pkgver=4.0.0
6 pkgrel=1
7 pkgdesc="A mail filter to identify spam."
8 arch=('x86_64')
9 license=('APACHE')
10 url="https://spamassassin.apache.org"
11 depends=('openssl' 'zlib' 're2c' 'perl-net-dns' 'perl-io-socket-ssl'
12          'perl-libwww' 'perl-mail-spf' 'perl-http-message' 'perl-net-http'
13          'perl-io-socket-inet6' 'perl-mail-dkim' 'perl-crypt-ssleay')
14 makedepends=('razor' 'perl-dbi')
15 checkdepends=('perl-text-diff')
16 optdepends=('razor: to identify collaborately-flagged spam'
17             'make: to use sa-compile'
18             'gcc: to use sa-compile')
19 backup=('etc/mail/spamassassin/local.cf'
20         'etc/mail/spamassassin/init.pre'
21         'etc/mail/spamassassin/v310.pre'
22         'etc/mail/spamassassin/v312.pre'
23         'etc/mail/spamassassin/v320.pre'
24         'etc/mail/spamassassin/v330.pre'
25         'etc/mail/spamassassin/v340.pre'
26         'etc/mail/spamassassin/v341.pre'
27         'etc/mail/spamassassin/v342.pre'
28         'etc/mail/spamassassin/v343.pre'
29         'etc/mail/spamassassin/v400.pre')
30 install="${pkgname}.install"
31 source=("https://ftp.fau.de/apache/${pkgname}/source/Mail-SpamAssassin-${pkgver}.tar.gz"
32         "https://www.apache.org/dist/${pkgname}/source/Mail-SpamAssassin-${pkgver}.tar.gz.asc"
33         'spamassassin.tmpfiles.d'
34         'spamassassin.service')
35 validpgpkeys=(D8099BC79E17D7E49BC21E31FDE52F40F7D39814)
36 sha512sums=('db8e5d0249d9fabfa89bc4c7309a7eafd103ae07617ed9bd32e6b35473c5efc05b1a913b4a3d4bb0ff19093400e3510ae602bf9e96290c63e7946a1d0df6de47'
37             'SKIP'
38             '994ebb2b6c127521676f35879017112a33da53ad99431837d06973a9abfc4aa0434ea2c9b19073ff2cc877ebe3a5a7fe8525bc93222fd05956069ce73e5ae389'
39             '5ad6aa8d992375b0989413d36ff0485f792ac9211a47e6a2a7fa5c0b9eb353aa6efe6f55da3ff4480bdef24beb4fa456c64c5a5ce72e8ad6c93c171c969fd6ee')
41 prepare() {
42   cd "${srcdir}/Mail-SpamAssassin-${pkgver}"
44   sed -i t/sa_compile.t \
45           -e 's#^my $temp_binpath = $Config{sitebinexp};#my $temp_binpath = "/bin/site_perl/";#'
48 build() {
49   cd "${srcdir}/Mail-SpamAssassin-${pkgver}"
51   # install module in vendor directories.
52   export PERL_USE_UNSAFE_INC=1
53   PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor \
54       CONTACT_ADDRESS=root@localhost ENABLE_SSL=yes PERL_TAINT=no
55   make
58 check() {
59   cd "${srcdir}/Mail-SpamAssassin-${pkgver}"
61   # parallel tests cause lots of failures; disable for now
62   #export HARNESS_OPTIONS="j$(echo $MAKEFLAGS | sed 's/.*-j\([0-9][0-9]*\).*/\1/')"
64   make test
67 package() {
68   cd "${srcdir}/Mail-SpamAssassin-${pkgver}"
69   make DESTDIR="${pkgdir}" install
71   install -D -m644 "${srcdir}/spamassassin.service" "${pkgdir}/usr/lib/systemd/system/spamassassin.service"
72   install -d -o 182 -g 182 -m 755 "$pkgdir/var/lib/spamassassin"
74   echo 'u spamd 182 - /var/lib/spamassassin' |
75           install -Dm644 /dev/stdin "$pkgdir/usr/lib/sysusers.d/$pkgname.conf"
77   install -Dm644 "$srcdir/spamassassin.tmpfiles.d" "$pkgdir/usr/lib/tmpfiles.d/$pkgname.conf"
79   backup_incomplete=0
80   for file in "$pkgdir/etc/mail/spamassassin/"*.pre; do
81           clean_file="${file#"$pkgdir/"}"
82           if ! in_array "$clean_file" "${backup[@]}"; then
83                   echo "ERROR: backup array is missing an entry for '$clean_file'" >&2
84                   backup_incomplete=1
85           fi
86   done
87   if ((backup_incomplete)); then
88           exit 1
89   fi