# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer:
setvar pkgname = 'clapf'
setvar pkgver = '0.4.7.4'
setvar pkgrel = '3'
setvar pkgdesc = ""clapf is an open source email content filter application""
setvar url = ""http://clapf.org""
setvar arch = ""all""
setvar license = ""as-is""
setvar depends = ""clamav-db""
setvar depends_dev = ""gsl-dev mysql-dev clamav-dev zlib-dev bzip2-dev""
setvar makedepends = ""$depends_dev autoconf automake""
setvar install = ""$pkgname.pre-install""
setvar options = ""suid""
setvar CLAPF_USER = ""clapf""
setvar CLAPF_GROUP = ""clapf""
setvar pkgusers = "$CLAPF_USER"
setvar pkggroups = "$CLAPF_GROUP"
setvar subpackages = ""$pkgname-dev""
# * 31d2ce87967e released 0.4.7.4
setvar COMMIT = '31d2ce87967e'
setvar source = ""$pkgname-$pkgver-g$COMMIT.tar.gz::https://bitbucket.org/jsuto/$pkgname/get/$COMMIT.tar.gz
	gsl-libs.patch
	def__user.patch
	ldflags.patch
	clapf.confd
	clapf.initd""

setvar builddir = ""$srcdir/jsuto-$pkgname-$COMMIT""

proc prepare {
	default_prepare || return 1
	aclocal && autoconf
}

proc build {
	cd $builddir
	./configure --prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--enable-libclamav \
		--with-tokendb=mysql \
		--enable-lmtp \
		--with-store=fs \
		--enable-blackhole \
		--enable-rbl \
		--enable-policy \
		--enable-whitelist \
		--enable-blackhole \
		--with-clapf-user=$CLAPF_USER \
		--enable-language-detection \
		--enable-memcached \
		--enable-spamsum

	make || return 1
}

proc package {
	cd $builddir
	make -j1 DESTDIR="$pkgdir" install \
		|| return 1
	install -D -m 755 \
	        "$srcdir"/clapf.initd \
	        "$pkgdir"/etc/init.d/clapf \
		|| return 1
	install -D -m 644 \
	        "$srcdir"/clapf.confd \
	        "$pkgdir"/etc/conf.d/clapf \
		|| return 1
	install -d -o $CLAPF_USER -g $CLAPF_GROUP \
	        "$pkgdir"/var/run/$pkgname \
		|| return 1
	mkdir -p \
	      "$pkgdir"/var/spool/clapf/tmp \
		|| return 1
	chown -R $CLAPF_USER:$CLAPF_GROUP \
	      "$pkgdir"/var/lib/clapf \
	      "$pkgdir"/var/spool/clapf \
		|| return 1
}

setvar md5sums = ""0a38f56f717b170d8b6e5f780cd2281d  clapf-0.4.7.4-g31d2ce87967e.tar.gz
7f480d5a8d0da4863b682deddfe47eff  gsl-libs.patch
ba31f71c066f3f6159548808d2e26d8b  def__user.patch
967743d70cdf21dd929117865c7053c0  ldflags.patch
1e3786f78bbdfaba1f2d414f9fa19907  clapf.confd
3ab39ee86b80ba8e19e8f41686d35bc6  clapf.initd""
setvar sha256sums = ""84b1e15462985531e865b5700200d1f0fc09289e5cce00f3d8ab0fdefe4b51cc  clapf-0.4.7.4-g31d2ce87967e.tar.gz
4b4bb8530ac740a5279e0fdd959c6b706b3635792030f6b242e282f8d923202c  gsl-libs.patch
0523e889808f6aa3ec71a34846cbdfc9d1b185463583dcd7239673d098402346  def__user.patch
d9b5fdbc6ca3118a3e382bcdca383ccca4cdac660303d39a7221bc6475f4eaac  ldflags.patch
429a4a6f832cb00f5fcfa0218656bcefa68d80f1f6d2f21ee4dfe1dceef15f69  clapf.confd
bafcb80e5f142f9680a7b8a94c848d84a6940d6c807122d0ed10f004c035faf9  clapf.initd""
setvar sha512sums = ""f13428be93cd170e24c70e608d15ef7d6054fa1d57dc9dae4efc4b78c464a1ab3102d99114ddfa3fe011e0a6b6ae2076ee46d5d64561604d0b758fae947d22da  clapf-0.4.7.4-g31d2ce87967e.tar.gz
096ed4afe1b0fad569a172d6af952f1590d230dd38f6f0c4c0b1e7f29a1515fd887f1c099267aa926ce698864b75cb50626a9b7f49914549748d22ba7058a31d  gsl-libs.patch
18b8bf55f20e86e05958f2b4a8bdea8bedeb712bc91bb9a6a67faa2928b545707d3391671ab843415fe11703fef4683594571136cf9b2ec87aa41b0875d34588  def__user.patch
f391663c74ce55b33446bbca9cde61201147d8704f514a266ea1371a43231e34800a8dc6e9f3843849ac000aa49ec2cffc023795696b6127bb404df83493f10f  ldflags.patch
f9d931f59710ca5ffae2d08d95d12d090dbbd932f8aa0ebb15e925704563834249e475e7ae8e845fb0f57396cdc11492b54efa0f5c228222f04a0e0c0e92caa5  clapf.confd
c4dff1a3627f9de640dbe6c9a7c69f0e8357f9c63a3fb41f3c6c1e7ee6caec431be6f473002847f1fd2c6c41f7d2730ae134a5b04c9df77502b0905657f524e8  clapf.initd""