git: 2ad588ce2c1b - main - databases/mariadb106-server: fix build on riscv64

From: Piotr Kubaj <pkubaj_at_FreeBSD.org>
Date: Thu, 24 Feb 2022 06:52:15 UTC
The branch main has been updated by pkubaj:

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

commit 2ad588ce2c1bd3850e77b0cbc350a9c4deecae95
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2022-02-24 06:46:57 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2022-02-24 06:46:57 +0000

    databases/mariadb106-server: fix build on riscv64
    
    Copy patch from databases/mariadb105-server.
    While here, also enable WSREP.
---
 databases/mariadb106-server/Makefile                 |  3 +--
 .../mariadb106-server/files/patch-sql_mysqld.cc      | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/databases/mariadb106-server/Makefile b/databases/mariadb106-server/Makefile
index ebe7a3018b21..f2b465bcfbfe 100644
--- a/databases/mariadb106-server/Makefile
+++ b/databases/mariadb106-server/Makefile
@@ -20,8 +20,6 @@ COMMENT?=	Multithreaded SQL database (server)
 LICENSE=	GPLv2
 LICENSE_FILE=	${WRKSRC}/COPYING
 
-BROKEN_riscv64=	fails to compile: needs FP_X_INV from empty sys/riscv/include/ieeefp.h
-
 LIB_DEPENDS+=	libpcre2-8.so:devel/pcre2
 
 # Ugly workaround for MariaDB/CMake library detection
@@ -60,6 +58,7 @@ OPTIONS_DEFINE_amd64=	WSREP
 OPTIONS_DEFINE_aarch64=	WSREP
 OPTIONS_DEFINE_powerpc64le=	WSREP
 OPTIONS_DEFINE_powerpc64=	WSREP
+OPTIONS_DEFINE_riscv64=	WSREP
 OPTIONS_GROUP_COMPRESSION=	LZ4 LZO SNAPPY ZSTD
 OPTIONS_GROUP_ENGINES=	COLUMNSTORE INNOBASE MROONGA OQGRAPH ROCKSDB S3 SPHINX SPIDER
 OPTIONS_GROUP_GROONGA=	ZMQ MSGPACK
diff --git a/databases/mariadb106-server/files/patch-sql_mysqld.cc b/databases/mariadb106-server/files/patch-sql_mysqld.cc
new file mode 100644
index 000000000000..e433bfc7d450
--- /dev/null
+++ b/databases/mariadb106-server/files/patch-sql_mysqld.cc
@@ -0,0 +1,20 @@
+--- sql/mysqld.cc.orig	2021-06-15 10:16:51 UTC
++++ sql/mysqld.cc
+@@ -205,7 +205,7 @@ typedef fp_except fp_except_t;
+ 
+ inline void setup_fpu()
+ {
+-#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H) && !defined(HAVE_FEDISABLEEXCEPT)
++#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H) && !defined(HAVE_FEDISABLEEXCEPT) && defined(FP_X_INV)
+   /* We can't handle floating point exceptions with threads, so disable
+      this on freebsd
+      Don't fall for overflow, underflow,divide-by-zero or loss of precision.
+@@ -218,7 +218,7 @@ inline void setup_fpu()
+   fpsetmask(~(FP_X_INV |             FP_X_OFL | FP_X_UFL | FP_X_DZ |
+               FP_X_IMP));
+ #endif /* FP_X_DNML */
+-#endif /* __FreeBSD__ && HAVE_IEEEFP_H && !HAVE_FEDISABLEEXCEPT */
++#endif /* __FreeBSD__ && HAVE_IEEEFP_H && !HAVE_FEDISABLEEXCEPT && FP_X_INV */
+ 
+ #ifdef HAVE_FEDISABLEEXCEPT
+   fedisableexcept(FE_ALL_EXCEPT);