network/rspamd: Updated for version 3.4.

Signed-off-by: Andrew Clemons <andrew.clemons@gmail.com>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Ebben Aries 2023-01-02 17:48:35 -07:00 committed by Willy Sudiarto Raharjo
parent e2d91b3112
commit 9b2a5aa68e
No known key found for this signature in database
GPG Key ID: 3F617144D7238786
4 changed files with 12 additions and 124 deletions

View File

@ -1,110 +0,0 @@
From: Vsevolod Stakhov <vsevolod@highsecure.ru>
From: Duncan Bellamy <dunk@denkimushi.com>
Subject: [Fix] Restrict x86_64 assembly to x86_64
Origin: upstream, https://github.com/rspamd/rspamd/commit/f6dc828c3d8c015779eea7fb662198c6d58def14
Origin: upstream, https://github.com/rspamd/rspamd/commit/eee7acb309bae98e17c19b53bbd72cc9b798c281
Origin: upstream, https://github.com/rspamd/rspamd/commit/9766a457eb860b2eeb5e3e37ff86e82e89fe8c8d
---
src/libcryptobox/CMakeLists.txt | 19 +++++++++++++------
src/libcryptobox/chacha20/chacha.c | 12 ++++++------
src/libcryptobox/cryptobox.c | 4 ++--
3 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/src/libcryptobox/CMakeLists.txt b/src/libcryptobox/CMakeLists.txt
index 272701b..a7f8665 100644
--- a/src/libcryptobox/CMakeLists.txt
+++ b/src/libcryptobox/CMakeLists.txt
@@ -5,17 +5,24 @@ SET(BASE64SRC ${CMAKE_CURRENT_SOURCE_DIR}/base64/ref.c
${CMAKE_CURRENT_SOURCE_DIR}/base64/base64.c)
IF(HAVE_AVX2)
- SET(CHACHASRC ${CHACHASRC} ${CMAKE_CURRENT_SOURCE_DIR}/chacha20/avx2.S)
+ IF ("${ARCH}" STREQUAL "x86_64")
+ SET(CHACHASRC ${CHACHASRC} ${CMAKE_CURRENT_SOURCE_DIR}/chacha20/avx2.S)
+ MESSAGE(STATUS "Cryptobox: AVX2 support is added (chacha20)")
+ ENDIF()
SET(BASE64SRC ${BASE64SRC} ${CMAKE_CURRENT_SOURCE_DIR}/base64/avx2.c)
- MESSAGE(STATUS "Cryptobox: AVX2 support is added (chacha20, avx2)")
+ MESSAGE(STATUS "Cryptobox: AVX2 support is added (base64)")
ENDIF(HAVE_AVX2)
IF(HAVE_AVX)
- SET(CHACHASRC ${CHACHASRC} ${CMAKE_CURRENT_SOURCE_DIR}/chacha20/avx.S)
- MESSAGE(STATUS "Cryptobox: AVX support is added (chacha20)")
+ IF ("${ARCH}" STREQUAL "x86_64")
+ SET(CHACHASRC ${CHACHASRC} ${CMAKE_CURRENT_SOURCE_DIR}/chacha20/avx.S)
+ MESSAGE(STATUS "Cryptobox: AVX support is added (chacha20)")
+ ENDIF()
ENDIF(HAVE_AVX)
IF(HAVE_SSE2)
- SET(CHACHASRC ${CHACHASRC} ${CMAKE_CURRENT_SOURCE_DIR}/chacha20/sse2.S)
- MESSAGE(STATUS "Cryptobox: SSE2 support is added (chacha20)")
+ IF ("${ARCH}" STREQUAL "x86_64")
+ SET(CHACHASRC ${CHACHASRC} ${CMAKE_CURRENT_SOURCE_DIR}/chacha20/sse2.S)
+ MESSAGE(STATUS "Cryptobox: SSE2 support is added (chacha20)")
+ ENDIF()
ENDIF(HAVE_SSE2)
IF(HAVE_SSE42)
SET(BASE64SRC ${BASE64SRC} ${CMAKE_CURRENT_SOURCE_DIR}/base64/sse42.c)
diff --git a/src/libcryptobox/chacha20/chacha.c b/src/libcryptobox/chacha20/chacha.c
index e4543d3..653c614 100644
--- a/src/libcryptobox/chacha20/chacha.c
+++ b/src/libcryptobox/chacha20/chacha.c
@@ -52,15 +52,15 @@ typedef struct chacha_impl_t {
#define CHACHA_IMPL(cpuflags, desc, ext) \
{(cpuflags), desc, chacha_##ext, xchacha_##ext, chacha_blocks_##ext, hchacha_##ext}
-#if defined(HAVE_AVX2)
+#if defined(HAVE_AVX2) && defined(__x86_64__)
CHACHA_DECLARE(avx2)
#define CHACHA_AVX2 CHACHA_IMPL(CPUID_AVX2, "avx2", avx2)
#endif
-#if defined(HAVE_AVX)
+#if defined(HAVE_AVX) && defined(__x86_64__)
CHACHA_DECLARE(avx)
#define CHACHA_AVX CHACHA_IMPL(CPUID_AVX, "avx", avx)
#endif
-#if defined(HAVE_SSE2)
+#if defined(HAVE_SSE2) && defined(__x86_64__)
CHACHA_DECLARE(sse2)
#define CHACHA_SSE2 CHACHA_IMPL(CPUID_SSE2, "sse2", sse2)
#endif
@@ -70,13 +70,13 @@ CHACHA_DECLARE(ref)
static const chacha_impl_t chacha_list[] = {
CHACHA_GENERIC,
-#if defined(CHACHA_AVX2)
+#if defined(CHACHA_AVX2) && defined(__x86_64__)
CHACHA_AVX2,
#endif
-#if defined(CHACHA_AVX)
+#if defined(CHACHA_AVX) && defined(__x86_64__)
CHACHA_AVX,
#endif
-#if defined(CHACHA_SSE2)
+#if defined(CHACHA_SSE2) && defined(__x86_64__)
CHACHA_SSE2
#endif
};
diff --git a/src/libcryptobox/cryptobox.c b/src/libcryptobox/cryptobox.c
index 3139bb1..f34cd13 100644
--- a/src/libcryptobox/cryptobox.c
+++ b/src/libcryptobox/cryptobox.c
@@ -118,7 +118,7 @@ rspamd_cryptobox_test_instr (gint instr)
}
switch (instr) {
-#ifdef HAVE_SSE2
+#if defined HAVE_SSE2 && defined (__x86_64__)
case CPUID_SSE2:
__asm__ volatile ("psubb %xmm0, %xmm0");
break;
@@ -146,7 +146,7 @@ rspamd_cryptobox_test_instr (gint instr)
__asm__ volatile ("pcmpeqq %xmm0, %xmm0");
break;
#endif
-#ifdef HAVE_SSE42
+#if defined HAVE_SSE42 && defined(__x86_64__)
case CPUID_SSE42:
__asm__ volatile ("pushq %rax\n"
"xorq %rax, %rax\n"

View File

@ -1,6 +1,6 @@
--- cmake/Toolset.cmake 2020-09-23 18:31:57.275661294 -0600 --- cmake/Toolset.cmake 2023-01-02 17:31:12.369073592 -0700
+++ cmake/Toolset.cmake 2020-09-23 18:32:34.812659218 -0600 +++ cmake/Toolset.cmake 2023-01-02 17:32:15.127507305 -0700
@@ -45,10 +45,10 @@ @@ -56,10 +56,10 @@
find_program(GOLD_PATH NAMES "ld.gold" "gold") find_program(GOLD_PATH NAMES "ld.gold" "gold")
if(NOT LINKER_NAME) if(NOT LINKER_NAME)

View File

@ -2,7 +2,7 @@
# Slackware build script for Rspamd # Slackware build script for Rspamd
# Copyright 2018-2021 Ebben Aries <slackbuilds@dscp.org> # Copyright 2018-2023 Ebben Aries <slackbuilds@dscp.org>
# All rights reserved. # All rights reserved.
# #
# Redistribution and use of this script, with or without modification, is # Redistribution and use of this script, with or without modification, is
@ -27,7 +27,7 @@
cd $(dirname $0) ; CWD=$(pwd) cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=rspamd PRGNAM=rspamd
VERSION=${VERSION:-3.1} VERSION=${VERSION:-3.4}
BUILD=${BUILD:-1} BUILD=${BUILD:-1}
TAG=${TAG:-_SBo} TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz} PKGTYPE=${PKGTYPE:-tgz}
@ -95,11 +95,8 @@ find -L . \
# https://github.com/rspamd/rspamd/issues/3168#issuecomment-583849873 # https://github.com/rspamd/rspamd/issues/3168#issuecomment-583849873
patch -p0 < $CWD/Toolset.cmake.patch patch -p0 < $CWD/Toolset.cmake.patch
# 20220320 bkw: patch from Debian, allows building on 32-bit. mkdir -p rspamd.build
patch -p1 < $CWD/0007-fix-i386-compilation.patch cd rspamd.build
mkdir -p build
cd build
cmake \ cmake \
-DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \ -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
-DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_PREFIX=/usr \
@ -109,10 +106,11 @@ cd build
-DENABLE_STATIC=OFF \ -DENABLE_STATIC=OFF \
-DENABLE_HYPERSCAN=ON \ -DENABLE_HYPERSCAN=ON \
-DENABLE_JEMALLOC=ON \ -DENABLE_JEMALLOC=ON \
-DENABLE_LUAJIT=ON \
-DENABLE_OPTIMIZATION=ON \ -DENABLE_OPTIMIZATION=ON \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
.. ..
make VERBOSE=1 make
make install/strip DESTDIR=$PKG make install/strip DESTDIR=$PKG
cd .. cd ..
gzip $PKG/usr/man/man*/* gzip $PKG/usr/man/man*/*

View File

@ -1,8 +1,8 @@
PRGNAM="rspamd" PRGNAM="rspamd"
VERSION="3.1" VERSION="3.4"
HOMEPAGE="https://rspamd.com" HOMEPAGE="https://rspamd.com"
DOWNLOAD="https://github.com/rspamd/rspamd/archive/3.1/rspamd-3.1.tar.gz" DOWNLOAD="https://github.com/rspamd/rspamd/archive/3.4/rspamd-3.4.tar.gz"
MD5SUM="8b87ee04a0ec561e81ecf8808a5f9f95" MD5SUM="05db39dec524f33caf5d0824ae389b0b"
DOWNLOAD_x86_64="" DOWNLOAD_x86_64=""
MD5SUM_x86_64="" MD5SUM_x86_64=""
REQUIRES="ragel luajit redis hyperscan" REQUIRES="ragel luajit redis hyperscan"