git: 60a66ea271fa - main - www/nginx: Add PCRE2 Support

From: Jochen Neumeister <joneum_at_FreeBSD.org>
Date: Fri, 27 May 2022 20:54:51 UTC
The branch main has been updated by joneum:

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

commit 60a66ea271fab8b9afbdb96454729d888fd4c182
Author:     Jochen Neumeister <joneum@FreeBSD.org>
AuthorDate: 2022-05-27 20:50:27 +0000
Commit:     Jochen Neumeister <joneum@FreeBSD.org>
CommitDate: 2022-05-27 20:54:45 +0000

    www/nginx: Add PCRE2 Support
    
    In NGINX version 1.21.5 (former devel version) PCRE2 support was added.
    Please note: several modules are required patching to support PCRE2 library, so let's keep PCRE1 as default version for now.
    
    While here, Update NJS to 0.7.4
    
    Sponsored by:   Netzkommune GmbH
---
 www/nginx/Makefile              | 33 ++++++++++++++++++++++-----------
 www/nginx/Makefile.extmod       |  2 +-
 www/nginx/Makefile.options.desc |  3 ++-
 www/nginx/distinfo              |  6 +++---
 4 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/www/nginx/Makefile b/www/nginx/Makefile
index c8cbdc469d6c..5cde9bdf609a 100644
--- a/www/nginx/Makefile
+++ b/www/nginx/Makefile
@@ -2,7 +2,7 @@
 
 PORTNAME=	nginx
 PORTVERSION=	1.22.0
-PORTREVISION?=	2
+PORTREVISION?=	3
 PORTEPOCH=	2
 CATEGORIES=	www
 MASTER_SITES=	https://nginx.org/download/ \
@@ -59,7 +59,8 @@ CONFIGURE_ARGS+=--prefix=${ETCDIR} \
 		--pid-path=${NGINX_RUNDIR}/nginx.pid \
 		--error-log-path=${NGINX_ERRORLOG} \
 		--user=${WWWOWN} --group=${WWWGRP} \
-		--with-compat
+		--with-compat \
+		--with-pcre
 ALL_TARGET=
 
 PLIST_SUB+=	NGINX_TMPDIR=${NGINX_TMPDIR} NGINX_LOGDIR=${NGINX_LOGDIR} WWWOWN=${WWWOWN} WWWGRP=${WWWGRP}
@@ -74,7 +75,7 @@ OPTIONS_GROUP=	MAILGRP HTTPGRP
 OPTIONS_GROUP_HTTPGRP=	GOOGLE_PERFTOOLS HTTP HTTP_ADDITION HTTP_AUTH_REQ \
 	HTTP_CACHE HTTP_DAV HTTP_FLV HTTP_GUNZIP_FILTER HTTP_GZIP_STATIC \
 	HTTP_IMAGE_FILTER HTTP_MP4 HTTP_PERL HTTP_RANDOM_INDEX HTTP_REALIP \
-	HTTP_REWRITE HTTP_SECURE_LINK HTTP_SLICE HTTP_SLICE_AHEAD \
+	HTTP_SECURE_LINK HTTP_SLICE HTTP_SLICE_AHEAD \
 	HTTP_SSL HTTP_STATUS HTTP_SUB HTTP_XSLT HTTPV2 HTTPV2_AUTOTUNE \
 	STREAM STREAM_SSL STREAM_SSL_PREREAD
 # External modules (arrayvar MUST appear after devel_kit for build-dep)
@@ -100,6 +101,12 @@ OPTIONS_DEFAULT?=	DSO FILE_AIO HTTP HTTP_ADDITION HTTP_AUTH_REQ HTTP_CACHE \
 		HTTPV2 MAIL MAIL_SSL STREAM STREAM_SSL STREAM_SSL_PREREAD \
 		THREADS WWW
 
+OPTIONS_RADIO+=		PCRE
+OPTIONS_RADIO_PCRE=	PCRE_ONE PCRE_TWO
+PCRE_ONE_LIB_DEPENDS=	libpcre.so:devel/pcre
+PCRE_ONE_CONFIGURE_ON=	--without-pcre2
+PCRE_TWO_LIB_DEPENDS=	libpcre2-8.so:devel/pcre2
+
 OPTIONS_RADIO+=		GSSAPI
 OPTIONS_RADIO_GSSAPI=	GSSAPI_HEIMDAL GSSAPI_MIT
 GSSAPI_HEIMDAL_USES=	gssapi:heimdal,flags
@@ -160,9 +167,6 @@ HTTP_PERL_USES=			perl5
 HTTP_PERL_VARS=			DSO_BASEMODS+=http_perl_module
 HTTP_RANDOM_INDEX_CONFIGURE_ON=	--with-http_random_index_module
 HTTP_REALIP_CONFIGURE_ON=	--with-http_realip_module
-HTTP_REWRITE_LIB_DEPENDS=	libpcre.so:devel/pcre
-HTTP_REWRITE_CONFIGURE_ON=	--with-pcre
-HTTP_REWRITE_CONFIGURE_OFF=	--without-http_rewrite_module
 HTTP_SECURE_LINK_CONFIGURE_ON=	--with-http_secure_link_module
 HTTP_SLICE_CONFIGURE_ON=	--with-http_slice_module
 HTTP_SSL_CONFIGURE_ON=		--with-http_ssl_module
@@ -220,15 +224,20 @@ IGNORE=		requires at least HTTP or MAIL to \
 		be defined.  Please do 'make config' again
 .endif
 
-.if !${PORT_OPTIONS:MHTTP_REWRITE} && !defined(USE_HTTP_REWRITE)
-PKGNAMESUFFIX:=	${PKGNAMESUFFIX}-nopcre
-.endif
-
 .if ${PORT_OPTIONS:MPASSENGER} && empty(PORT_OPTIONS:MDEBUG)
 CONFIGURE_ENV+=	OPTIMIZE="yes"
 CFLAGS+=	-DNDEBUG
 .endif
 
+.if empty(PORT_OPTIONS:MPCRE_ONE) && empty(PORT_OPTIONS:MPCRE_TWO)
+IGNORE=		required at least PCRE_ONE or PCRE_TWO \
+		to be defined. Please do 'make config' again
+.endif
+
+.if ${PORT_OPTIONS:MPCRE_ONE}
+NJS_CONFIGURE_ARGS=	--no-pcre2
+.endif
+
 pre-everything::
 	@${ECHO_MSG}
 .if ${PORT_OPTIONS:MHTTP_UPSTREAM_FAIR}
@@ -311,7 +320,9 @@ pre-configure-SMALL_LIGHT-on:
 	( cd ${WRKSRC_small_light} && ./setup )
 
 do-configure-NJS-on:
-	( cd ${WRKSRC_njs} && ${SETENV} ${CONFIGURE_ENV} ${CONFIGURE_CMD} )
+	( cd ${WRKSRC_njs} && ${SETENV} ${CONFIGURE_ENV} ${CONFIGURE_CMD} ${NJS_CONFIGURE_ARGS} \
+		&& ${SETENV} ${MAKE_ENV} ${MAKE_CMD} njs \
+		&& ${MV} build/njs ${WRKSRC_njs} )
 
 .if !target(do-install)
 do-install:
diff --git a/www/nginx/Makefile.extmod b/www/nginx/Makefile.extmod
index d7795712907b..2c0d67ab6a00 100644
--- a/www/nginx/Makefile.extmod
+++ b/www/nginx/Makefile.extmod
@@ -236,7 +236,7 @@ NAXSI_NGINX_VER=	1.3
 NAXSI_GH_TUPLE=		nbs-system:naxsi:${NAXSI_NGINX_VER}:naxsi
 NAXSI_VARS=		DSO_EXTMODS+=naxsi NAXSI_SUBDIR=/naxsi_src
 
-NJS_GH_TUPLE=		nginx:njs:0.7.0:njs
+NJS_GH_TUPLE=		nginx:njs:0.7.4:njs
 NJS_VARS=		DSO_EXTMODS+=njs NJS_SUBDIR=/nginx
 NJS_USES=		libedit
 
diff --git a/www/nginx/Makefile.options.desc b/www/nginx/Makefile.options.desc
index 4f6cf73db8fc..2e654046e5de 100644
--- a/www/nginx/Makefile.options.desc
+++ b/www/nginx/Makefile.options.desc
@@ -57,7 +57,6 @@ HTTP_RANDOM_INDEX_DESC=		Enable http_random_index module
 HTTP_REALIP_DESC=		Enable http_realip module
 HTTP_REDIS_DESC=		3rd party http_redis module
 HTTP_RESPONSE_DESC=		3rd party http_response module
-HTTP_REWRITE_DESC=		Enable http_rewrite module
 HTTP_SECURE_LINK_DESC=		Enable http_secure_link module
 HTTP_SLICE_DESC=		Enable http_slice module
 HTTP_SLICE_AHEAD_DESC=		Enable http_slice_ahead module
@@ -92,6 +91,8 @@ NAXSI_DESC=			3rd party naxsi module
 NJS_DESC=			Enable http_javascript module
 OPENTRACING_DESC=		3rd party opentracing module
 PASSENGER_DESC=			3rd party passenger module
+PCRE_ONE_DESC=			Enable PCRE1 support
+PCRE_TWO_DESC=			Enable PCRE2 support
 POSTGRES_DESC=			3rd party postgres module
 RDS_CSV_DESC=			3rd party rds_csv module
 RDS_JSON_DESC=			3rd party rds_json module
diff --git a/www/nginx/distinfo b/www/nginx/distinfo
index a49f2f9bd531..e2553d3e0f3d 100644
--- a/www/nginx/distinfo
+++ b/www/nginx/distinfo
@@ -1,4 +1,4 @@
-TIMESTAMP = 1653482532
+TIMESTAMP = 1653569107
 SHA256 (nginx-1.22.0.tar.gz) = b33d569a6f11a01433a57ce17e83935e953ad4dc77cdd4d40f896c88ac26eb53
 SIZE (nginx-1.22.0.tar.gz) = 1073322
 SHA256 (nginx_mogilefs_module-1.0.4.tar.gz) = 7ac230d30907f013dff8d435a118619ea6168aa3714dba62c6962d350c6295ae
@@ -111,8 +111,8 @@ SHA256 (SpiderLabs-ModSecurity-nginx-v1.0.2_GH0.tar.gz) = f8d3ff15520df736c5e20e
 SIZE (SpiderLabs-ModSecurity-nginx-v1.0.2_GH0.tar.gz) = 33767
 SHA256 (nbs-system-naxsi-1.3_GH0.tar.gz) = 439c8677372d2597b4360bbcc10bc86490de1fc75695b193ad5df154a214d628
 SIZE (nbs-system-naxsi-1.3_GH0.tar.gz) = 235626
-SHA256 (nginx-njs-0.7.0_GH0.tar.gz) = 3f0fe7d77600a9c54000ce101dd51f44811964502641ae505e38c1bbf595e6f1
-SIZE (nginx-njs-0.7.0_GH0.tar.gz) = 575477
+SHA256 (nginx-njs-0.7.4_GH0.tar.gz) = c474b5adf6b1e8757100bbef35e1dc403183f8d9c0f50bfab01727b7777d7225
+SIZE (nginx-njs-0.7.4_GH0.tar.gz) = 589203
 SHA256 (opentracing-contrib-nginx-opentracing-2d81c29_GH0.tar.gz) = b082bb8e0f4de2e3361c9cae79e266856de1e5b26a43611e08446b7c2bc0b2b4
 SIZE (opentracing-contrib-nginx-opentracing-2d81c29_GH0.tar.gz) = 664357
 SHA256 (konstruxi-ngx_postgres-8aa7359_GH0.tar.gz) = c69ad4495de7c7883ebc23e1e6c4cc83a4ac6a7fddd4d5c12e49d33b65f7c50b