git: 6389027ba582 - main - www/{nginx,nginx-devel,freenginx}: 3rd-party modules management

Jochen Neumeister <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.ports
Message-ID <[email protected]>
The branch main has been updated by joneum:

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

commit 6389027ba5826ae4c730d02022709fb6fb2daa5e
Author:     Jochen Neumeister <[email protected]>
AuthorDate: 2026-08-13 15:31:18 +0000
Commit:     Jochen Neumeister <[email protected]>
CommitDate: 2026-08-13 15:31:56 +0000

    www/{nginx,nginx-devel,freenginx}: 3rd-party modules management
    
    - Add new NJS_QJS option to build the NJS module with the QuickJS
      engine (lang/quickjs), which upstream recommends since njs 1.0.0
    - Warn users with NJS enabled that the built-in njs engine is EOL
    - Keep builds deterministic with NJS_QJS disabled (NJS_QUICKJS=NO)
    - nginx-devel: remove leftover NJS_QJS bits pointing to deleted
      patches; stop the QuickJS include path from clobbering the base
      cc-opt flags
    - nginx-full: enable NJS_QJS by default
    
    Sponsored by:   Netzkommune GmbH
---
 www/freenginx/Makefile              | 18 +++++++++++++++---
 www/freenginx/Makefile.extmod       |  6 ++++++
 www/freenginx/Makefile.options.desc |  1 +
 www/nginx-devel/Makefile            | 14 ++++++++------
 www/nginx-devel/Makefile.extmod     |  3 ---
 www/nginx-full/Makefile             |  2 +-
 www/nginx/Makefile                  | 18 +++++++++++++++---
 www/nginx/Makefile.extmod           |  6 ++++++
 www/nginx/Makefile.options.desc     |  1 +
 9 files changed, 53 insertions(+), 16 deletions(-)

diff --git a/www/freenginx/Makefile b/www/freenginx/Makefile
index 96cde7821179..b75bfb4e0ceb 100644
--- a/www/freenginx/Makefile
+++ b/www/freenginx/Makefile
@@ -48,7 +48,7 @@ SUB_LIST+=	WWWOWN=${WWWOWN} \
 
 HAS_CONFIGURE=	yes
 CONFIGURE_ARGS+=--prefix=${ETCDIR} \
-		--with-cc-opt="-I ${LOCALBASE}/include" \
+		--with-cc-opt="-I ${LOCALBASE}/include ${NJS_QJS_CFLAGS}" \
 		--conf-path=${ETCDIR}/nginx.conf \
 		--sbin-path=${PREFIX}/sbin/nginx \
 		--pid-path=${NGINX_RUNDIR}/nginx.pid \
@@ -78,7 +78,7 @@ OPTIONS_GROUP_MAILGRP=	MAIL MAIL_IMAP MAIL_POP3 MAIL_SMTP MAIL_SSL
 OPTIONS_GROUP_STREAMGRP=	STREAM STREAM_REALIP STREAM_SSL \
 	STREAM_SSL_PREREAD
 
-OPTIONS_DEFINE=		DEBUG DEBUGLOG DSO FILE_AIO IPV6 NJS NJS_XML OTEL THREADS WWW
+OPTIONS_DEFINE=		DEBUG DEBUGLOG DSO FILE_AIO IPV6 NJS NJS_QJS NJS_XML OTEL THREADS WWW
 OPTIONS_DEFAULT?=	DSO FILE_AIO HTTP HTTP_ADDITION HTTP_AUTH_REQ HTTP_CACHE \
 		HTTP_DAV HTTP_FLV HTTP_GUNZIP_FILTER HTTP_GZIP_STATIC HTTP_MP4 \
 		HTTP_RANDOM_INDEX HTTP_REALIP HTTP_SECURE_LINK HTTP_SLICE HTTP_SSL \
@@ -125,7 +125,7 @@ DEBUGLOG_CONFIGURE_ON=	--with-debug
 DSO_CONFIGURE_ON=	--modules-path=${MODULESDIR}
 DSO_VARS=		MODULESDIR=${PREFIX}/libexec/${PORTNAME}
 FILE_AIO_CONFIGURE_ON=	--with-file-aio
-IPV6_CONFIGURE_OFF=	--with-cc-opt="-DNGX_HAVE_INET6=0 -I ${LOCALBASE}/include"
+IPV6_CONFIGURE_OFF=	--with-cc-opt="-DNGX_HAVE_INET6=0 -I ${LOCALBASE}/include ${NJS_QJS_CFLAGS}"
 THREADS_CONFIGURE_ON=	--with-threads
 
 # Bundled modules
@@ -253,11 +253,23 @@ CONFIGURE_ENV+=		NJS_LIBXSLT=NO
 NJS_CONFIGURE_ARGS=	--no-libxml2
 .endif
 
+.if ${PORT_OPTIONS:MNJS_QJS}
+NJS_QJS_CFLAGS=		-I ${LOCALBASE}/include/quickjs
+NJS_CONFIGURE_ARGS+=	--cc-opt="${CFLAGS} -I${LOCALBASE}/include/quickjs" \
+			--ld-opt="-L${LOCALBASE}/lib" \
+			--with-quickjs
+.endif
+
 pre-everything::
 	@${ECHO_MSG}
 .if ${PORT_OPTIONS:MHTTP_UPSTREAM_FAIR}
 	@${ECHO_MSG} "Enable http_ssl module to build upstream_fair with SSL support"
 .endif
+.if ${PORT_OPTIONS:MNJS}
+	@${ECHO_MSG} "The built-in njs scripting engine is EOL, deprecated since njs 1.0.0."
+	@${ECHO_MSG} "Upstream recommends the QuickJS engine instead: enable the NJS_QJS"
+	@${ECHO_MSG} "option and select it in nginx.conf via the js_engine qjs directive."
+.endif
 .if ${PORT_OPTIONS:MPASSENGER}
 	@${ECHO_MSG} "This port install Passenger module only"
 .endif
diff --git a/www/freenginx/Makefile.extmod b/www/freenginx/Makefile.extmod
index fdbd72c45de5..e73d73f78240 100644
--- a/www/freenginx/Makefile.extmod
+++ b/www/freenginx/Makefile.extmod
@@ -251,6 +251,12 @@ NJS_GH_TUPLE=		nginx:njs:1.0.0:njs
 NJS_VARS=		DSO_EXTMODS+=njs NJS_SUBDIR=/nginx
 NJS_IMPLIES=		STREAM
 
+NJS_QJS_IMPLIES=	NJS
+NJS_QJS_LIB_DEPENDS=	libquickjs.so:lang/quickjs
+# njs auto-enables QuickJS whenever it is found at configure time,
+# keep the build deterministic when the option is disabled
+NJS_QJS_CONFIGURE_ENV_OFF=	NJS_QUICKJS=NO
+
 NJS_XML_IMPLIES=	HTTP NJS
 NJS_XML_LIB_DEPENDS=	libxml2.so:textproc/libxml2 \
 			libxslt.so:textproc/libxslt
diff --git a/www/freenginx/Makefile.options.desc b/www/freenginx/Makefile.options.desc
index f2b3924b69f8..c22809086c9f 100644
--- a/www/freenginx/Makefile.options.desc
+++ b/www/freenginx/Makefile.options.desc
@@ -89,6 +89,7 @@ MEMC_DESC=			3rd party memc (memcached) module
 MODSECURITY3_DESC=		3rd party modsecurity3 module
 NAXSI_DESC=			3rd party naxsi module
 NJS_DESC=			Enable javascript (NJS) module
+NJS_QJS_DESC=			Enable QuickJS engine in NJS module
 NJS_XML_DESC=			Enable XML functionality in NJS module
 OTEL_DESC=			Enable OpenTELemetry module
 PASSENGER_DESC=			3rd party passenger module
diff --git a/www/nginx-devel/Makefile b/www/nginx-devel/Makefile
index fa2edd61e80d..4e16548ef32a 100644
--- a/www/nginx-devel/Makefile
+++ b/www/nginx-devel/Makefile
@@ -48,7 +48,7 @@ SUB_LIST+=	WWWOWN=${WWWOWN} \
 
 HAS_CONFIGURE=	yes
 CONFIGURE_ARGS+=--prefix=${ETCDIR} \
-		--with-cc-opt="-I ${LOCALBASE}/include" \
+		--with-cc-opt="-I ${LOCALBASE}/include ${NJS_QJS_CFLAGS}" \
 		--with-ld-opt="-L ${LOCALBASE}/lib" \
 		--conf-path=${ETCDIR}/nginx.conf \
 		--sbin-path=${PREFIX}/sbin/nginx \
@@ -127,7 +127,7 @@ DEBUGLOG_CONFIGURE_ON=	--with-debug
 DSO_CONFIGURE_ON=	--modules-path=${MODULESDIR}
 DSO_VARS=		MODULESDIR=${PREFIX}/libexec/${PORTNAME}
 FILE_AIO_CONFIGURE_ON=	--with-file-aio
-IPV6_CONFIGURE_OFF=	--with-cc-opt="-DNGX_HAVE_INET6=0 -I ${LOCALBASE}/include"
+IPV6_CONFIGURE_OFF=	--with-cc-opt="-DNGX_HAVE_INET6=0 -I ${LOCALBASE}/include ${NJS_QJS_CFLAGS}"
 THREADS_CONFIGURE_ON=	--with-threads
 
 # Bundled modules
@@ -256,6 +256,7 @@ LIB_DEPENDS+=		libpcre.so:devel/pcre
 .endif
 
 .if ${PORT_OPTIONS:MNJS}
+NJS_QJS_CFLAGS=		-I ${LOCALBASE}/include/quickjs
 NJS_CONFIGURE_ARGS=	--cc-opt="${CFLAGS} -I${LOCALBASE}/include/quickjs" \
 			--ld-opt="-L${LOCALBASE}/lib" \
 			--with-quickjs
@@ -266,6 +267,11 @@ pre-everything::
 .if ${PORT_OPTIONS:MHTTP_UPSTREAM_FAIR}
 	@${ECHO_MSG} "Enable http_ssl module to build upstream_fair with SSL support"
 .endif
+.if ${PORT_OPTIONS:MNJS}
+	@${ECHO_MSG} "The built-in njs scripting engine is EOL, deprecated since njs 1.0.0."
+	@${ECHO_MSG} "This port builds the recommended QuickJS engine as well; select it"
+	@${ECHO_MSG} "in nginx.conf via the js_engine qjs directive."
+.endif
 .if ${PORT_OPTIONS:MPASSENGER}
 	@${ECHO_MSG} "This port install Passenger module only"
 .endif
@@ -303,10 +309,6 @@ post-patch-HTTP_TARANTOOL-on:
 post-patch-ICONV-on:
 	@${REINPLACE_CMD} 's!%%PREFIX%%!${LOCALBASE}!g' ${WRKSRC_iconv}/config
 
-post-patch-NJS_QJS-on:
-	@${REINPLACE_CMD} 's!%%LOCALBASE%%!${LOCALBASE}!g' ${WRKSRC_njs}/auto/quickjs \
-		${WRKSRC_njs}/nginx/config
-
 post-patch-PASSENGER-on:
 	@${REINPLACE_CMD} \
 		'176,178s!true!false!' \
diff --git a/www/nginx-devel/Makefile.extmod b/www/nginx-devel/Makefile.extmod
index 1bd90a3a998c..ac061ab178a3 100644
--- a/www/nginx-devel/Makefile.extmod
+++ b/www/nginx-devel/Makefile.extmod
@@ -247,12 +247,9 @@ NAXSI_EXTRA_PATCHES=	${PATCHDIR}/extra-patch-naxsi-libinjection__sqli_c \
 			${PATCHDIR}/extra-patch-naxsi_config
 
 NJS_GH_TUPLE=		nginx:njs:1.0.0:njs
-NJS_CONFIGURE_ON=	--with-cc-opt="-I ${LOCALBASE}/include/quickjs"
 NJS_LIB_DEPENDS=	libquickjs.so:lang/quickjs \
 			libxml2.so:textproc/libxml2 \
 			libxslt.so:textproc/libxslt
-NJS_QJS_EXTRA_PATCHES=	${PATCHDIR}/extra-patch-njs-auto-quickjs \
-			${PATCHDIR}/extra-patch-njs-nginx-config
 NJS_VARS=		DSO_EXTMODS+=njs NJS_SUBDIR=/nginx
 NJS_IMPLIES=		HTTP STREAM
 
diff --git a/www/nginx-full/Makefile b/www/nginx-full/Makefile
index 947716a0061c..be451b441027 100644
--- a/www/nginx-full/Makefile
+++ b/www/nginx-full/Makefile
@@ -19,7 +19,7 @@ OPTIONS_DEFAULT=DSO DEBUG DEBUGLOG FILE_AIO GOOGLE_PERFTOOLS \
 		HTTP_REALIP HTTP_REWRITE HTTP_SECURE_LINK HTTP_SLICE \
 		HTTP_SLICE_AHEAD HTTP_SSL HTTP_STATUS HTTP_SUB HTTP_XSLT \
 		MAIL MAIL_IMAP MAIL_POP3 MAIL_SMTP MAIL_SSL HTTPV2 HTTPV2_AUTOTUNE \
-		NJS STREAM STREAM_SSL STREAM_SSL_PREREAD THREADS WWW \
+		NJS NJS_QJS STREAM STREAM_SSL STREAM_SSL_PREREAD THREADS WWW \
 		AJP AWS_AUTH CACHE_PURGE CLOJURE ECHO FASTDFS HEADERS_MORE \
 		HTTP_ACCEPT_LANGUAGE HTTP_AUTH_DIGEST HTTP_AUTH_JWT \
 		HTTP_AUTH_KRB5 HTTP_AUTH_LDAP HTTP_AUTH_PAM HTTP_DAV_EXT \
diff --git a/www/nginx/Makefile b/www/nginx/Makefile
index e7f37ac3d96f..7252bdde95c0 100644
--- a/www/nginx/Makefile
+++ b/www/nginx/Makefile
@@ -48,7 +48,7 @@ SUB_LIST+=	WWWOWN=${WWWOWN} \
 
 HAS_CONFIGURE=	yes
 CONFIGURE_ARGS+=--prefix=${ETCDIR} \
-		--with-cc-opt="-I ${LOCALBASE}/include" \
+		--with-cc-opt="-I ${LOCALBASE}/include ${NJS_QJS_CFLAGS}" \
 		--conf-path=${ETCDIR}/nginx.conf \
 		--sbin-path=${PREFIX}/sbin/nginx \
 		--pid-path=${NGINX_RUNDIR}/nginx.pid \
@@ -78,7 +78,7 @@ OPTIONS_GROUP_MAILGRP=	MAIL MAIL_IMAP MAIL_POP3 MAIL_SMTP MAIL_SSL
 OPTIONS_GROUP_STREAMGRP=	STREAM STREAM_REALIP STREAM_SSL \
 	STREAM_SSL_PREREAD
 
-OPTIONS_DEFINE=		DEBUG DEBUGLOG DSO FILE_AIO IPV6 NJS NJS_XML OTEL THREADS WWW
+OPTIONS_DEFINE=		DEBUG DEBUGLOG DSO FILE_AIO IPV6 NJS NJS_QJS NJS_XML OTEL THREADS WWW
 OPTIONS_DEFAULT?=	DSO FILE_AIO HTTP HTTP_ADDITION HTTP_AUTH_REQ HTTP_CACHE \
 		HTTP_DAV HTTP_FLV HTTP_GUNZIP_FILTER HTTP_GZIP_STATIC HTTP_MP4 \
 		HTTP_RANDOM_INDEX HTTP_REALIP HTTP_SECURE_LINK HTTP_SLICE HTTP_SSL \
@@ -125,7 +125,7 @@ DEBUGLOG_CONFIGURE_ON=	--with-debug
 DSO_CONFIGURE_ON=	--modules-path=${MODULESDIR}
 DSO_VARS=		MODULESDIR=${PREFIX}/libexec/${PORTNAME}
 FILE_AIO_CONFIGURE_ON=	--with-file-aio
-IPV6_CONFIGURE_OFF=	--with-cc-opt="-DNGX_HAVE_INET6=0 -I ${LOCALBASE}/include"
+IPV6_CONFIGURE_OFF=	--with-cc-opt="-DNGX_HAVE_INET6=0 -I ${LOCALBASE}/include ${NJS_QJS_CFLAGS}"
 THREADS_CONFIGURE_ON=	--with-threads
 
 # Bundled modules
@@ -252,11 +252,23 @@ CONFIGURE_ENV+=		NJS_LIBXSLT=NO
 NJS_CONFIGURE_ARGS=	--no-libxml2
 .endif
 
+.if ${PORT_OPTIONS:MNJS_QJS}
+NJS_QJS_CFLAGS=		-I ${LOCALBASE}/include/quickjs
+NJS_CONFIGURE_ARGS+=	--cc-opt="${CFLAGS} -I${LOCALBASE}/include/quickjs" \
+			--ld-opt="-L${LOCALBASE}/lib" \
+			--with-quickjs
+.endif
+
 pre-everything::
 	@${ECHO_MSG}
 .if ${PORT_OPTIONS:MHTTP_UPSTREAM_FAIR}
 	@${ECHO_MSG} "Enable http_ssl module to build upstream_fair with SSL support"
 .endif
+.if ${PORT_OPTIONS:MNJS}
+	@${ECHO_MSG} "The built-in njs scripting engine is EOL, deprecated since njs 1.0.0."
+	@${ECHO_MSG} "Upstream recommends the QuickJS engine instead: enable the NJS_QJS"
+	@${ECHO_MSG} "option and select it in nginx.conf via the js_engine qjs directive."
+.endif
 .if ${PORT_OPTIONS:MPASSENGER}
 	@${ECHO_MSG} "This port install Passenger module only"
 .endif
diff --git a/www/nginx/Makefile.extmod b/www/nginx/Makefile.extmod
index 3ed6721004dc..5cdaee2effc7 100644
--- a/www/nginx/Makefile.extmod
+++ b/www/nginx/Makefile.extmod
@@ -244,6 +244,12 @@ NJS_GH_TUPLE=		nginx:njs:1.0.0:njs
 NJS_VARS=		DSO_EXTMODS+=njs NJS_SUBDIR=/nginx
 NJS_IMPLIES=		STREAM
 
+NJS_QJS_IMPLIES=	NJS
+NJS_QJS_LIB_DEPENDS=	libquickjs.so:lang/quickjs
+# njs auto-enables QuickJS whenever it is found at configure time,
+# keep the build deterministic when the option is disabled
+NJS_QJS_CONFIGURE_ENV_OFF=	NJS_QUICKJS=NO
+
 NJS_XML_IMPLIES=	HTTP NJS
 NJS_XML_LIB_DEPENDS=	libxml2.so:textproc/libxml2 \
 			libxslt.so:textproc/libxslt
diff --git a/www/nginx/Makefile.options.desc b/www/nginx/Makefile.options.desc
index ffa36def9bf1..2b19dcaeda40 100644
--- a/www/nginx/Makefile.options.desc
+++ b/www/nginx/Makefile.options.desc
@@ -88,6 +88,7 @@ MEMC_DESC=			3rd party memc (memcached) module
 MODSECURITY3_DESC=		3rd party modsecurity3 module
 NAXSI_DESC=			3rd party naxsi module
 NJS_DESC=			Enable javascript (NJS) module
+NJS_QJS_DESC=			Enable QuickJS engine in NJS module
 NJS_XML_DESC=			Enable XML functionality in NJS module
 OTEL_DESC=			Enable OpenTELemetry module
 PASSENGER_DESC=			3rd party passenger module
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.