aboutsummaryrefslogtreecommitdiffstats
path: root/testing/rspamd/APKBUILD
blob: 54fba8e8e1647da23288188018913250d58c50b0 (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
# 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.0
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=""
depends_dev=""
makedepends="$depends_dev 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
"

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 (utils)"
	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
}

md5sums="923b0d5fae691916feb243d61d48609f  rspamd-1.4.0.tar.xz
c152c6a90f6ae9e5a7a1d137dfbc0305  rspamd.logrotated
0656acc12dcce7cba232857a848d0390  rspamd.initd
ecfea2a25b95727ae91c04001fbd3e46  rspamd.confd
ff0bf4f1b1447ca401865369f91418f1  config.patch"
sha256sums="30c9acf93bdcc6c009524c8b2770931475929c6c9e948faa90d7412306055a1c  rspamd-1.4.0.tar.xz
6c5e79e9052d957f3d0d634b2ae7a56bbc0901a5d6946dc991c92f19a72fce97  rspamd.logrotated
5bcf68a72e0582859799cd335a14d48914e5291f4087327b3b42562ef64e2958  rspamd.initd
82be6a663af2e2333b0dfbbbfd05a9ff3d02e05c7e506235b1b0dbd9d0b72972  rspamd.confd
7e0adb4a2e7e8f806fc5fdae0c37e6948ed56e9d46d4eed0c681806decb90e49  config.patch"
sha512sums="39bfccee070b829f3ea5019ebde0020a850abf7fe92f7e5bb5b9212088d4c98544e6f55228984d3422c09c31f356b209237da6a6eb9c18e3feb7940429de663a  rspamd-1.4.0.tar.xz
2efe28575c40d1fba84b189bb872860e744400db80dce2f6330be6c6287fb3f46e6511284729b957488bf40bcb9b0952e26df9934f5f138334bd2766075c45cb  rspamd.logrotated
e240983c2fd91d8061b17e35e83a75c56ac2c3625dbe07b83a2e89e3dbf69b57c675d01772b93968aa6b22d150d54d366f2fb4a0c6551b3cfdedc77d82e28652  rspamd.initd
0b73b159cec9a4a1d337fbb429814f78da23b55f72c9fb8a777ab5f06634206a4f9b25e587f8dbfa7c3242ac5501ebcc90b9a0e926adfd37e14a12ac4607fa62  rspamd.confd
2089429e6f44f8204f31c87c565cdd7abcd51b3146397ba1b2fb23b1be6faf46fd8ec36718f194a3fc38ac1d38d7be9010a84ac4b49d7e1597706699538c607a  config.patch"