summaryrefslogtreecommitdiff
path: root/community/p3scan/PKGBUILD
blob: 7312974e865b8d102bd2526f682b937161e5b696 (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
# $Id: PKGBUILD 78346 2012-10-17 14:53:26Z spupykin $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: v01d <phreakuencies@gmail.com>

pkgname=p3scan
pkgver=2.3.2
pkgrel=7
pkgdesc="Fully transparent POP3/SMTP proxy with Anti-Virus and SPAM protection"
arch=('i686' 'x86_64')
url="http://p3scan.sourceforge.net/"
depends=('pcre' 'openssl')
license=('GPL')
install=p3scan.install
source=("http://downloads.sourceforge.net/sourceforge/$pkgname/$pkgname-$pkgver.tar.gz"
	"rc.p3scan"
	"p3scan.service"
	"p3scan.tmpfiles")
md5sums=('9f8decc7d4701228788e3c8717096ca0'
         '482a783e699b6532cbc478977f429eb5'
         'dc724b50963d80be7924fc4d9d4856f0'
         '265a730e20e3d8aaf0cd7816dc98ca71')

build() {
  cd $srcdir/$pkgname-$pkgver

  # Fix CFLAGS and other options hardcoded in Makefiles
  unset CFLAGS
  sed -ri "s|^CFLAGS=-Wall( -g)? -O2|CFLAGS=-Wall $CFLAGS|" Makefile ripmime/Makefile ripmime/tnef/Makefile ripmime/ripOLE/Makefile
  sed -ri 's|^LOCATION=.+$|LOCATION=/usr|' ripmime/Makefile
  sed -ri 's|\$\(SYSINS\) -v -m 550 --strip p3scan \$\(PREFIX\)/sbin/|$(SYSINS) -D -v -m 550 --strip p3scan $(DESTDIR)/usr/sbin/|' Makefile
  make
}

package() {
  cd $srcdir/$pkgname-$pkgver

  # Create base dirs, the Makefile assumes they're there
  install -d $pkgdir/usr/sbin $pkgdir/etc/rc.d $pkgdir/usr/man/man8

  # install with root set on $pkgdir
  make DESTDIR=$pkgdir install

  # delete init script provided and use an arch compatible one
  rm -f $pkgdir/etc/rc.d/rc.p3scan
  install -D -m755 -g root -o root $srcdir/rc.p3scan $pkgdir/etc/rc.d/p3scan

  # BUG?: make absolute link a relative one
  (
    cd $pkgdir/etc/p3scan
    ln -sf p3scan-en.mail p3scan.mail
  )

  # BUG: fix .conf file (the license has C style comments, they should be conf-style comments)
  sed -ri 's|^[/ ]\*/?|# |g' $pkgdir/etc/p3scan/p3scan.conf

  mv $pkgdir/usr/man $pkgdir/usr/share/
  mv $pkgdir/usr/doc $pkgdir/usr/share/
  rm -rf $pkgdir/var/run

  install -Dm0644 $srcdir/$pkgname.service $pkgdir/usr/lib/systemd/system/$pkgname.service
  install -Dm0644 $srcdir/$pkgname.tmpfiles $pkgdir/usr/lib/tmpfiles.d/$pkgname.conf
}