git: 263bffb30676 - main - Mk/bsd.port.mk: Introduce generic WITH_<FEATURE>_PORTS knob.

From: Gleb Popov <arrowd_at_FreeBSD.org>
Date: Thu, 11 Jan 2024 08:06:51 UTC
The branch main has been updated by arrowd:

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

commit 263bffb306762bd6ff208111fda30cfbff3d6486
Author:     Gleb Popov <arrowd@FreeBSD.org>
AuthorDate: 2024-01-08 18:40:03 +0000
Commit:     Gleb Popov <arrowd@FreeBSD.org>
CommitDate: 2024-01-11 08:06:28 +0000

    Mk/bsd.port.mk: Introduce generic WITH_<FEATURE>_PORTS knob.
    
    This allows enabling any feature supported by Ports Framework for a selected
    ports. It was only possible to do WITH_DEBUG_PORTS before.
    
    Differential Revision: https://reviews.freebsd.org/D43369
    
    Approved by:    bapt
---
 Mk/bsd.port.mk | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index 097f64d4b6ae..54390720912e 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -1325,11 +1325,21 @@ LDCONFIG32_DIR=	libdata/ldconfig32
 TMPDIR?=	/tmp
 .    endif # defined(PACKAGE_BUILDING)
 
-.    if defined(WITH_DEBUG_PORTS)
-.      if ${WITH_DEBUG_PORTS:M${PKGORIGIN}}
-WITH_DEBUG=	yes
+# For each Feature we support, process the
+# WITH_FEATURE_PORTS and WITHOUT_FEATURE_PORTS variables
+.    for feature in ${_LIST_OF_WITH_FEATURES}
+.      if ${_DEFAULT_WITH_FEATURES:M${feature}}
+_WITH_OR_WITHOUT=	WITHOUT
+.      else
+_WITH_OR_WITHOUT=	WITH
 .      endif
-.    endif
+
+.      if defined(${_WITH_OR_WITHOUT}_${feature:tu}_PORTS)
+.        if ${${_WITH_OR_WITHOUT}_${feature:tu}_PORTS:M${PKGORIGIN}}
+${_WITH_OR_WITHOUT}_${feature:tu}=	yes
+.        endif
+.      endif
+.    endfor
 
 .    if defined(USE_LTO)
 WITH_LTO=	${USE_LTO}