git: 005c37a45174 - main - math/scilab: Fix build with llvm16

From: Muhammad Moinur Rahman <bofh_at_FreeBSD.org>
Date: Sun, 06 Aug 2023 12:30:50 UTC
The branch main has been updated by bofh:

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

commit 005c37a45174ae911664b40437facf84951eaa2f
Author:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
AuthorDate: 2023-08-06 12:12:12 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2023-08-06 12:30:36 +0000

    math/scilab: Fix build with llvm16
    
    Approved by:    portmgr (blanket)
    Sponsored by:   The FreeBSD Foundation
---
 math/scilab/Makefile | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/math/scilab/Makefile b/math/scilab/Makefile
index f41c7c33ab4b..7f497638d3fe 100644
--- a/math/scilab/Makefile
+++ b/math/scilab/Makefile
@@ -27,6 +27,7 @@ RUN_DEPENDS=	xdg-open:devel/xdg-utils
 USES=		compiler:c++17-lang cpe desktop-file-utils eigen:3,build \
 		fortran gettext gmake gnome iconv:wchar_t libtool \
 		localbase ncurses pathfix pkgconfig shared-mime-info
+USE_CXXSTD=	c++14
 USE_LOCALE=	en_US.UTF-8
 
 GNU_CONFIGURE=	yes
@@ -132,10 +133,14 @@ CONFIGURE_ARGS+=	--enable-debug
 
 .include <bsd.port.pre.mk>
 
-.if ${OPSYS} == FreeBSD && ( ${OSVERSION} >= 1400079 || ( ${OSVERSION} >= 1302505 && ${OSVERSION} < 1400000 ))
+.if ${COMPILER_TYPE} == clang && ${COMPILER_VERSION} >= 150
 CFLAGS+=	-Wno-error=int-conversion
 .endif
 
+.if ${COMPILER_TYPE} == clang && ${COMPILER_VERSION} >= 160
+CFLAGS+=	-Wno-error=incompatible-function-pointer-types
+.endif
+
 .if ${GCC_DEFAULT} >= 10
 # workaround for Rank mismatch between actual argument at (1) and actual argument at (2) (rank-1 and scalar)
 FFLAGS+=	-fallow-argument-mismatch
@@ -144,6 +149,11 @@ FFLAGS+=	-fallow-argument-mismatch
 post-patch:
 	@${REINPLACE_CMD} 's,/usr/local,${LOCALBASE},' ${WRKSRC}/etc/librarypath.xml
 	@${REINPLACE_CMD} -e 's, gfortran, ${FC},' ${WRKSRC}/modules/dynamic_link/src/scripts/configure
+.if ${COMPILER_TYPE} == clang && ${COMPILER_VERSION} >= 160
+	@${REINPLACE_CMD} -e 's|std::filesystem|std::__fs::filesystem|g' \
+		${WRKSRC}/modules/fileio/src/cpp/fullpath.cpp \
+		${WRKSRC}/modules/fileio/sci_gateway/cpp/sci_get_absolute_file_path.cpp
+.endif
 
 post-patch-GUI-on:
 # scilab segfaults on FreeBSD with C locale