git: 5c7b1f13e5e7 - main - Mk/bsd.port.mk: Add FLAVOR_SUB

From: Baptiste Daroussin <bapt_at_FreeBSD.org>
Date: Mon, 18 Oct 2021 11:32:23 UTC
The branch main has been updated by bapt:

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

commit 5c7b1f13e5e7d19caedabd0b0e1087622c5a8f08
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2021-10-14 14:34:04 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2021-10-18 11:31:56 +0000

    Mk/bsd.port.mk: Add FLAVOR_SUB
    
    If defined, for each flavors it will create for the non active one:
    PLIST_SUB=      FLAVORNAME="@comment " NO_FLAVOUNAME=""
    and for the active one:
    PLIST_SUB=      FLAVORNAME="" NO_FLAVOUNAME="@comment "
    
    Same for SUB_LIST
    
    Reviewed by:    manu, bdrewery, mat
    Differential Revision:  https://reviews.freebsd.org/D32495
---
 Mk/bsd.port.mk | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index a0f19bd77697..ba8e97da8f9c 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -1545,6 +1545,12 @@ ${v}+=	${${FLAVOR}_${v}}
 ${v}=	flavor "${FLAVOR}" ${${FLAVOR}_${v}}
 .endif
 .endfor
+.if defined(FLAVORS_SUB)
+PLIST_SUB+=	${FLAVORS:N${FLAVOR}:@v@${v:tu}="\@comment " NO_${v:tu}=""@}
+PLIST_SUB+=	${FLAVOR:tu}="" NO_${FLAVOR:tu}="@comment "
+SUB_LIST+=	${FLAVORS:N${FLAVOR}:@v@${v:tu}="\@comment " NO_${v:tu}=""@}
+SUB_LIST+=	${FLAVOR:tu}="" NO_${FLAVOR:tu}="@comment "
+.endif
 .endif # defined(${FLAVOR})