aboutsummaryrefslogtreecommitdiffstats
path: root/testing/rspamd/APKBUILD
blob: 78437d599f4b7b2c916c5ea8ec9978812b52b65d (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
# Maintainer: Valery Kartel <valery.kartel@gmail.com>
# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Contributor: Nathan Angelacos <nangel@alpinelinux.org>
pkgname=rspamd
pkgver=1.4.4
pkgrel=0
pkgdesc="Fast, free and open-source spam filtering system"
url="https://rspamd.com"
arch="x86_64 x86 armhf"
license="BSD"
pkgusers="rspamd"
pkggroups="rspamd"
depends=""
makedepends="cmake ragel perl lua-dev glib-dev pcre-dev gmime-dev
	libevent-dev sqlite-dev libressl-dev file-dev curl-dev"
install="$pkgname.pre-install"
subpackages="$pkgname-doc $pkgname-controller::noarch $pkgname-client
	$pkgname-fuzzy::noarch $pkgname-utils::noarch"
source="https://rspamd.com/downloads/$pkgname-$pkgver.tar.xz
	$pkgname.logrotated
	$pkgname.initd
	$pkgname.confd
	config.patch
	cmakelists.patch
	"
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_DB=ON \
		-DENABLE_SQLITE=ON \
		-DENABLE_HIREDIS=ON \
		-DENABLE_REDIRECTOR=ON \
		-DENABLE_URL_INCLUDE=ON \
		-DINSTALL_EXAMPLES=ON \
		|| return 1
	make || return 1
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install || return 1

	rm "$pkgdir"/etc/$pkgname/$pkgname.systemd.conf
	mv "$pkgdir"/etc/$pkgname/$pkgname.sysvinit.conf \
		"$pkgdir"/etc/$pkgname/$pkgname.conf
	sed -ri -e 's~DBDIR(/rspamd.sock)~RUNDIR\1~' \
		-e 's~rspamd_dynamic~dynamic~' \
		"$pkgdir"/etc/$pkgname/options.inc

	mkdir -p "$pkgdir"/etc/$pkgname/local.d "$pkgdir"/etc/$pkgname/override.d

	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 -g $pkggroups "$pkgdir"/var/lib/$pkgname/dynamic
	install -dm750 -g $pkggroups "$pkgdir"/var/log/$pkgname
	chown $pkgusers "$pkgdir"/var/lib/$pkgname

	mkdir "$pkgdir"/usr/sbin
	find "$pkgdir"/usr/bin -type l -delete
	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
}

controller() {
	license="MIT"
	depends="$pkgname"
	pkgdesc="$pkgdesc (controller web interface)"
	mkdir -p "$subpkgdir"/usr/share/$pkgname "$subpkgdir"/etc/$pkgname
	mv "$pkgdir"/usr/share/$pkgname/www "$subpkgdir"/usr/share/$pkgname/
	mv "$pkgdir"/etc/$pkgname/worker-controller.* "$subpkgdir"/etc/$pkgname
}

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

fuzzy() {
	depends="$pkgname"
	pkgdesc="$pkgdesc (local fuzzy storage)"
	mkdir -p "$subpkgdir"/etc/$pkgname/modules.d
	mv "$pkgdir"/etc/$pkgname/worker-fuzzy.* "$subpkgdir"/etc/$pkgname
	mv "$pkgdir"/etc/$pkgname/modules.d/fuzzy_* "$subpkgdir"/etc/$pkgname/modules.d
}

utils() {
	depends="perl"
	pkgdesc="$pkgdesc (utilities)"
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/${pkgname}_stats "$subpkgdir"/usr/bin/${pkgname}-stats
	mv "$pkgdir"/usr/bin/${pkgname}-redirector "$subpkgdir"/usr/bin
}

sha512sums="df2260de6585699a5b6692aa210647270b7132372ae6a2437f8532265018fe4db8270a8989ce0c0664cad17cbc281ae92f935c4f0974dc2f8da309e54c234b14  rspamd-1.4.4.tar.xz
2efe28575c40d1fba84b189bb872860e744400db80dce2f6330be6c6287fb3f46e6511284729b957488bf40bcb9b0952e26df9934f5f138334bd2766075c45cb  rspamd.logrotated
df37726d03e676b16d707854d95bafc9162da65c27bb150edbfc0cb00f1842188a1f2a8f1b82be5ae2a253b4f4db4d93dfe804a89feb988b5af858eb3f3458be  rspamd.initd
e417dd825d1b4d03d115db037b2fdf2f48a35420ee7a9010d97167b6c31e88d6c0a15dd33b21d7d76856db0fdc5097c922fcdf1d8164d1e92ae377f7c5303947  rspamd.confd
2089429e6f44f8204f31c87c565cdd7abcd51b3146397ba1b2fb23b1be6faf46fd8ec36718f194a3fc38ac1d38d7be9010a84ac4b49d7e1597706699538c607a  config.patch
99593c10ffb04c71a4c83c7522b41f12465a9862283685bbc2fff464fd84fcf8b4bc4a892419d31332c01f805c69dd7730f537c60248b92fee35acdc6633a644  cmakelists.patch"