git: ba9f8de67ed9 - main - databases/mysql80-server: fix build of client on powerpc

From: Piotr Kubaj <pkubaj_at_FreeBSD.org>
Date: Thu, 02 Mar 2023 18:43:32 UTC
The branch main has been updated by pkubaj:

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

commit ba9f8de67ed96731d4b6f6e9c73df056793a9e0c
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2023-03-02 18:43:16 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2023-03-02 18:43:16 +0000

    databases/mysql80-server: fix build of client on powerpc
    
    On powerpc, clang miscompiles comp_err, which later fails at runtime with:
    ->  0x102ff48c <+16>: .long  0x0006ee74                ; unknown opcode
    The problem happens because of line:
    frame #0: 0x10323eb4 comp_err`set_my_errno(my_errno=-10608) at my_thr_init.cc:344:47
    
    GCC can compile client, but without -malign-double. It also needs to link to
    libatomic (so building without GCC installed wouldn't work anyway).
    
    This only fixes client. Server still fails to build because of:
    /wrkdirs/usr/ports/databases/mysql80-server/work/mysql-8.0.32/storage/innobase/include/log0sys.h:190:60: error: static assertion failed
      190 |   static_assert(decltype(write_to_file_requests_interval)::is_always_lock_free);
---
 databases/mysql80-server/Makefile | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/databases/mysql80-server/Makefile b/databases/mysql80-server/Makefile
index e85c20172dd2..06864573e5f2 100644
--- a/databases/mysql80-server/Makefile
+++ b/databases/mysql80-server/Makefile
@@ -15,8 +15,8 @@ LICENSE=		GPLv2
 WRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION}${DISTVERSIONSUFFIX}
 
 SLAVEDIRS=	databases/mysql80-client
-USES=		bison:build cmake:noninja compiler:c++17-lang cpe \
-		groff:run libedit localbase ncurses perl5 pkgconfig shebangfix ssl
+USES=		bison:build cmake:noninja cpe groff:run libedit localbase \
+		ncurses perl5 pkgconfig shebangfix ssl
 
 CPE_VENDOR=	oracle
 
@@ -53,7 +53,7 @@ BUILD_DEPENDS_powerpc64=	libunwind>0:devel/libunwind
 BUILD_DEPENDS_powerpc64le=	libunwind>0:devel/libunwind
 
 CMAKE_BUILD_TYPE=	Release
-CFLAGS+=		-fPIC -malign-double
+CFLAGS+=		-fPIC
 CFLAGS_aarch64?=	-march=armv8-a+crc+crypto
 
 CMAKE_ARGS+=	-DINSTALL_LAYOUT=FREEBSD \
@@ -184,6 +184,14 @@ FEDERATED_SUB_LIST_OFF+=	FEDER=""
 SSP_UNSAFE=	yes
 .endif
 
+.if ${ARCH} == powerpc
+LDFLAGS+=	-latomic
+USES+=		compiler:gcc-c++11-lib
+.else
+CXXFLAGS+=	-malign-double
+USES+=		compiler:c++17-lang
+.endif
+
 post-extract:
 	@${RM} -rv ${WRKSRC}/sql/sql_hints.yy.cc ${WRKSRC}/sql/sql_hints.yy.h