aboutsummaryrefslogtreecommitdiffstats
path: root/testing/rspamd/APKBUILD
blob: c04f33babf5ad7f62b13677c79fdbdd7f87ee40e (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# Maintainer: Valery Kartel <valery.kartel@gmail.com>
# Contributor: Valery Kartel <valery.kartel@gmail.com>
pkgname=rspamd
pkgver=1.1.0
pkgrel=1
pkgdesc="Rapid spam filtering system"
url="https://rspamd.com"
arch="all"
license="BSD-2-clause"
pkgusers="rspamd"
pkggroups="rspamd"
depends=""
depends_dev=""
makedepends="$depends_dev cmake openssl-dev libevent-dev glib-dev gmime-dev
	luajit-dev sqlite-dev hiredis-dev file-dev pcre-dev"
install="$pkgname.pre-install"
subpackages="$pkgname-doc $pkgname-web $pkgname-client $pkgname-contrib"
source="https://rspamd.com/downloads/$pkgname-$pkgver.tar.xz
	$pkgname.logrotated
	$pkgname.initd
	$pkgname.confd
	$pkgname.conf
	$pkgname.worker_normal
	$pkgname.worker_controller
"

_builddir="$srcdir"/$pkgname-$pkgver

build() {
	cd "$_builddir"
	cmake CMakeLists.txt \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCONFDIR=/etc/$pkgname \
		-DRUNDIR=/run/$pkgname \
		-DRSPAMD_USER=$pkgusers \
		-DRSPAMD_GROUP=$pkggroups \
		-DENABLE_HIREDIS=ON \
		-DINSTALL_EXAMPLES=ON \
	|| return 1
	make || return 1
}

package() {
	cd "$_builddir"
	make DESTDIR="$pkgdir" install || return 1
	find "$pkgdir"/usr/bin -type l -delete
	rm -fr "$pkgdir"/etc/$pkgname/rspamd* "$pkgdir"/etc/$pkgname/worker*

	sed -i -E 's~DBDIR(/rspamd.sock)~RUNDIR\1~' "$pkgdir"/etc/$pkgname/options.inc
	install -Dm644 "$srcdir"/$pkgname.conf "$pkgdir"/etc/$pkgname/$pkgname.conf
	install -Dm644 "$srcdir"/$pkgname.worker_normal "$pkgdir"/etc/$pkgname/worker.d/normal.conf

	install -Dm644 "$srcdir"/$pkgname.logrotated "$pkgdir"/etc/logrotate.d/$pkgname
	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -Dm644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname

	install -dm750 -o $pkgusers -g $pkggroups "$pkgdir"/var/lib/$pkgname
	install -dm750 -g $pkggroups "$pkgdir"/var/log/$pkgname

	mkdir "$pkgdir"/usr/sbin
	mv "$pkgdir"/usr/bin/rspamd-$pkgver "$pkgdir"/usr/sbin/rspamd
	mv "$pkgdir"/usr/bin/rspamadm-$pkgver "$pkgdir"/usr/bin/rspamadm

	mv "$pkgdir"/usr/share/examples "$pkgdir"/usr/share/doc
	mv "$pkgdir"/usr/share/$pkgname/www/README.md \
		"$pkgdir"/usr/share/$pkgname/www/plugins.txt \
		"$pkgdir"/usr/share/doc/$pkgname
}

web() {
	arch="noarch"
	license="MIT"
	depends="$pkgname"
	pkgdesc="$pkgdesc (web control interface)"
	mkdir -p "$subpkgdir"/usr/share/$pkgname "$subpkgdir"/etc/$pkgname/worker.d
	mv "$pkgdir"/usr/share/$pkgname/www "$subpkgdir"/usr/share/$pkgname/
	install -Dm644 "$srcdir"/$pkgname.worker_controller "$subpkgdir"/etc/$pkgname/worker.d/controller.conf
}

client() {
	pkgdesc="$pkgdesc (console client)"
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/rspamc-$pkgver "$subpkgdir"/usr/bin/rspamc
}

contrib() {
	arch="noarch"
	pkgdesc="Some useful stuff to deploying rspamd to another apps"
	mkdir -p "$subpkgdir"/usr/share/$pkgname/contrib
	# Exim specific stuff
	cp -r "$_builddir"/contrib/exim "$subpkgdir"/usr/share/$pkgname/contrib/
}

md5sums="c14cc28bc346a3f12623e472ba508f43  rspamd-1.1.0.tar.xz
3fd4d0e28cb01224a786c0498266e9a6  rspamd.logrotated
dba3145a52bee22d8ed1192dc44506ad  rspamd.initd
ecfea2a25b95727ae91c04001fbd3e46  rspamd.confd
a5f0967b3d9aa319909af7e1bfe998e1  rspamd.conf
74e334227e9244c419abd605787c090e  rspamd.worker_normal
03bd84228945261e2242564f9bf5f1ca  rspamd.worker_controller"
sha256sums="69db05150b4ba8304d24dd0f96c79b5d3792478373f0d6be6c92b51b1cf60ead  rspamd-1.1.0.tar.xz
cb02c8c041a0ace2e3c9e4fbf514038871b4444575c9022a75e661130db875fd  rspamd.logrotated
83acf26538826ce58039236660807cc87b9d4abc628fa6e2ddbb4201eac5424e  rspamd.initd
82be6a663af2e2333b0dfbbbfd05a9ff3d02e05c7e506235b1b0dbd9d0b72972  rspamd.confd
5a223efb12e962e0f3bfe9f6d08336c6074b0b2930b8da6a22fe6582142ee40c  rspamd.conf
7805103a2e11cf816e99dba7d67fdc584ece33d9ea3ef95f95f4fce91a34eb90  rspamd.worker_normal
f50663096866b35095f7a6754e3cfb0bab518645d61646703715cf43da5adf77  rspamd.worker_controller"
sha512sums="41a8fb49a10082b1dc97397ebb8ac81dd3f4912e9140dcb7c57c9e15f1e49cf472aa94570a2f802b82e3db8ab8a87dd6a63f7db7249da4d99473700535045256  rspamd-1.1.0.tar.xz
3b95882b1804d8dc6524a4c2cdf3f656b2f9bf5db6228b92d1acd539629070aead654c1f58937e1473e4f07340dc3de7b212f87b36143c5cb3fcb3b472a85f5a  rspamd.logrotated
12b2a92126f911e29d5ace836404ca8170bc19181f3b61896726b0dea79b03bc3b9295d876b96a633a3b4a963646cf7bebfbe10489ad24f373d81fd5a84f21b1  rspamd.initd
0b73b159cec9a4a1d337fbb429814f78da23b55f72c9fb8a777ab5f06634206a4f9b25e587f8dbfa7c3242ac5501ebcc90b9a0e926adfd37e14a12ac4607fa62  rspamd.confd
90885bd8f9fcd47590eedf8f1f058df7c492005fc09058e99ee490e1730f4961909850ecf9e98723bfbd3cbe8df705f86a0de931dedb25bc66b246674f537a72  rspamd.conf
ddf1af03878ed2f4b1e735ecd9f931f1941adf7b2085aa7a40f3ef303fa5c59791d0d7462064c2ac652af2722b83acd4379f549d341cb62767e74edefb69ba9a  rspamd.worker_normal
932486ee517ca55534e93eb634badd9082a3952e25a66f98468c7b9c29ce4a26a5a96f465ee347dfd5443d330b1dd11b72680bc6ac04c2ebe45412f4432e8f62  rspamd.worker_controller"