From 8bed1d65b0196b988f2d5b6dfe468e3d8b729837 Mon Sep 17 00:00:00 2001 From: Matej Focko Date: Sun, 13 Aug 2023 18:20:17 +0200 Subject: [PATCH] rspamd: add 3.6 release Signed-off-by: Matej Focko --- rspamd/80-rspamd.preset | 1 + rspamd/rspamd.logrotate | 11 ++ rspamd/rspamd.spec | 221 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 233 insertions(+) create mode 100644 rspamd/80-rspamd.preset create mode 100644 rspamd/rspamd.logrotate create mode 100644 rspamd/rspamd.spec diff --git a/rspamd/80-rspamd.preset b/rspamd/80-rspamd.preset new file mode 100644 index 0000000..0fcf159 --- /dev/null +++ b/rspamd/80-rspamd.preset @@ -0,0 +1 @@ +enable rspamd.service diff --git a/rspamd/rspamd.logrotate b/rspamd/rspamd.logrotate new file mode 100644 index 0000000..ea1b02d --- /dev/null +++ b/rspamd/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 +} diff --git a/rspamd/rspamd.spec b/rspamd/rspamd.spec new file mode 100644 index 0000000..dcec04f --- /dev/null +++ b/rspamd/rspamd.spec @@ -0,0 +1,221 @@ +%if 0%{getenv:ASAN} +Name: rspamd-asan +Conflicts: rspamd +%else +Name: rspamd +Conflicts: rspamd-asan +%endif +Provides: rspamd +Version: 3.6 +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}/rspamd-%{version}.tar.gz +Source1: rspamd.logrotate +Source2: 80-rspamd.preset +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release} +%if 0%{?el7} +BuildRequires: cmake3 +BuildRequires: devtoolset-10-gcc-c++ +%else +BuildRequires: cmake +%if 0%{?el8} +BuildRequires: gcc-toolset-10-gcc-c++ +%endif +%if 0%{?el9} +BuildRequires: gcc-toolset-12-gcc-c++ +%endif +%endif +BuildRequires: file-devel +BuildRequires: glib2-devel +BuildRequires: lapack-devel +BuildRequires: libicu-devel +BuildRequires: libsodium-devel +BuildRequires: libunwind-devel +%if 0%{getenv:ASAN} +%if 0%{?el7} +BuildRequires: devtoolset-10-libasan-devel +%else +%if 0%{?el8} +BuildRequires: gcc-toolset-10-libasan-devel +%endif +%if 0%{?el9} +BuildRequires: gcc-toolset-12-libasan-devel +%endif +%endif +%endif + +%ifarch x86_64 amd64 +%if 0%{?el8} || 0%{?fedora} > 10 +BuildRequires: hyperscan-devel +%endif +BuildRequires: jemalloc-devel +%endif + +%if 0%{getenv:LUAJIT} +BuildRequires: git +%else +BuildRequires: lua-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 %{name}-%{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%{?el7} +source /opt/rh/devtoolset-10/enable +%else +%if 0%{?el8} +source /opt/rh/gcc-toolset-10/enable +%endif +%if 0%{?el9} +source /opt/rh/gcc-toolset-12/enable +%endif +%endif + +%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 . \ +%if 0%{getenv:ASAN} + -DCMAKE_BUILD_TYPE=Debug \ + -DSANITIZE=address \ +%else + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DENABLE_LTO=ON \ +%endif + -DCMAKE_C_FLAGS_RELEASE="%{optflags}" \ + -DCMAKE_CXX_FLAGS_RELEASE="%{optflags}" \ +%if 0%{?fedora} >= 36 + -DLINKER_NAME=/usr/bin/ld.bfd \ +%endif +%if 0%{?el8} + -DLINKER_NAME=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 arm64 aarch64 + -DHYPERSCAN_ROOT_DIR=/vectorscan \ +%endif +%ifarch x86_64 amd64 +%if 0%{?el7} + -DHYPERSCAN_ROOT_DIR=/vectorscan \ +%endif +%endif +%ifarch x86_64 amd64 + -DENABLE_JEMALLOC=ON \ +%endif +%if 0%{getenv:LUAJIT} + -DENABLE_LUAJIT=ON \ + -DLUA_ROOT=%{_builddir}/luajit-build \ +%else + -DENABLE_LUAJIT=OFF \ +%endif + -DENABLE_BLAS=ON +make %{?_smp_mflags} + +%install +%make_install +%{__install} -p -D -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/rspamd +%{__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}/rspamd/local.d/ +%{__install} -p -D -d -m 0755 %{buildroot}%{_sysconfdir}/rspamd/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 +%if 0%{?el7} +# We need to clean old hyperscan files on upgrade: see https://github.com/rspamd/rspamd/issues/4441 +rm -f %{_localstatedir}/lib/rspamd/*.hs* +%endif +systemctl --no-reload preset rspamd.service >/dev/null 2>&1 || : + +%preun +%systemd_preun rspamd.service + +%postun +%systemd_postun_with_restart rspamd.service + +%files +%defattr(-,root,root,-) + +%dir %{_sysconfdir}/rspamd +%config(noreplace) %{_sysconfdir}/rspamd/* + +%{_bindir}/rspamd +%{_bindir}/rspamd_stats +%{_bindir}/rspamc +%{_bindir}/rspamadm + +%{_unitdir}/rspamd.service +%{_presetdir}/80-rspamd.preset + +%dir %{_libdir}/rspamd +%{_libdir}/rspamd/* + +%{_mandir}/man8/rspamd.* +%{_mandir}/man1/rspamc.* +%{_mandir}/man1/rspamadm.* + +%dir %{_datadir}/rspamd +%{_datadir}/rspamd/* + +%config(noreplace) %{_sysconfdir}/logrotate.d/rspamd + +%attr(-, _rspamd, _rspamd) %dir %{_localstatedir}/lib/rspamd +%dir %{_localstatedir}/log/rspamd