git: f8060500164a - main - databases/mongodb[78]0: fix build with NOAVX enabled

From: Ronald Klop <ronald_at_FreeBSD.org>
Date: Wed, 13 Nov 2024 20:32:23 UTC
The branch main has been updated by ronald:

URL: https://cgit.FreeBSD.org/ports/commit/?id=f8060500164aa5cb1b7b5b9d461f8390a0588ac0

commit f8060500164aa5cb1b7b5b9d461f8390a0588ac0
Author:     Ronald Klop <ronald@FreeBSD.org>
AuthorDate: 2024-11-07 15:48:44 +0000
Commit:     Ronald Klop <ronald@FreeBSD.org>
CommitDate: 2024-11-13 20:32:04 +0000

    databases/mongodb[78]0: fix build with NOAVX enabled
    
    Thanks to Yuri and Borja who helped creating patches and tested.
    
    PR:     282471
---
 databases/mongodb70/Makefile                                  |  7 ++++---
 ...patch-src_third__party_mozjs_extract_mozglue_misc_SIMD.cpp | 11 +++++++++++
 databases/mongodb80/Makefile                                  |  7 ++++---
 ...patch-src_third__party_mozjs_extract_mozglue_misc_SIMD.cpp | 11 +++++++++++
 4 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/databases/mongodb70/Makefile b/databases/mongodb70/Makefile
index b8d3a8b2910b..4e7cb6baf977 100644
--- a/databases/mongodb70/Makefile
+++ b/databases/mongodb70/Makefile
@@ -1,7 +1,7 @@
 PORTNAME=	mongodb
 DISTVERSIONPREFIX=	r
 DISTVERSION=	7.0.14
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	databases net
 PKGNAMESUFFIX=	${DISTVERSION:R:S/.//}
 
@@ -88,7 +88,7 @@ GROUPS=		mongodb
 
 OPTIONS_DEFINE=		LTO NOAVX SASL
 OPTIONS_DEFINE_aarch64=	ARMV80A
-OPTIONS_DEFAULT=	SASL
+OPTIONS_DEFAULT=	NOAVX SASL
 
 # MongoDB on non-LSE ARM cpu like Raspberry Pi can work but is unsupported upstream.
 # Can give corruption on high concurrency.
@@ -101,7 +101,8 @@ ARMV80A_EXTRA_PATCHES=	${FILESDIR}/extrapatch-SConstruct
 LTO_MAKE_ARGS=	--lto=on
 
 NOAVX_MAKE_ARGS=	--experimental-optimization="-sandybridge"
-NOAVX_EXTRA_PATCHES=	${FILESDIR}/extrapatch-src_third__party_mozjs_SConscript
+NOAVX_EXTRA_PATCHES=	${FILESDIR}/extrapatch-src_third__party_mozjs_SConscript \
+			${FILESDIR}/extrapatch-src_third__party_mozjs_extract_mozglue_misc_SIMD.cpp
 
 SASL_LIB_DEPENDS=	libsasl2.so:security/cyrus-sasl2
 SASL_MAKE_ARGS=		--use-sasl-client
diff --git a/databases/mongodb70/files/extrapatch-src_third__party_mozjs_extract_mozglue_misc_SIMD.cpp b/databases/mongodb70/files/extrapatch-src_third__party_mozjs_extract_mozglue_misc_SIMD.cpp
new file mode 100644
index 000000000000..f68cc2552390
--- /dev/null
+++ b/databases/mongodb70/files/extrapatch-src_third__party_mozjs_extract_mozglue_misc_SIMD.cpp
@@ -0,0 +1,11 @@
+--- src/third_party/mozjs/extract/mozglue/misc/SIMD.cpp.orig	2024-11-07 09:56:02 UTC
++++ src/third_party/mozjs/extract/mozglue/misc/SIMD.cpp
+@@ -448,7 +448,7 @@ const char* SIMD::memchr8SSE2(const char* ptr, char va
+ // assertion failure. Accordingly, we just don't allow that to happen. We
+ // are not particularly concerned about ensuring that newer 32 bit processors
+ // get access to the AVX2 functions exposed here.
+-#  if defined(MOZILLA_MAY_SUPPORT_AVX2) && defined(__x86_64__)
++#  if 0 && defined(MOZILLA_MAY_SUPPORT_AVX2) && defined(__x86_64__)
+ 
+ bool SupportsAVX2() { return supports_avx2(); }
+ 
diff --git a/databases/mongodb80/Makefile b/databases/mongodb80/Makefile
index d0cd767b77b3..8835aad4f65c 100644
--- a/databases/mongodb80/Makefile
+++ b/databases/mongodb80/Makefile
@@ -1,7 +1,7 @@
 PORTNAME=	mongodb
 DISTVERSIONPREFIX=	r
 DISTVERSION=	8.0.1
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	databases net
 PKGNAMESUFFIX=	${DISTVERSION:R:S/.//}
 
@@ -93,7 +93,7 @@ GROUPS=		mongodb
 
 OPTIONS_DEFINE=		LTO NOAVX SASL
 OPTIONS_DEFINE_aarch64=	ARMV80A
-OPTIONS_DEFAULT=	SASL
+OPTIONS_DEFAULT=	NOAVX SASL
 
 # MongoDB on non-LSE ARM cpu like Raspberry Pi can work but is unsupported upstream.
 # Can give corruption on high concurrency.
@@ -106,7 +106,8 @@ ARMV80A_EXTRA_PATCHES=	${FILESDIR}/extrapatch-SConstruct
 LTO_MAKE_ARGS=	--lto=on
 
 NOAVX_MAKE_ARGS=	--experimental-optimization="-sandybridge"
-NOAVX_EXTRA_PATCHES=	${FILESDIR}/extrapatch-src_third__party_mozjs_SConscript
+NOAVX_EXTRA_PATCHES=	${FILESDIR}/extrapatch-src_third__party_mozjs_SConscript \
+			${FILESDIR}/extrapatch-src_third__party_mozjs_extract_mozglue_misc_SIMD.cpp
 
 SASL_LIB_DEPENDS=	libsasl2.so:security/cyrus-sasl2
 SASL_MAKE_ARGS=		--use-sasl-client
diff --git a/databases/mongodb80/files/extrapatch-src_third__party_mozjs_extract_mozglue_misc_SIMD.cpp b/databases/mongodb80/files/extrapatch-src_third__party_mozjs_extract_mozglue_misc_SIMD.cpp
new file mode 100644
index 000000000000..f68cc2552390
--- /dev/null
+++ b/databases/mongodb80/files/extrapatch-src_third__party_mozjs_extract_mozglue_misc_SIMD.cpp
@@ -0,0 +1,11 @@
+--- src/third_party/mozjs/extract/mozglue/misc/SIMD.cpp.orig	2024-11-07 09:56:02 UTC
++++ src/third_party/mozjs/extract/mozglue/misc/SIMD.cpp
+@@ -448,7 +448,7 @@ const char* SIMD::memchr8SSE2(const char* ptr, char va
+ // assertion failure. Accordingly, we just don't allow that to happen. We
+ // are not particularly concerned about ensuring that newer 32 bit processors
+ // get access to the AVX2 functions exposed here.
+-#  if defined(MOZILLA_MAY_SUPPORT_AVX2) && defined(__x86_64__)
++#  if 0 && defined(MOZILLA_MAY_SUPPORT_AVX2) && defined(__x86_64__)
+ 
+ bool SupportsAVX2() { return supports_avx2(); }
+