~alpine/aports

[alpine-aports] [PATCH] community/rspamd: enable build on mips*

alpine-mips-patches <info@mobile-stream.com>
Details
Message ID
<20190115061136.76A9C5FBA0@mx12.valuehost.ru>
Sender timestamp
1547529492
DKIM signature
missing
Download raw message
Patch: +82 -3
This is a generic fix really, nothing specific to mips*. It just makes
the bundled lua-torch aware of architectures besides x86/power/arm so
it might be reasonable to try s390x as well.

---
 community/rspamd/APKBUILD                     |  8 +-
 .../rspamd/lua-torch-fix-simd-detection.patch | 77 +++++++++++++++++++
 2 files changed, 82 insertions(+), 3 deletions(-)
 create mode 100644 community/rspamd/lua-torch-fix-simd-detection.patch

diff --git a/community/rspamd/APKBUILD b/community/rspamd/APKBUILD
index 1831ff6941..d3d160ef1b 100644
--- a/community/rspamd/APKBUILD
+++ b/community/rspamd/APKBUILD
@@ -5,10 +5,10 @@
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
pkgname=rspamd
pkgver=1.8.3
pkgrel=0
pkgrel=1
pkgdesc="Fast, free and open-source spam filtering system"
url="https://rspamd.com"
arch="x86_64 x86 armhf armv7 ppc64le"
arch="all !s390x"
license="Apache-2.0 BSD-1-Clause BSD-2-Clause BSD-3-Clause CC0 LGPL-2.1-or-later
	LGPL-3.0-only MIT Zlib"
options="!check"
@@ -47,6 +47,7 @@ source="$pkgname-$pkgver.tar.gz::https://github.com/vstakhov/$pkgname/archive/$p
	cmakelists.patch
	conf-split-workers.patch
	default-configs.patch
	lua-torch-fix-simd-detection.patch
	"

build() {
@@ -158,4 +159,5 @@ sha512sums="5e20255466fe2cd4842196fb2138732b59911de655e73d9cc13009b5179b84e5a206
a2003ef0c9d64a44480f59302864a2dfedcbe3a0047fcbb655408bc8aae9014b6ad0ddc6b64d4abeeb21bea0f86678afd30589ac8eed83e07ad7f87710e93702  rspamd.confd
5c699906097566962e3a13679a45973d49ee25d45c29097c5c35bff6d4e276ef6518f02b241888aaa4e5265079d19d28aac399d5dcd1a4cb982a89e4b22460e3  cmakelists.patch
a8aefee649bf6630339d1d3f2bb20c25ca70b21a8eaa92951e926d0fd4525f1d4ac4cc7ea66ac2b15323cf02c93c759ddf7181502f0d71b21384ced9d88c008e  conf-split-workers.patch
bca1b1361524e1c582f2d6f9d754766c63f60a856b9f0d858e17dfebb40f2046db3a759eb3dffc5075460c3d3b64224092e043f07bcd8331daa97babc61ea973  default-configs.patch"
bca1b1361524e1c582f2d6f9d754766c63f60a856b9f0d858e17dfebb40f2046db3a759eb3dffc5075460c3d3b64224092e043f07bcd8331daa97babc61ea973  default-configs.patch
2987f122653680207b97a9f93978192384804f93a8fa040085e53a801c77364e8bd7ceb0fabca62a9c7316ff32bcf3dee8f0d1b8cd2c29459c6272a19e8e293b  lua-torch-fix-simd-detection.patch"
diff --git a/community/rspamd/lua-torch-fix-simd-detection.patch b/community/rspamd/lua-torch-fix-simd-detection.patch
new file mode 100644
index 0000000000..f3df6f87de
--- /dev/null
+++ b/community/rspamd/lua-torch-fix-simd-detection.patch
@@ -0,0 +1,77 @@
--- a/contrib/lua-torch/torch7/lib/TH/generic/simd/simd.h
+++ b/contrib/lua-torch/torch7/lib/TH/generic/simd/simd.h
@@ -45,7 +45,7 @@
   SIMDExtension_NEON    = 0x1,
 #elif defined(__PPC64__)
   SIMDExtension_VSX     = 0x1,
-#else
+#elif defined(__i386) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_AMD64)
   SIMDExtension_AVX2    = 0x1,
   SIMDExtension_AVX     = 0x2,
   SIMDExtension_SSE     = 0x4,
@@ -53,31 +53,17 @@
   SIMDExtension_DEFAULT = 0x0
 };
 
+#if (defined(__arm__) || defined(__aarch64__)) && defined(__NEON__)
 
-#if defined(__arm__) || defined(__aarch64__) // incl. armel, armhf, arm64
-
- #if defined(__NEON__)
-
 static inline uint32_t detectHostSIMDExtensions()
 {
   return SIMDExtension_NEON;
 }
 
- #else //ARM without NEON
+#elif defined(__PPC64__) && defined(__VSX__)
 
 static inline uint32_t detectHostSIMDExtensions()
 {
-  return SIMDExtension_DEFAULT;
-}
-
- #endif
-
-#elif defined(__PPC64__)
-
- #if defined(__VSX__)
-
-static inline uint32_t detectHostSIMDExtensions()
-{
   uint32_t hostSimdExts = SIMDExtension_DEFAULT;
   char *evar;
 
@@ -87,16 +73,8 @@
   return hostSimdExts;
 }
 
- #else //PPC64 without VSX
+#elif defined(__i386) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_AMD64)
 
-static inline uint32_t detectHostSIMDExtensions()
-{
-  return SIMDExtension_DEFAULT;
-}
-
- #endif
-
-#else   // x86
 static inline void cpuid(uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
 {
 #if defined(_MSC_VER)
@@ -158,6 +136,13 @@
   }
 
   return hostSimdExts;
+}
+
+#else
+
+static inline uint32_t detectHostSIMDExtensions()
+{
+  return SIMDExtension_DEFAULT;
 }
 
 #endif // end SIMD extension detection code
-- 
2.20.1




---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---
Reply to thread Export thread (mbox)