You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

rspamd.spec 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. %if 0%{getenv:ASAN}
  2. Name: rspamd-asan
  3. Conflicts: rspamd
  4. %else
  5. Name: rspamd
  6. Conflicts: rspamd-asan
  7. %endif
  8. Provides: rspamd
  9. Version: 3.2
  10. Release: 1
  11. Summary: Rapid spam filtering system
  12. Group: System Environment/Daemons
  13. License: Apache-2.0
  14. URL: https://rspamd.com
  15. Source0: https://github.com/rspamd/rspamd/archive/%{version}/rspamd-%{version}.tar.gz
  16. Source1: rspamd.logrotate
  17. Source2: 80-rspamd.preset
  18. BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
  19. %if 0%{?el7}
  20. BuildRequires: cmake3
  21. BuildRequires: devtoolset-10-gcc-c++
  22. %else
  23. BuildRequires: cmake
  24. %if 0%{?el8}
  25. BuildRequires: gcc-toolset-10-gcc-c++
  26. %endif
  27. %endif
  28. BuildRequires: file-devel
  29. BuildRequires: glib2-devel
  30. BuildRequires: lapack-devel
  31. BuildRequires: libicu-devel
  32. BuildRequires: libsodium-devel
  33. BuildRequires: libunwind-devel
  34. %if 0%{getenv:ASAN}
  35. %if 0%{?el7}
  36. BuildRequires: devtoolset-10-libasan-devel
  37. %else
  38. %if 0%{?el8}
  39. BuildRequires: gcc-toolset-10-libasan-devel
  40. %endif
  41. %endif
  42. %endif
  43. %ifarch x86_64 amd64
  44. %if 0%{?el8} || 0%{?fedora} > 10
  45. BuildRequires: hyperscan-devel
  46. %endif
  47. BuildRequires: jemalloc-devel
  48. %endif
  49. %if 0%{getenv:LUAJIT}
  50. BuildRequires: git
  51. %else
  52. BuildRequires: lua-devel
  53. %endif
  54. BuildRequires: openblas-devel
  55. BuildRequires: openssl-devel
  56. BuildRequires: pcre2-devel
  57. BuildRequires: ragel
  58. BuildRequires: sqlite-devel
  59. BuildRequires: systemd
  60. Requires(pre): shadow-utils
  61. Requires(post): systemd
  62. Requires(preun): systemd
  63. Requires(postun): systemd
  64. %description
  65. Rspamd is a rapid, modular and lightweight spam filter. It is designed to work
  66. with big amount of mail and can be easily extended with own filters written in
  67. lua.
  68. %prep
  69. %setup -q -n %{name}-%{version}
  70. %if 0%{getenv:LUAJIT}
  71. rm -fr %{_builddir}/luajit-src || true
  72. rm -fr %{_builddir}/luajit-build || true
  73. git clone -b v2.1 https://luajit.org/git/luajit-2.0.git %{_builddir}/luajit-src
  74. %endif
  75. %build
  76. %if 0%{?el7}
  77. source /opt/rh/devtoolset-10/enable
  78. %else
  79. %if 0%{?el8}
  80. source /opt/rh/gcc-toolset-10/enable
  81. %endif
  82. %endif
  83. %if 0%{getenv:LUAJIT}
  84. pushd %{_builddir}/luajit-src && make clean && make %{?_smp_mflags} CC="gcc -fPIC" PREFIX=%{_builddir}/luajit-build && make install PREFIX=%{_builddir}/luajit-build ; popd
  85. rm -f %{_builddir}/luajit-build/lib/*.so || true
  86. %endif
  87. %if 0%{?el7}
  88. %{cmake3} \
  89. %else
  90. %{cmake} \
  91. %endif
  92. -B . \
  93. %if 0%{getenv:ASAN}
  94. -DCMAKE_BUILD_TYPE=Debug \
  95. -DSANITIZE=address \
  96. %else
  97. -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  98. -DENABLE_LTO=ON \
  99. %endif
  100. -DCMAKE_C_FLAGS_RELEASE="%{optflags}" \
  101. -DCMAKE_CXX_FLAGS_RELEASE="%{optflags}" \
  102. %if 0%{?fedora} >= 36
  103. -DLINKER_NAME=/usr/bin/ld.bfd \
  104. %endif
  105. %if 0%{?el8}
  106. -DLINKER_NAME=ld.bfd \
  107. %endif
  108. -DCMAKE_INSTALL_PREFIX=%{_prefix} \
  109. -DCONFDIR=%{_sysconfdir}/rspamd \
  110. -DMANDIR=%{_mandir} \
  111. -DDBDIR=%{_localstatedir}/lib/rspamd \
  112. -DRUNDIR=%{_localstatedir}/run/rspamd \
  113. -DLOGDIR=%{_localstatedir}/log/rspamd \
  114. -DEXAMPLESDIR=%{_datadir}/examples/rspamd \
  115. -DSHAREDIR=%{_datadir}/rspamd \
  116. -DLIBDIR=%{_libdir}/rspamd/ \
  117. -DINCLUDEDIR=%{_includedir} \
  118. -DRSPAMD_GROUP=_rspamd \
  119. -DRSPAMD_USER=_rspamd \
  120. -DSYSTEMDDIR=%{_unitdir} \
  121. -DWANT_SYSTEMD_UNITS=ON \
  122. -DNO_SHARED=ON \
  123. -DDEBIAN_BUILD=1 \
  124. -DENABLE_LIBUNWIND=ON \
  125. %ifarch x86_64 amd64 arm64 aarch64
  126. -DENABLE_HYPERSCAN=ON \
  127. %endif
  128. %ifarch arm64 aarch64
  129. -DHYPERSCAN_ROOT_DIR=/vectorscan \
  130. %endif
  131. %ifarch x86_64 amd64
  132. %if 0%{?el7}
  133. -DHYPERSCAN_ROOT_DIR=/vectorscan \
  134. %endif
  135. %endif
  136. %ifarch x86_64 amd64
  137. -DENABLE_JEMALLOC=ON \
  138. %endif
  139. %if 0%{getenv:LUAJIT}
  140. -DENABLE_LUAJIT=ON \
  141. -DLUA_ROOT=%{_builddir}/luajit-build \
  142. %else
  143. -DENABLE_LUAJIT=OFF \
  144. %endif
  145. -DENABLE_BLAS=ON
  146. make %{?_smp_mflags}
  147. %install
  148. %make_install
  149. %{__install} -p -D -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/rspamd
  150. %{__install} -p -D -m 0644 %{SOURCE2} %{buildroot}%{_presetdir}/80-rspamd.preset
  151. %{__install} -d -p -m 0755 %{buildroot}%{_localstatedir}/log/rspamd
  152. %{__install} -d -p -m 0755 %{buildroot}%{_localstatedir}/lib/rspamd
  153. %{__install} -p -D -d -m 0755 %{buildroot}%{_sysconfdir}/rspamd/local.d/
  154. %{__install} -p -D -d -m 0755 %{buildroot}%{_sysconfdir}/rspamd/override.d/
  155. %clean
  156. rm -rf %{buildroot}
  157. %pre
  158. %{_sbindir}/groupadd -r _rspamd 2>/dev/null || :
  159. %{_sbindir}/useradd -g _rspamd -c "Rspamd user" -s /bin/false -r -d %{_localstatedir}/lib/rspamd _rspamd 2>/dev/null || :
  160. %post
  161. %{__chown} -R _rspamd:_rspamd %{_localstatedir}/lib/rspamd
  162. %{__chown} _rspamd:_rspamd %{_localstatedir}/log/rspamd
  163. systemctl --no-reload preset rspamd.service >/dev/null 2>&1 || :
  164. %preun
  165. %systemd_preun rspamd.service
  166. %postun
  167. %systemd_postun_with_restart rspamd.service
  168. %files
  169. %defattr(-,root,root,-)
  170. %dir %{_sysconfdir}/rspamd
  171. %config(noreplace) %{_sysconfdir}/rspamd/*
  172. %{_bindir}/rspamd
  173. %{_bindir}/rspamd_stats
  174. %{_bindir}/rspamc
  175. %{_bindir}/rspamadm
  176. %{_unitdir}/rspamd.service
  177. %{_presetdir}/80-rspamd.preset
  178. %dir %{_libdir}/rspamd
  179. %{_libdir}/rspamd/*
  180. %{_mandir}/man8/rspamd.*
  181. %{_mandir}/man1/rspamc.*
  182. %{_mandir}/man1/rspamadm.*
  183. %dir %{_datadir}/rspamd
  184. %{_datadir}/rspamd/*
  185. %config(noreplace) %{_sysconfdir}/logrotate.d/rspamd
  186. %attr(-, _rspamd, _rspamd) %dir %{_localstatedir}/lib/rspamd
  187. %dir %{_localstatedir}/log/rspamd