blob: 8adad69a3722f7c206431efe60e8825934248c63 (
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
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
164
|
Name: rspamd
Version: 3.2
Release: 1
Summary: Rapid spam filtering system
Group: System Environment/Daemons
License: Apache-2.0
URL: https://rspamd.com
Source0: https://github.com/rspamd/rspamd/archive/%{version}/%{name}-%{version}.tar.gz
Source1: %{name}.logrotate
Source2: 80-rspamd.preset
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
%if 0%{?el7}
BuildRequires: cmake3
BuildRequires: devtoolset-8-gcc-c++
%else
BuildRequires: cmake
BuildRequires: gcc-c++
%endif
BuildRequires: file-devel
BuildRequires: glib2-devel
BuildRequires: lapack-devel
BuildRequires: libevent-devel
BuildRequires: libicu-devel
BuildRequires: libsodium-devel
BuildRequires: libunwind-devel
%ifarch x86_64 amd64
BuildRequires: hyperscan-devel
BuildRequires: jemalloc-devel
%endif
%if 0%{getenv:LUAJIT}
BuildRequires: git
%else
BuildRequires: lua-devel
%endif
%ifarch arm64 aarch64
BuildRequires: vectorscan-devel
%endif
BuildRequires: openblas-devel
BuildRequires: openssl-devel
BuildRequires: pcre2-devel
BuildRequires: ragel
BuildRequires: sqlite-devel
BuildRequires: systemd
Requires(pre): shadow-utils
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%description
Rspamd is a rapid, modular and lightweight spam filter. It is designed to work
with big amount of mail and can be easily extended with own filters written in
lua.
%prep
%setup -q -n rspamd-%{version}
%if 0%{getenv:LUAJIT}
rm -fr %{_builddir}/luajit-src || true
rm -fr %{_builddir}/luajit-build || true
git clone -b v2.1 https://luajit.org/git/luajit-2.0.git %{_builddir}/luajit-src
%endif
%build
%if 0%{getenv:LUAJIT}
pushd %{_builddir}/luajit-src && make clean && make %{?_smp_mflags} CC="gcc -fPIC" PREFIX=%{_builddir}/luajit-build && make install PREFIX=%{_builddir}/luajit-build ; popd
rm -f %{_builddir}/luajit-build/lib/*.so || true
%endif
%if 0%{?el7}
%{cmake3} \
%else
%{cmake} \
%endif
-B . \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_C_FLAGS_RELEASE="%{optflags}" \
-DCMAKE_CXX_FLAGS_RELEASE="%{optflags}" \
-DENABLE_LTO=ON \
%if 0%{?fedora} >= 36
-DLINKER_NAME=/usr/bin/ld.bfd \
%endif
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
-DCONFDIR=%{_sysconfdir}/rspamd \
-DMANDIR=%{_mandir} \
-DDBDIR=%{_localstatedir}/lib/rspamd \
-DRUNDIR=%{_localstatedir}/run/rspamd \
-DLOGDIR=%{_localstatedir}/log/rspamd \
-DEXAMPLESDIR=%{_datadir}/examples/rspamd \
-DSHAREDIR=%{_datadir}/rspamd \
-DLIBDIR=%{_libdir}/rspamd/ \
-DINCLUDEDIR=%{_includedir} \
-DRSPAMD_GROUP=_rspamd \
-DRSPAMD_USER=_rspamd \
-DSYSTEMDDIR=%{_unitdir} \
-DWANT_SYSTEMD_UNITS=ON \
-DNO_SHARED=ON \
-DDEBIAN_BUILD=1 \
-DENABLE_LIBUNWIND=ON \
%ifarch x86_64 amd64 arm64 aarch64
-DENABLE_HYPERSCAN=ON \
%endif
%ifarch x86_64 amd64
-DENABLE_JEMALLOC=ON \
%endif
%if 0%{getenv:LUAJIT}
-DENABLE_LUAJIT=ON \
-DLUA_ROOT=%{_builddir}/luajit-build \
%endif
-DENABLE_BLAS=ON
make %{?_smp_mflags}
%install
%make_install
%{__install} -p -D -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
%{__install} -p -D -m 0644 %{SOURCE2} %{buildroot}%{_presetdir}/80-rspamd.preset
%{__install} -d -p -m 0755 %{buildroot}%{_localstatedir}/log/rspamd
%{__install} -d -p -m 0755 %{buildroot}%{_localstatedir}/lib/rspamd
%{__install} -p -D -d -m 0755 %{buildroot}%{_sysconfdir}/%{name}/local.d/
%{__install} -p -D -d -m 0755 %{buildroot}%{_sysconfdir}/%{name}/override.d/
%clean
rm -rf %{buildroot}
%pre
%{_sbindir}/groupadd -r _rspamd 2>/dev/null || :
%{_sbindir}/useradd -g _rspamd -c "Rspamd user" -s /bin/false -r -d %{_localstatedir}/lib/rspamd _rspamd 2>/dev/null || :
%post
%{__chown} -R _rspamd:_rspamd %{_localstatedir}/lib/rspamd
%{__chown} _rspamd:_rspamd %{_localstatedir}/log/rspamd
systemctl --no-reload preset %{name}.service >/dev/null 2>&1 || :
%preun
%systemd_preun %{name}.service
%postun
%systemd_postun_with_restart %{name}.service
%files
%defattr(-,root,root,-)
%dir %{_sysconfdir}/rspamd
%config(noreplace) %{_sysconfdir}/rspamd/*
%{_bindir}/rspamd
%{_bindir}/rspamd_stats
%{_bindir}/rspamc
%{_bindir}/rspamadm
%{_unitdir}/%{name}.service
%{_presetdir}/80-rspamd.preset
%dir %{_libdir}/rspamd
%{_libdir}/rspamd/*
%{_mandir}/man8/%{name}.*
%{_mandir}/man1/rspamc.*
%{_mandir}/man1/rspamadm.*
%dir %{_datadir}/rspamd
%{_datadir}/rspamd/*
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%attr(-, _rspamd, _rspamd) %dir %{_localstatedir}/lib/rspamd
%dir %{_localstatedir}/log/rspamd
|