git: 31235d9fe681 - main - lang/njs: add flavors

From: Sergey A. Osokin <osa_at_FreeBSD.org>
Date: Fri, 27 May 2022 19:29:59 UTC
The branch main has been updated by osa:

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

commit 31235d9fe681424e39052d635b27b552f00c3963
Author:     Sergey A. Osokin <osa@FreeBSD.org>
AuthorDate: 2022-05-27 19:28:26 +0000
Commit:     Sergey A. Osokin <osa@FreeBSD.org>
CommitDate: 2022-05-27 19:29:54 +0000

    lang/njs: add flavors
    
    Build both flavors (pcre and pcre2) for NGINX JavaScript command-line
    tool.
    
    Bump PORTREVISION.
---
 lang/njs/Makefile | 33 ++++++++++++++++++---------------
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/lang/njs/Makefile b/lang/njs/Makefile
index 9eec92d2b98a..383deb57faef 100644
--- a/lang/njs/Makefile
+++ b/lang/njs/Makefile
@@ -2,6 +2,7 @@
 
 PORTNAME=	njs
 DISTVERSION=	0.7.4
+PORTREVISION=	1
 CATEGORIES=	lang www
 
 MAINTAINER=	osa@FreeBSD.org
@@ -18,21 +19,23 @@ USE_GITHUB=	yes
 GH_TUPLE=	nginx:njs:${DISTVERSION}
 HAS_CONFIGURE=	yes
 
-OPTIONS_DEFINE=		SSL
-OPTIONS_RADIO+=		PCRE
-OPTIONS_RADIO_PCRE=	NOPCRE PCRE_ONE PCRE_TWO
-NOPCRE_CONFIGURE_ON=	--no-pcre
-PCRE_ONE_LIB_DEPENDS=	libpcre.so:devel/pcre
-PCRE_ONE_CONFIGURE_ON=	--no-pcre2
-PCRE_TWO_LIB_DEPENDS=	libpcre2-8.so:devel/pcre2
-OPTIONS_DEFAULT=	PCRE_ONE SSL
-SSL_CONFIGURE_OFF=	--no-openssl
-SSL_USES=		ssl
-
-NOPCRE_DESC=		Disable PCRE support
-PCRE_ONE_DESC=		Enable PCRE1 support
-PCRE_TWO_DESC=		Enable PCRE2 support
-SSL_DESC=		Enable OpenSSL support
+FLAVORS=	pcre pcre2
+FLAVOR?=	${FLAVORS:[1]}
+
+pcre_PKGNAMESUFFIX=
+pcre2_PKGNAMESUFFIX=	-pcre2
+
+pcre_CONFLICTS_INSTALL=		${PORTNAME}-pcre2
+pcre2_CONFLICTS_INSTALL=	${PORTNAME}
+
+USES=		ssl
+
+.if ${FLAVOR} == pcre
+LIB_DEPENDS=		libpcre.so:devel/pcre
+CONFIGURE_FLAGS+=	--no-pcre2
+.else
+LIB_DEPENDS=		libpcre2-8.so:devel/pcre2
+.endif
 
 PLIST_FILES=	bin/njs