rspamd-vl.spec 8.1 KB

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