dev-python/routes: amd64 stable wrt bug #720594
[gentoo.git] / mail-filter / rspamd / rspamd-2.4.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 inherit cmake pax-utils systemd tmpfiles
7
8 if [[ ${PV} == *9999 ]] ; then
9         EGIT_REPO_URI="https://github.com/rspamd/rspamd.git"
10         inherit git-r3
11 else
12         SRC_URI="https://github.com/rspamd/rspamd/archive/${PV}.tar.gz -> ${P}.tar.gz"
13         KEYWORDS="~amd64 ~x86"
14 fi
15
16 DESCRIPTION="Rapid spam filtering system"
17 HOMEPAGE="https://rspamd.com/ https://github.com/rspamd/rspamd"
18 LICENSE="Apache-2.0 Boost-1.0 BSD BSD-1 BSD-2 CC0-1.0 LGPL-3 MIT public-domain unicode ZLIB"
19 SLOT="0"
20 IUSE="blas cpu_flags_x86_ssse3 jemalloc +jit libressl pcre2"
21
22 RDEPEND="
23         acct-group/rspamd
24         acct-user/rspamd
25         dev-db/sqlite:3
26         dev-libs/glib:2
27         dev-libs/icu:=
28         dev-libs/libev
29         dev-libs/libsodium
30         dev-util/ragel
31         net-libs/libnsl
32         sys-apps/file
33         blas? ( sci-libs/openblas )
34         cpu_flags_x86_ssse3? ( dev-libs/hyperscan )
35         jemalloc? ( dev-libs/jemalloc )
36         jit? ( dev-lang/luajit:2 )
37         !jit? ( dev-lang/lua:* )
38         !libressl? ( dev-libs/openssl:0=[-bindist] )
39         libressl? ( dev-libs/libressl:0= )
40         pcre2? ( dev-libs/libpcre2[jit=] )
41         !pcre2? ( dev-libs/libpcre[jit=] )"
42 DEPEND="${RDEPEND}"
43
44 src_prepare() {
45         cmake_src_prepare
46
47         sed -i -e 's/User=_rspamd/User=rspamd/g' \
48                 rspamd.service \
49                 || die
50 }
51
52 src_configure() {
53         local mycmakeargs=(
54                 -DCONFDIR=/etc/rspamd
55                 -DRUNDIR=/var/run/rspamd
56                 -DDBDIR=/var/lib/rspamd
57                 -DLOGDIR=/var/log/rspamd
58                 -DENABLE_BLAS=$(usex blas ON OFF)
59                 -DENABLE_HYPERSCAN=$(usex cpu_flags_x86_ssse3 ON OFF)
60                 -DENABLE_JEMALLOC=$(usex jemalloc ON OFF)
61                 -DENABLE_LUAJIT=$(usex jit ON OFF)
62                 -DENABLE_PCRE2=$(usex pcre2 ON OFF)
63         )
64         cmake_src_configure
65 }
66
67 src_test() {
68         cmake_src_test
69 }
70
71 src_install() {
72         cmake_src_install
73
74         newconfd "${FILESDIR}"/rspamd.conf rspamd
75         newinitd "${FILESDIR}/rspamd-r7.init" rspamd
76         systemd_newunit rspamd.service rspamd.service
77
78         newtmpfiles "${FILESDIR}"/${PN}.tmpfile ${PN}.conf
79
80         # Remove mprotect for JIT support
81         if use jit; then
82                 pax-mark m "${ED}"/usr/bin/rspamd-* "${ED}"/usr/bin/rspamadm-*
83         fi
84
85         insinto /etc/logrotate.d
86         newins "${FILESDIR}"/rspamd-r1.logrotate rspamd
87
88         diropts -o rspamd -g rspamd
89         keepdir /var/{lib,log}/rspamd
90 }
91
92 pkg_postinst() {
93         tmpfiles_process "${PN}.conf"
94 }