rspamd-vl.spec 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. %bcond_with systemd
  2. %bcond_with jemalloc
  3. %define rspamd_user _rspamd
  4. %define rspamd_group %{rspamd_user}
  5. %define rspamd_home %{_localstatedir}/lib/rspamd
  6. %define rspamd_logdir %{_localstatedir}/log/rspamd
  7. %define rspamd_confdir %{_sysconfdir}/rspamd
  8. %define rspamd_pluginsdir %{_datadir}/rspamd/plugins
  9. %define rspamd_rulesdir %{_datadir}/rspamd/rules
  10. %define rspamd_wwwdir %{_datadir}/rspamd/www
  11. Summary: Rapid spam filtering system
  12. Name: rspamd
  13. Version: 3.0
  14. Release: 3%{?_dist_release}%{?with_systemd:.systemd}
  15. Group: servers
  16. Vendor: Project Vine
  17. Distribution: Vine Linux
  18. License: ASL 2.0
  19. URL: https://rspamd.com
  20. Source0: https://github.com/rspamd/rspamd/archive/%{version}.tar.gz#/%{name}-%{version}.tar.xz
  21. Patch0: rspamd-3.0-lua54.patch
  22. # to build with glibc-2.34+
  23. # https://github.com/onqtam/doctest/commit/099d5414e97244ec44cf46b14cd176b3a3dc52e3
  24. Patch1: doctest-SIGSTKSZ.patch
  25. Patch2: rspamd-openssl3.patch
  26. BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
  27. BuildRequires: cmake
  28. BuildRequires: file-devel
  29. BuildRequires: glib2-devel
  30. BuildRequires: gmime-devel
  31. %ifarch x86_64
  32. BuildRequires: hyperscan-devel
  33. %endif
  34. %if %{with jemalloc}
  35. BuildRequires: jemalloc-devel
  36. %endif
  37. BuildRequires: libevent-devel
  38. BuildRequires: libicu-devel
  39. BuildRequires: libsodium-devel
  40. BuildRequires: libunwind-devel
  41. BuildRequires: lua-devel
  42. BuildRequires: openssl-devel
  43. BuildRequires: pcre2-devel
  44. BuildRequires: perl
  45. BuildRequires: ragel
  46. BuildRequires: sqlite3-devel
  47. %if %{with systemd}
  48. BuildRequires: systemd
  49. %endif
  50. Requires: logrotate
  51. Requires(pre): shadow-utils
  52. %if %{with systemd}
  53. Requires(pre): systemd
  54. Requires(post): systemd
  55. Requires(preun): systemd
  56. Requires(postun): systemd
  57. %else
  58. Requires(post): chkconfig
  59. Requires(preun): chkconfig, initscripts
  60. Requires(postun): initscripts
  61. %endif
  62. %description
  63. Rspamd is a rapid, modular and lightweight spam filter. It is designed to work
  64. with big amount of mail and can be easily extended with own filters written in
  65. lua.
  66. %debug_package
  67. %prep
  68. %setup
  69. %patch0 -p1
  70. pushd contrib/doctest
  71. %patch1 -p1
  72. popd
  73. %patch2 -p1
  74. %build
  75. %cmake \
  76. -DCMAKE_INSTALL_PREFIX=%{_prefix} \
  77. -DCONFDIR=%{_sysconfdir}/rspamd \
  78. -DINCLUDEDIR=%{_includedir} \
  79. -DLIBDIR=%{_libdir}/rspamd/ \
  80. -DMANDIR=%{_mandir} \
  81. -DSHAREDIR=%{_datadir}/rspamd \
  82. -DDBDIR=%{_localstatedir}/lib/rspamd \
  83. -DRUNDIR=%{_localstatedir}/run/rspamd \
  84. -DLOGDIR=%{_localstatedir}/log/rspamd \
  85. -DEXAMPLESDIR=%{_datadir}/examples/rspamd \
  86. -DNO_SHARED=ON \
  87. -DDEBIAN_BUILD=0 \
  88. -DRSPAMD_GROUP=%{rspamd_group} \
  89. -DRSPAMD_USER=%{rspamd_user} \
  90. %if %{with systemd}
  91. -DWANT_SYSTEMD_UNITS=ON \
  92. -DSYSTEMDDIR=%{_unitdir} \
  93. %else
  94. -DWANT_SYSTEMD_UNITS=OFF \
  95. -DDISABLE_PTHREAD_MUTEX=1 \
  96. %endif
  97. %ifarch x86_64
  98. -DENABLE_HYPERSCAN=ON \
  99. %endif
  100. -DENABLE_LIBUNWIND=ON \
  101. -DENABLE_LUAJIT=OFF \
  102. -DENABLE_PCRE2=ON \
  103. %if %{with jemalloc}
  104. -DENABLE_JEMALLOC=ON \
  105. %endif
  106. %nil
  107. #-DCMAKE_SKIP_INSTALL_RPATH=ON \
  108. %cmake_build
  109. %install
  110. %cmake_install INSTALLDIRS=vendor
  111. pushd ./centos/sources/
  112. %if %{with systemd}
  113. %{__install} -p -D -m 0644 80-rspamd.preset %{buildroot}%{_presetdir}/80-rspamd.preset
  114. %{__install} -p -D -m 0644 %{name}.logrotate.systemd %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
  115. %{__install} -d -p -m 0755 %{buildroot}%{rspamd_logdir}
  116. %else
  117. %{__install} -p -D -m 0755 %{name}.init %{buildroot}%{_initrddir}/%{name}
  118. %{__install} -d -p -m 0755 %{buildroot}%{_localstatedir}/run/rspamd
  119. %{__install} -p -D -m 0644 %{name}.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
  120. %{__install} -d -p -m 0755 %{buildroot}%{rspamd_logdir}
  121. %endif
  122. %{__install} -d -p -m 0755 %{buildroot}%{rspamd_home}
  123. %{__install} -p -D -d -m 0755 %{buildroot}%{_sysconfdir}/%{name}/local.d/
  124. %{__install} -p -D -d -m 0755 %{buildroot}%{_sysconfdir}/%{name}/override.d/
  125. popd
  126. %clean
  127. rm -rf %{buildroot}
  128. %pre
  129. %{_sbindir}/groupadd -r %{rspamd_group} 2>/dev/null || :
  130. %{_sbindir}/useradd -g %{rspamd_group} -c "Rspamd user" -s /bin/false -r -d %{rspamd_home} %{rspamd_user} 2>/dev/null || :
  131. %post
  132. #to allow easy upgrade from 0.8.1
  133. %{__chown} -R %{rspamd_user}:%{rspamd_group} %{rspamd_home}
  134. %if %{with systemd}
  135. #Macro is not used as we want to do this on upgrade
  136. #%systemd_post %{name}.service
  137. systemctl --no-reload preset %{name}.service >/dev/null 2>&1 || :
  138. %{__chown} %{rspamd_user}:%{rspamd_group} %{rspamd_logdir}
  139. %else
  140. /sbin/chkconfig --add %{name}
  141. %endif
  142. %preun
  143. %if %{with systemd}
  144. %systemd_preun %{name}.service
  145. %else
  146. if [ $1 = 0 -o -x /bin/systemctl ]; then
  147. /sbin/service %{name} stop >/dev/null 2>&1
  148. /sbin/chkconfig --del %{name}
  149. fi
  150. %endif
  151. %postun
  152. %if %{with systemd}
  153. %systemd_postun_with_restart %{name}.service
  154. %else
  155. if [ $1 -ge 1 ]; then
  156. /sbin/service %{name} condrestart > /dev/null 2>&1 || :
  157. fi
  158. %endif
  159. %files
  160. %defattr(-,root,root,-)
  161. %license LICENSE.md
  162. %doc AUTHORS.md ChangeLog README.md
  163. %if %{with systemd}
  164. %{_unitdir}/%{name}.service
  165. %{_presetdir}/80-rspamd.preset
  166. %else
  167. %{_initrddir}/%{name}
  168. %dir %{_localstatedir}/run/rspamd
  169. %endif
  170. %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
  171. %dir %{rspamd_logdir}
  172. %{_mandir}/man8/%{name}.*
  173. %{_mandir}/man1/rspamc.*
  174. %{_mandir}/man1/rspamadm.*
  175. %{_bindir}/rspamd
  176. %{_bindir}/rspamd-*
  177. %{_bindir}/rspamd_stats
  178. %{_bindir}/rspamc
  179. %{_bindir}/rspamc-*
  180. %{_bindir}/rspamadm
  181. %{_bindir}/rspamadm-*
  182. %attr(-, %{rspamd_user}, %{rspamd_group}) %dir %{rspamd_home}
  183. %dir %{rspamd_confdir}
  184. %dir %{rspamd_confdir}/modules.d
  185. %dir %{rspamd_confdir}/local.d
  186. %dir %{rspamd_confdir}/maps.d
  187. %dir %{rspamd_confdir}/override.d
  188. %dir %{rspamd_confdir}/scores.d
  189. %dir %{rspamd_wwwdir}
  190. %dir %{_libdir}/rspamd
  191. %config(noreplace) %{rspamd_confdir}/*.conf
  192. %config(noreplace) %{rspamd_confdir}/*.inc
  193. %config(noreplace) %{rspamd_confdir}/maps.d/*
  194. %config(noreplace) %{rspamd_confdir}/modules.d/*
  195. %config(noreplace) %{rspamd_confdir}/scores.d/*
  196. %dir %{rspamd_pluginsdir}
  197. %{rspamd_pluginsdir}/*.lua
  198. %dir %{_datadir}/rspamd/lualib
  199. %dir %{_datadir}/rspamd/lualib/lua_content
  200. %dir %{_datadir}/rspamd/lualib/lua_ffi
  201. %dir %{_datadir}/rspamd/lualib/lua_magic
  202. %dir %{_datadir}/rspamd/lualib/lua_selectors
  203. %dir %{_datadir}/rspamd/lualib/lua_scanners
  204. %dir %{_datadir}/rspamd/lualib/plugins
  205. %dir %{_datadir}/rspamd/lualib/rspamadm
  206. %{_datadir}/rspamd/lualib/*.lua
  207. %{_datadir}/rspamd/lualib/lua_content/*.lua
  208. %{_datadir}/rspamd/lualib/lua_ffi/*.lua
  209. %{_datadir}/rspamd/lualib/lua_magic/*.lua
  210. %{_datadir}/rspamd/lualib/lua_selectors/*.lua
  211. %{_datadir}/rspamd/lualib/lua_scanners/*.lua
  212. %{_datadir}/rspamd/lualib/plugins/*.lua
  213. %{_datadir}/rspamd/lualib/rspamadm/*.lua
  214. %dir %{rspamd_rulesdir}
  215. %dir %{rspamd_rulesdir}/regexp
  216. %{rspamd_rulesdir}/regexp/*.lua
  217. %dir %{rspamd_rulesdir}/controller
  218. %{rspamd_rulesdir}/controller/*.lua
  219. %{rspamd_rulesdir}/*.lua
  220. %{rspamd_wwwdir}/*
  221. %{_libdir}/rspamd/*
  222. %{_datadir}/rspamd/effective_tld_names.dat
  223. %dir %{_datadir}/rspamd/languages
  224. %{_datadir}/rspamd/languages/*
  225. %dir %{_datadir}/rspamd/elastic
  226. %{_datadir}/rspamd/elastic/*
  227. %changelog
  228. * Sat Oct 16 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.0-3
  229. - disabled jemalloc as default: SIGSEGV was occured.
  230. * Sat Oct 16 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.0-2
  231. - added Patch2 to build with openssl-3.0.0.
  232. - built with jemalloc.
  233. * Thu Aug 19 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.0-1
  234. - new upstream release.
  235. - updated Patch0.
  236. - imported Patch1 from upstream of doctest to build with glibc-2.34+.
  237. * Thu Apr 08 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.7-2
  238. - rebuilt with icu69.
  239. * Sat Jan 09 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.7-1
  240. - new upstream release.
  241. * Tue Jan 05 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.6-3
  242. - updated Patch0.
  243. * Thu Oct 08 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.6-2
  244. - updated Patch0.
  245. * Fri Oct 02 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.6-1
  246. - new upstream release.
  247. - added Patch0 to build with lua-5.4.
  248. * Tue Aug 18 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.5-3
  249. - rebuilt with current envirionment.
  250. * Fri Apr 24 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.5-2
  251. - rebuilt with icu-67.
  252. * Thu Apr 02 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.5-1
  253. - new upstream release.
  254. * Thu Mar 19 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.4-2
  255. - rebuilt with libicu66.
  256. * Sat Mar 07 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.4-1
  257. - initial build for Vine Linux.