summaryrefslogtreecommitdiffstats
path: root/rpm
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2023-02-08 12:22:57 +0000
committerVsevolod Stakhov <vsevolod@rspamd.com>2023-02-08 12:22:57 +0000
commit553041053ed6e524f477151a308f3163f83f3c3b (patch)
treecb515f2a1330873741da5d74914e2517d2d57fed /rpm
parent2207724a6c94a36fe597fc8ec7e0f197b90c3ec0 (diff)
downloadrspamd-553041053ed6e524f477151a308f3163f83f3c3b.tar.gz
rspamd-553041053ed6e524f477151a308f3163f83f3c3b.zip
[Minor] Directory name is bogus
Diffstat (limited to 'rpm')
-rw-r--r--rpm/rspamd.spec138
-rw-r--r--rpm/sources/80-rspamd.preset1
-rw-r--r--rpm/sources/rspamd.logrotate11
3 files changed, 150 insertions, 0 deletions
diff --git a/rpm/rspamd.spec b/rpm/rspamd.spec
new file mode 100644
index 000000000..85aab6018
--- /dev/null
+++ b/rpm/rspamd.spec
@@ -0,0 +1,138 @@
+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: hyperscan-devel
+BuildRequires: jemalloc-devel
+BuildRequires: lapack-devel
+BuildRequires: libevent-devel
+BuildRequires: libicu-devel
+BuildRequires: libsodium-devel
+BuildRequires: libunwind-devel
+BuildRequires: luajit-devel
+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
+
+%build
+%if 0%{?el7}
+%{__cmake3} \
+%else
+%{__cmake} \
+%endif
+ -DCMAKE_BUILD_TYPE="Release" \
+ -DCMAKE_C_FLAGS_RELEASE="%{optflags}" \
+ -DCMAKE_CXX_FLAGS_RELEASE="%{optflags}" \
+%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 \
+ -DENABLE_HYPERSCAN=ON \
+ -DENABLE_JEMALLOC=ON \
+ -DENABLE_LUAJIT=ON \
+ -DENABLE_BLAS=ON
+
+%{__make} %{?jobs:-j%jobs}
+
+%install
+%{__make} install DESTDIR=%{buildroot} INSTALLDIRS=vendor
+%{__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
diff --git a/rpm/sources/80-rspamd.preset b/rpm/sources/80-rspamd.preset
new file mode 100644
index 000000000..0fcf15985
--- /dev/null
+++ b/rpm/sources/80-rspamd.preset
@@ -0,0 +1 @@
+enable rspamd.service
diff --git a/rpm/sources/rspamd.logrotate b/rpm/sources/rspamd.logrotate
new file mode 100644
index 000000000..ea1b02d7c
--- /dev/null
+++ b/rpm/sources/rspamd.logrotate
@@ -0,0 +1,11 @@
+/var/log/rspamd/*log {
+ daily
+ rotate 10
+ missingok
+ notifempty
+ compress
+ sharedscripts
+ postrotate
+ systemctl --signal=USR1 --kill-who=main kill rspamd.service 2>/dev/null || :
+ endscript
+}