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.8KB

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