Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Dec 2024 20:01:12 GMT
From:      "Sergey A. Osokin" <osa@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: e038a67fc3ca - main - */*njs: fix build on FreeBSD 15
Message-ID:  <202412212001.4BLK1Cn9002309@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by osa:

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

commit e038a67fc3ca1630ff947d6e61d487f3fd7e8810
Author:     Sergey A. Osokin <osa@FreeBSD.org>
AuthorDate: 2024-12-21 20:00:20 +0000
Commit:     Sergey A. Osokin <osa@FreeBSD.org>
CommitDate: 2024-12-21 20:00:20 +0000

    */*njs: fix build on FreeBSD 15
    
    /usr/local/include/quickjs/quickjs.h:996:34: error: cast from 'JSCFunctionMagic *' (aka 'struct JSValue (*)(struct JSContext *, struct JSValue, int, struct JSValue *, int)') to 'JSCFunction *' (aka 'struct JSValue (*)(struct JSContext *, struct JSValue, int, struct JSValue *)') converts to incompatible function type [-Werror,-Wcast-function-type-mismatch]
      996 |     return JS_NewCFunction2(ctx, (JSCFunction *)func, name, length, cproto, magic);
          |                                  ^~~~~~~~~~~~~~~~~~~
    1 error generated.
---
 devel/libnjs/Makefile | 11 +++++++++--
 lang/njs/Makefile     | 11 +++++++++--
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/devel/libnjs/Makefile b/devel/libnjs/Makefile
index dddb6970ddaf..998e19ad9381 100644
--- a/devel/libnjs/Makefile
+++ b/devel/libnjs/Makefile
@@ -13,7 +13,7 @@ LICENSE_FILE=	${WRKSRC}/LICENSE
 LIB_DEPENDS=	libpcre2-8.so:devel/pcre2 \
 		libquickjs.so:lang/quickjs
 
-USES=		cpe ssl
+USES=		compiler:c11 cpe ssl
 
 CPE_VENDOR=	f5
 
@@ -24,6 +24,13 @@ CONFIGURE_ARGS=	--cc-opt="-I${LOCALBASE}/include/quickjs" \
 		--ld-opt="-L${LOCALBASE}/lib" \
 		--with-quickjs
 
+.include <bsd.port.pre.mk>
+
+# Fixes build failed for Clang 19.1.3+
+.if ${OPSYS} == FreeBSD && ${OSVERSION} >= 1500026 && ${CHOSEN_COMPILER_TYPE} == clang
+CFLAGS+=	-Wno-error=cast-function-type-mismatch
+.endif
+
 post-patch:
 	${REINPLACE_CMD} 's|%%LOCALBASE%%|${LOCALBASE}|g' \
 		${WRKSRC}/src/njs.pc.in
@@ -37,4 +44,4 @@ do-install:
 	${INSTALL_DATA} ${WRKSRC}/build/libnjs.a ${STAGEDIR}${PREFIX}/lib
 	${INSTALL_DATA} ${WRKSRC}/build/njs.pc ${STAGEDIR}${PREFIX}/libdata/pkgconfig
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
diff --git a/lang/njs/Makefile b/lang/njs/Makefile
index 36a0d40d1da8..55586e2d65b5 100644
--- a/lang/njs/Makefile
+++ b/lang/njs/Makefile
@@ -13,7 +13,7 @@ LICENSE_FILE=	${WRKSRC}/LICENSE
 LIB_DEPENDS=	libpcre2-8.so:devel/pcre2 \
 		libquickjs.so:lang/quickjs
 
-USES=		cpe ssl
+USES=		compiler:c11 cpe ssl
 
 CPE_VENDOR=	f5
 
@@ -27,10 +27,17 @@ CONFIGURE_ARGS=	--cc-opt="-I${LOCALBASE}/include/quickjs" \
 
 PLIST_FILES=	bin/njs
 
+.include <bsd.port.pre.mk>
+
+# Fixes build failed for Clang 19.1.3+
+.if ${OPSYS} == FreeBSD && ${OSVERSION} >= 1500026 && ${CHOSEN_COMPILER_TYPE} == clang
+CFLAGS+=	-Wno-error=cast-function-type-mismatch
+.endif
+
 do-build:
 	@cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE_CMD} njs
 
 do-install:
 	${INSTALL_PROGRAM} ${WRKSRC}/build/njs ${STAGEDIR}${PREFIX}/bin
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202412212001.4BLK1Cn9002309>