aboutsummaryrefslogtreecommitdiffstats
path: root/community/rspamd/APKBUILD
blob: 3595ccf9dca9984185484a604e50da6cd7a26ecf (plain) (blame)
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# Maintainer: Valery Kartel <valery.kartel@gmail.com>
# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Contributor: Nathan Angelacos <nangel@alpinelinux.org>
# Contributor: TBK <alpine@jjtc.eu>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
pkgname=rspamd
pkgver=1.9.4
pkgrel=0
pkgdesc="Fast, free and open-source spam filtering system"
url="https://rspamd.com/"
arch="all !s390x"
license="Apache-2.0 BSD-1-Clause BSD-2-Clause BSD-3-Clause CC0 LGPL-2.1-or-later
	LGPL-3.0-only MIT Zlib"
pkgusers="rspamd"
pkggroups="rspamd"
makedepends="
	cmake
	curl-dev
	file-dev
	gd-dev
	glib-dev
	icu-dev
	libevent-dev
	openssl-dev
	luajit-dev
	pcre2-dev
	perl
	ragel
	sqlite-dev
	"
checkdepends="luarocks"
install="$pkgname.pre-install $pkgname.post-upgrade"
subpackages="
	$pkgname-doc
	$pkgname-client
	$pkgname-utils::noarch
	$pkgname-controller::noarch
	$pkgname-fuzzy::noarch
	$pkgname-proxy::noarch
	$pkgname-openrc
	$pkgname-dbg
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/vstakhov/$pkgname/archive/$pkgver.tar.gz
	$pkgname.logrotated
	$pkgname.initd
	$pkgname.confd
	cmakelists.patch
	conf-split-workers.patch
	default-configs.patch
	lua-torch-fix-simd-detection.patch
	"

build() {
	cmake . \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCONFDIR=/etc/$pkgname \
		-DRUNDIR=/run/$pkgname \
		-DRSPAMD_USER=$pkgusers \
		-DRSPAMD_GROUP=$pkggroups \
		-DENABLE_DB=ON \
		-DENABLE_SQLITE=ON \
		-DENABLE_HIREDIS=ON \
		-DENABLE_REDIRECTOR=ON \
		-DENABLE_URL_INCLUDE=ON \
		-DENABLE_PCRE2=ON \
		-DINSTALL_EXAMPLES=OFF
	make
}

check() {
	make rspamd-test
}

package() {
	make DESTDIR="$pkgdir" install

	cd "$pkgdir"

	find usr/bin -type l -delete
	mkdir -p ./usr/sbin
	mv ./usr/bin/rspamd-$pkgver ./usr/sbin/rspamd
	mv ./usr/bin/rspamadm-$pkgver ./usr/bin/rspamadm

	mkdir -p ./usr/share/doc/$pkgname
	mv ./usr/share/$pkgname/www/README.md \
		./usr/share/$pkgname/www/plugins.txt \
		./usr/share/doc/$pkgname/

	install -Dm 644 "$srcdir"/$pkgname.logrotated ./etc/logrotate.d/$pkgname
	install -Dm 755 "$srcdir"/$pkgname.initd ./etc/init.d/$pkgname
	install -Dm 644 "$srcdir"/$pkgname.confd ./etc/conf.d/$pkgname

	mkdir -p ./etc/$pkgname/local.d \
		./etc/$pkgname/override.d

	install -dm 750 -o rspamd -g rspamd \
		./var/lib/$pkgname \
		./var/lib/$pkgname/dynamic
	install -dm 750 -o rspamd -g rspamd \
		./var/log/$pkgname
}

client() {
	pkgdesc="$pkgdesc (console client)"

	cd "$pkgdir"
	mkdir -p "$subpkgdir"/usr/bin
	mv ./usr/bin/rspamc-$pkgver "$subpkgdir"/usr/bin/rspamc
}

utils() {
	pkgdesc="$pkgdesc (utilities)"
	depends="perl"

	cd "$pkgdir"
	mkdir -p "$subpkgdir"/usr/bin
	mv ./usr/bin/${pkgname}_stats "$subpkgdir"/usr/bin/${pkgname}-stats
	_mv ./usr/bin/${pkgname}-redirector "$subpkgdir"/usr/bin/
}

fuzzy() {
	pkgdesc="$pkgdesc (local fuzzy storage)"
	license="Apache-2.0"
	depends="$pkgname"

	cd "$pkgdir"
	_mv ./etc/$pkgname/worker-fuzzy.* "$subpkgdir"/etc/$pkgname/
	_mv ./etc/$pkgname/modules.d/fuzzy_* "$subpkgdir"/etc/$pkgname/modules.d/
}

controller() {
	pkgdesc="$pkgdesc (controller web interface)"
	license="MIT"
	depends="$pkgname"

	cd "$pkgdir"
	_mv ./usr/share/$pkgname/www "$subpkgdir"/usr/share/$pkgname/
	_mv ./etc/$pkgname/worker-controller.* "$subpkgdir"/etc/$pkgname/
}

proxy() {
	pkgdesc="$pkgdesc (milter support)"
	license="Apache-2.0"
	depends="$pkgname"

	cd "$pkgdir"
	_mv ./etc/$pkgname/worker-proxy.* "$subpkgdir"/etc/$pkgname/
}

_mv() {
	local dest; for dest; do true; done  # get last argument
	mkdir -p "$dest"
	mv "$@"
}

sha512sums="3acecec6adb91580ac2ad96419fdc9588b120ec5a3b4a44135fc5a3e7c15f2dbc99963a8337f9effb9423846489545a55d89d1849c5ba62d8cd91dc67c32d8dc  rspamd-1.9.4.tar.gz
2efe28575c40d1fba84b189bb872860e744400db80dce2f6330be6c6287fb3f46e6511284729b957488bf40bcb9b0952e26df9934f5f138334bd2766075c45cb  rspamd.logrotated
7add88e4bf3508d2a148241cd8db97851a33a7128be75f2a072a029b32b565e9de0299ad614fbda7f70ed54d1b6e2faa305eff3e443e90451abf59dedc1af576  rspamd.initd
a2003ef0c9d64a44480f59302864a2dfedcbe3a0047fcbb655408bc8aae9014b6ad0ddc6b64d4abeeb21bea0f86678afd30589ac8eed83e07ad7f87710e93702  rspamd.confd
accbe762e542df65e28301048672d4a0cf3a1c7e9a04c38ab3010f0ed9df9ad1122129727580408a69939f25c4dbea3b2b7aa0d452722125fac9eb0043bb2579  cmakelists.patch
a8aefee649bf6630339d1d3f2bb20c25ca70b21a8eaa92951e926d0fd4525f1d4ac4cc7ea66ac2b15323cf02c93c759ddf7181502f0d71b21384ced9d88c008e  conf-split-workers.patch
bca1b1361524e1c582f2d6f9d754766c63f60a856b9f0d858e17dfebb40f2046db3a759eb3dffc5075460c3d3b64224092e043f07bcd8331daa97babc61ea973  default-configs.patch
2987f122653680207b97a9f93978192384804f93a8fa040085e53a801c77364e8bd7ceb0fabca62a9c7316ff32bcf3dee8f0d1b8cd2c29459c6272a19e8e293b  lua-torch-fix-simd-detection.patch"