summaryrefslogtreecommitdiff
path: root/libre/bogofilter/PKGBUILD
blob: 5bca6453502cb6772798220a5e1e7ec028e12490 (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
# $Id: PKGBUILD 260085 2016-02-20 18:28:03Z andyrtr $
# Maintainer (Arch): AndyRTR <andyrtr@archlinux.org>
# Contributor (Arch): tobias <tobias@archlinux.org>
# Contributor (Arch): Low Kian Seong <fastmail_low@speedymail.org>
# Maintainer: Márcio Silva <marcio@parabola.nu>

pkgname=bogofilter
_pkgname=$pkgname-libre
pkgver=1.2.4
pkgrel=2.parabola1
pkgdesc="A fast Bayesian spam filtering tool, without noncommercial files"
arch=('i686' 'x86_64')
license=('GPL3')
url="http://$pkgname.sourceforge.net"
depends=('db' 'perl' 'gsl') # 'sqlite'
makedepends=('valgrind' 'xmlto')
backup=("etc/$pkgname/$pkgname.cf")
mksource=(http://sourceforge.net/projects/${pkgname}/files/${pkgname}-current/${pkgname}-${pkgver}/${pkgname}-${pkgver}.tar.bz2)
source=(https://repo.parabola.nu/other/${_pkgname}/${_pkgname}-${pkgver}.tar.bz2
        bogofilter-1.2.4-test-env.patch)
mkmd5sums=('d0a5eebb3274b23ceabe766a6443a1c5')
md5sums=('cce573e059d39a68cf78097dbfaa5b2d'
         'd01f23755ee9b4f5807b9feefea0b42d')
replaces=("${_pkgname}")
conflicts=("${_pkgname}")

# keep Berkeley DB as backend for now
# sqlite3 based backend doesn't allow
# to use db-transaction option that is
# used to bf_compact the wordlist.db
# other backend aren't available
# currently in Parabola repos

mksource() {
  cd ${pkgname}-${pkgver}
  # remove noncommercial files
  rm doc/$pkgname-SA-{2005-0{1,2},2010-01}
}

prepare() {
  cd ${pkgname}-${pkgver}
  # taken from Gentoo
  patch -Np1 -i $srcdir/$pkgname-1.2.4-test-env.patch
  chmod +x src/tests/t.{ctype,leakfind,lexer.qpcr,lexer.eoh,message_id,queue_id}
  autoreconf -vfi
}

build() {
  cd ${pkgname}-${pkgver}
  ./configure --prefix=/usr \
              --sysconfdir=/etc/$pkgname  \
              --localstatedir=/var \
              --enable-transactions \
              --with-database=db  #--help
  make
}

check() {
  cd ${pkgname}-${pkgver}
  BF_RUN_VALGRIND=1 make -k -C src check || /bin/true
}

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install

  mv "${pkgdir}/etc/$pkgname/$pkgname.cf.example" "${pkgdir}/etc/$pkgname/$pkgname.cf"

  install -dm755 "${pkgdir}/usr/share/${pkgname}/contrib"
  install -m644 contrib/* "${pkgdir}/usr/share/${pkgname}/contrib/"
}