rspamd-vl.spec 7.7 KB

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