diff options
author | Petr Vaněk <arkamar@atlas.cz> | 2021-08-21 22:50:40 +0200 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2021-08-22 03:49:01 +0100 |
commit | 9545e21cc8b4178834e21537b9ff74f9c1032412 (patch) | |
tree | 0bb475d243a3c574a8a9c22e7120ad8ceb2aaf48 /mail-filter/rspamd | |
parent | sci-geosciences/gpsd: fix build with USE=-python (diff) | |
download | gentoo-9545e21cc8b4178834e21537b9ff74f9c1032412.tar.gz gentoo-9545e21cc8b4178834e21537b9ff74f9c1032412.tar.bz2 gentoo-9545e21cc8b4178834e21537b9ff74f9c1032412.zip |
mail-filter/rspamd: add 3.0
- Use new -DSYSTEM_ZSTD=ON instead of unbundle patch
- Apply patch for -DSYSTEM_FMT=ON, it is already merged in upstream
- Make the src_test work
Closes: https://bugs.gentoo.org/809308
Signed-off-by: Petr Vaněk <arkamar@atlas.cz>
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'mail-filter/rspamd')
-rw-r--r-- | mail-filter/rspamd/Manifest | 1 | ||||
-rw-r--r-- | mail-filter/rspamd/files/rspamd-3.0-cmake-lua-version.patch | 64 | ||||
-rw-r--r-- | mail-filter/rspamd/files/rspamd-3.0-system-libfmt.patch | 48 | ||||
-rw-r--r-- | mail-filter/rspamd/rspamd-3.0.ebuild | 123 |
4 files changed, 236 insertions, 0 deletions
diff --git a/mail-filter/rspamd/Manifest b/mail-filter/rspamd/Manifest index df4f86e665d9..48c11b72f36d 100644 --- a/mail-filter/rspamd/Manifest +++ b/mail-filter/rspamd/Manifest @@ -1,2 +1,3 @@ DIST rspamd-2.6.tar.gz 5079444 BLAKE2B acb9d9471d0bb457da33b4d23e3c75ef87ea26a47e6c731bfd5fbbfe28567244e2bc72fd25ca3408db0928dab4e4ab66596e38cf3eff7cb9690eec59d3b62372 SHA512 79e4c1aa763aef753c8d7b2a941ed92b384e96c25e6d1b3bd1321c5acc0ecb934d033a3bf19cb94c89809fd92edec25192cffe97de9e5251681e1a71216b734a DIST rspamd-2.7.tar.gz 5126227 BLAKE2B 70f57dba6ac9abe93d735d42e84bd17a1797035322029577a8e4376409bcee5345d4624925d3dd071bddce038858ebfdce8ee4f87f81b1fc8b1f71ad14e85930 SHA512 8779771baf85ef6ca1d7d2180429072ab1547ab834b073ee9222dcc6494efdd0a23f5e7ac52a777c23fd89296769f5b6f182593e714097c6f11ca7c9165e4ba7 +DIST rspamd-3.0.tar.gz 5535659 BLAKE2B 605ac59b947b49efb026e04d153df5fc0d56c65712def3f2c54a949db32b8534e634d172a1899cc08e98e0a9da839fc00f0f569dc8c52a743f38bd71b8abaeaa SHA512 1ea6f9ffe58b7f280dbd31e39db6412ebeddda634ca8a669fa5bff2951d17123a5d4a09ec0f366c6b0c0b585f868e646fd49e4d45bd451408675b927ec2557c4 diff --git a/mail-filter/rspamd/files/rspamd-3.0-cmake-lua-version.patch b/mail-filter/rspamd/files/rspamd-3.0-cmake-lua-version.patch new file mode 100644 index 000000000000..55665b887c3b --- /dev/null +++ b/mail-filter/rspamd/files/rspamd-3.0-cmake-lua-version.patch @@ -0,0 +1,64 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b53793008..5d092d654 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -147,55 +147,8 @@ IF(ENABLE_LUAJIT MATCHES "ON") + ELSE(ENABLE_LUAJIT MATCHES "ON") + + ProcessPackage(LIBLUA LIBRARY "lua" +- "lua-5.3" +- LIB_SUFFIXES "lua5.3" +- INCLUDE lua.h INCLUDE_SUFFIXES +- "include/lua-5.3" +- "include/lua5.3" +- "include/lua53" +- "include/lua" + ROOT ${LUA_ROOT} +- MODULES lua53 +- OPTIONAL) +- +- IF (NOT WITH_LIBLUA) +- ProcessPackage(LIBLUA LIBRARY "lua" +- "lua-5.4" +- LIB_SUFFIXES "lua5.4" +- INCLUDE lua.h INCLUDE_SUFFIXES +- "include/lua-5.4" +- "include/lua5.4" +- "include/lua54" +- "include/lua" +- ROOT ${LUA_ROOT} +- MODULES lua54 +- OPTIONAL) +- IF (NOT WITH_LIBLUA) +- ProcessPackage(LIBLUA LIBRARY "lua" +- "lua-5.2" +- LIB_SUFFIXES "lua5.2" +- INCLUDE lua.h INCLUDE_SUFFIXES +- "include/lua-5.2" +- "include/lua5.2" +- "include/lua52" +- "include/lua" +- ROOT ${LUA_ROOT} +- MODULES lua52 +- OPTIONAL) +- +- IF (NOT WITH_LIBLUA) +- ProcessPackage(LIBLUA LIBRARY "lua" +- "lua-5.1" +- INCLUDE lua.h INCLUDE_SUFFIXES +- "include/lua-5.1" +- "include/lua5.1" +- "include/lua51" +- "include/lua" +- ROOT ${LUA_ROOT} +- MODULES lua51) +- ENDIF() +- ENDIF() +- ENDIF() ++ MODULES lua) + ENDIF(ENABLE_LUAJIT MATCHES "ON") + + IF(ENABLE_JEMALLOC MATCHES "ON" AND NOT SANITIZE) +-- +2.26.3 + diff --git a/mail-filter/rspamd/files/rspamd-3.0-system-libfmt.patch b/mail-filter/rspamd/files/rspamd-3.0-system-libfmt.patch new file mode 100644 index 000000000000..a6439b465e92 --- /dev/null +++ b/mail-filter/rspamd/files/rspamd-3.0-system-libfmt.patch @@ -0,0 +1,48 @@ +From 309bb213cffb23e6bee98157b53cf5db31f97ef9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20Van=C4=9Bk?= <arkamar@atlas.cz> +Date: Sat, 21 Aug 2021 11:24:35 +0200 +Subject: [PATCH] Add SYSTEM_FMT cmake option + +This gives packagers option to use system version of fmt rather than +bundled one. It is disabled by default. +--- + +Merged-to-upstream: https://github.com/rspamd/rspamd/pull/3855 + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2c38758f3..fc4175677 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -58,6 +58,7 @@ OPTION(ENABLE_LIBUNWIND "Use libunwind to print crash traces [default: OFF]" + OPTION(ENABLE_LUA_TRACE "Trace all Lua C API invocations [default: OFF]" OFF) + OPTION(ENABLE_LUA_REPL "Enables Lua repl (requires C++11 compiler) [default: ON]" ON) + OPTION(SYSTEM_ZSTD "Use system zstd instead of bundled one [default: OFF]" OFF) ++OPTION(SYSTEM_FMT "Use system fmt instead of bundled one [defalut: OFF]" OFF) + + ############################# INCLUDE SECTION ############################################# + +@@ -117,7 +118,6 @@ INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/" + "${CMAKE_SOURCE_DIR}/contrib/lc-btrie" + "${CMAKE_SOURCE_DIR}/contrib/lua-lpeg" + "${CMAKE_SOURCE_DIR}/contrib/frozen/include" +- "${CMAKE_SOURCE_DIR}/contrib/fmt/include" + "${CMAKE_SOURCE_DIR}/contrib/doctest" + "${CMAKE_SOURCE_DIR}/contrib/fu2/include" + "${CMAKE_BINARY_DIR}/src" #Stored in the binary dir +@@ -650,7 +650,12 @@ ADD_SUBDIRECTORY(contrib/libev) + ADD_SUBDIRECTORY(contrib/kann) + ADD_SUBDIRECTORY(contrib/fastutf8) + ADD_SUBDIRECTORY(contrib/google-ced) +-ADD_SUBDIRECTORY(contrib/fmt) ++IF(SYSTEM_FMT MATCHES "OFF") ++ ADD_SUBDIRECTORY(contrib/fmt) ++ INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/contrib/fmt/include") ++ELSE() ++ find_package(fmt) ++ENDIF() + ADD_SUBDIRECTORY(contrib/doctest) + + IF (NOT WITH_LUAJIT) +-- +2.31.1 + diff --git a/mail-filter/rspamd/rspamd-3.0.ebuild b/mail-filter/rspamd/rspamd-3.0.ebuild new file mode 100644 index 000000000000..1a472d6db57b --- /dev/null +++ b/mail-filter/rspamd/rspamd-3.0.ebuild @@ -0,0 +1,123 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +LUA_COMPAT=( lua5-{1..3} luajit ) + +inherit cmake lua-single pax-utils systemd tmpfiles + +if [[ ${PV} == *9999 ]] ; then + EGIT_REPO_URI="https://github.com/rspamd/rspamd.git" + inherit git-r3 +else + SRC_URI="https://github.com/rspamd/rspamd/archive/${PV}.tar.gz -> ${P}.tar.gz" + KEYWORDS="~amd64 ~x86" +fi + +DESCRIPTION="Rapid spam filtering system" +HOMEPAGE="https://rspamd.com https://github.com/rspamd/rspamd" +LICENSE="Apache-2.0 Boost-1.0 BSD BSD-1 BSD-2 CC0-1.0 LGPL-3 MIT public-domain unicode ZLIB" +SLOT="0" +IUSE="blas cpu_flags_x86_ssse3 jemalloc +jit pcre2 test" +RESTRICT="!test? ( test )" + +# A part of tests use ffi luajit extension +REQUIRED_USE="${LUA_REQUIRED_USE} + jit? ( lua_single_target_luajit ) + test? ( lua_single_target_luajit )" + +RDEPEND="${LUA_DEPS} + $(lua_gen_cond_dep ' + dev-lua/LuaBitOp[${LUA_USEDEP}] + ' lua5-{1,2}) + acct-group/rspamd + acct-user/rspamd + app-arch/zstd:= + dev-db/sqlite:3 + dev-libs/glib:2 + dev-libs/icu:= + dev-libs/libev + dev-libs/libfmt:= + dev-libs/libsodium:= + dev-libs/snowball-stemmer + sys-apps/file + blas? ( + virtual/blas + virtual/lapack + ) + cpu_flags_x86_ssse3? ( dev-libs/hyperscan ) + jemalloc? ( dev-libs/jemalloc:= ) + dev-libs/openssl:0=[-bindist(-)] + pcre2? ( dev-libs/libpcre2:=[jit=] ) + !pcre2? ( dev-libs/libpcre[jit=] )" +DEPEND="${RDEPEND}" +BDEPEND=" + dev-util/ragel + virtual/pkgconfig +" + +PATCHES=( + "${FILESDIR}/${P}-cmake-lua-version.patch" + "${FILESDIR}/${P}-system-libfmt.patch" + "${FILESDIR}/${PN}-2.6-unbundle-lua.patch" + "${FILESDIR}/${PN}-2.5-unbundle-snowball.patch" +) + +src_prepare() { + cmake_src_prepare + + rm -vrf contrib/{fmt,lua-bit,snowball,zstd} || die + + sed -i -e 's/User=_rspamd/User=rspamd/g' \ + rspamd.service \ + || die +} + +src_configure() { + local mycmakeargs=( + -DCONFDIR=/etc/rspamd + -DRUNDIR=/var/run/rspamd + -DDBDIR=/var/lib/rspamd + -DLOGDIR=/var/log/rspamd + + -DSYSTEM_FMT=ON + -DSYSTEM_ZSTD=ON + + -DENABLE_BLAS=$(usex blas ON OFF) + -DENABLE_HYPERSCAN=$(usex cpu_flags_x86_ssse3 ON OFF) + -DENABLE_JEMALLOC=$(usex jemalloc ON OFF) + -DENABLE_LUAJIT=$(usex lua_single_target_luajit ON OFF) + -DENABLE_PCRE2=$(usex pcre2 ON OFF) + ) + cmake_src_configure +} + +src_test() { + cmake_build run-test +} + +src_install() { + cmake_src_install + + newconfd "${FILESDIR}"/rspamd.conf rspamd + newinitd "${FILESDIR}/rspamd-r7.init" rspamd + systemd_newunit rspamd.service rspamd.service + + newtmpfiles "${FILESDIR}"/${PN}.tmpfile ${PN}.conf + + # Remove mprotect for JIT support + if use lua_single_target_luajit; then + pax-mark m "${ED}"/usr/bin/rspamd-* "${ED}"/usr/bin/rspamadm-* + fi + + insinto /etc/logrotate.d + newins "${FILESDIR}"/rspamd-r1.logrotate rspamd + + diropts -o rspamd -g rspamd + keepdir /var/{lib,log}/rspamd +} + +pkg_postinst() { + tmpfiles_process "${PN}.conf" +} |