summaryrefslogtreecommitdiff
path: root/spamassassin-courier/PKGBUILD
blob: 58c88017efdf170a19a5bb25570eba93cb1a2e2c (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
# Maintainer: Erich Eckner <arch at eckner dot net>
# Contributor: Florian Pritz <bluewind@xinu.at>
# Contributor: Dale Blount <dale@archlinux.org>
# Contributor: Manolis Tzanidakis
pkgname=spamassassin-courier
pkgver=3.4.2
pkgrel=2
pkgdesc="A mail filter to identify spam - patched for courier-mta."
arch=('i686' 'x86_64')
license=('APACHE' 'GPL2')
url="https://spamassassin.apache.org"
depends=('openssl' 'zlib' 're2c' 'perl-net-dns' 'perl-io-socket-ssl'
         'perl-libwww' 'perl-mail-spf' 'perl-http-message' 'perl-net-http'
         'perl-io-socket-inet6' 'perl-mail-dkim' 'perl-crypt-ssleay')
makedepends=('razor' 'perl-dbi')
optdepends=('razor: to identify collaborately-flagged spam'
            'make: to use sa-compile'
            'gcc: to use sa-compile')
backup=('etc/mail/spamassassin/local.cf'
        'etc/mail/spamassassin/init.pre'
        'etc/mail/spamassassin/v310.pre'
        'etc/mail/spamassassin/v312.pre'
        'etc/mail/spamassassin/v320.pre'
        'etc/mail/spamassassin/v330.pre')
install="${pkgname}.install"
source=("https://www.us.apache.org/dist/${pkgname%-*}/source/Mail-SpamAssassin-${pkgver}.tar.gz"{,.asc}
        'spamassassin.service'
        'spamassassin-update.service'
        'spamassassin-update.timer'
	'AuthCourier.pm' # http://da.andaka.org/dl/AuthCourier.pm
	'spamd.patch')
validpgpkeys=(D8099BC79E17D7E49BC21E31FDE52F40F7D39814)
sha512sums=('85e3d78bb885ad1d0bf2066d1bc919d6ad5e9f86795069397e7c28cc1ba02870566ec014c08c81f68e7ed03b7f60d2de0b9730b3415b35d848abde2c8920a28f'
            'SKIP'
            '7e44370e9433134816db51681de388618f8b00f27e9229b673ca7da5821b6bfc27dfc9f6f7387ef18d1d310ea03a4569f46cae3089bba91dd71692b9eee8c8e4'
            'bd5a00a7b6aefa97c31b60de38afe6d2d8de11b6535e41c01a47d3e6269e043f048a281af80144de1528abe20a6becc4b3e673cabe4edd8f5921d5942d653227'
            'a99c5ba2aca337798c1d0f4f895a7ef4b83658e11b274df2c2b402679c12bf7a8a9ee3d04cd71f77b2f97f2bda0e89410f4555e9cdcc1c2e9507d0efb28364b6'
            '56fd65798efea805dac6900528c9720e6af8c81d93c08ab99adedca1c63757334c7a1d4cabed0a427c447dc1bbf05ece6abb8be3a3cbaf19919c7a86729f99af'
	    'c0333a744dc2e6e34e341dea4242c2a9337c015fe0e918ede1c24051f7f6992f260bb1329b86ae7d884d9287497c25eab13602a024be45e901d14d1faad74b3d')
provides=("spamassassin=${pkgver}")
conflicts=('spamassassin')

prepare() {
  cd "${srcdir}/Mail-SpamAssassin-${pkgver}"

  sed -i t/sa_compile.t \
	  -e 's#^my $temp_binpath = $Config{sitebinexp};#my $temp_binpath = "/bin/site_perl/";#'
  sed -i '
    /^&run_makefile_pl (".*");$/ s/PREFIX=\S\+//
  ' t/sa_compile.t
}

build() {
  cd "${srcdir}/Mail-SpamAssassin-${pkgver}"

  # install module in vendor directories.
  export PERL_USE_UNSAFE_INC=1
  PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor \
      CONTACT_ADDRESS=root@localhost ENABLE_SSL=yes PERL_TAINT=no
  make
  find . -name 'spamd' -type f -execdir patch -p1 -i "${srcdir}/spamd.patch" \;
}

check() {
  cd "${srcdir}/Mail-SpamAssassin-${pkgver}"

  # parallel tests cause lots of failures; disable for now
  #export HARNESS_OPTIONS="j$(echo $MAKEFLAGS | sed 's/.*-j\([0-9][0-9]*\).*/\1/')"

  make test || true
}

package() {
  cd "${srcdir}/Mail-SpamAssassin-${pkgver}"
  make DESTDIR="${pkgdir}" install

  install -D -m644 -t "${pkgdir}/usr/lib/systemd/system/" "${srcdir}/spamassassin.service" "${srcdir}/spamassassin-update.service" "${srcdir}/spamassassin-update.timer"
  install -d -o 182 -g 182 -m 755 "$pkgdir/var/lib/spamassassin"
  install -m444 -t "${pkgdir}/usr/share/perl5/vendor_perl/Mail/SpamAssassin/" "${srcdir}/AuthCourier.pm"

  echo 'u spamd 182 - /var/lib/spamassassin' |
	  install -Dm644 /dev/stdin "$pkgdir"/usr/lib/sysusers.d/${pkgname%-*}.conf
}