git: d697653cffd1 - main - Mk/bsd.port.mk: Allow WITHOUT_FEATURE_PORTS to cancel WITH_FEATURE
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 29 Feb 2024 06:08:14 UTC
The branch main has been updated by arrowd:
URL: https://cgit.FreeBSD.org/ports/commit/?id=d697653cffd19ddaf3cdee2589a830c72ab39777
commit d697653cffd19ddaf3cdee2589a830c72ab39777
Author: Gleb Popov <arrowd@FreeBSD.org>
AuthorDate: 2024-02-17 16:39:51 +0000
Commit: Gleb Popov <arrowd@FreeBSD.org>
CommitDate: 2024-02-29 06:07:12 +0000
Mk/bsd.port.mk: Allow WITHOUT_FEATURE_PORTS to cancel WITH_FEATURE
Differential Revision: https://reviews.freebsd.org/D43949
Sponsored by: Serenity Cybersecurity, LLC
---
Mk/bsd.port.mk | 39 ++++++++++++++++++++++++++++++---------
1 file changed, 30 insertions(+), 9 deletions(-)
diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index 32baeb54b242..1ec1e6c52c66 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -1322,18 +1322,39 @@ LDCONFIG32_DIR= libdata/ldconfig32
TMPDIR?= /tmp
. endif # defined(PACKAGE_BUILDING)
+# If user specified WITH_FEATURE=yes for a feature that is disabled by default
+# treat it as enabled by default
+. for feature in ${_LIST_OF_WITH_FEATURES}
+. if ${_DEFAULT_WITH_FEATURES:N${feature}}
+. if defined(WITH_${feature:tu})
+_DEFAULT_WITH_FEATURES+= ${feature}
+. endif
+. endif
+. endfor
+
+. for feature in ${_LIST_OF_WITH_FEATURES}
+# Create _{WITH,WITHOUT}_FEATURE vars based on user-provided {WITH,WITHOUT}_FEATURE
+. if defined(WITH_${feature:tu})
+_WITH_${feature:tu}= ${WITH_${feature:tu}}
+. endif
+. if defined(WITHOUT_${feature:tu})
+_WITHOUT_${feature:tu}= ${WITHOUT_${feature:tu}}
+. endif
# 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
+. if defined(WITHOUT_${feature:tu}_PORTS)
+. if ${WITHOUT_${feature:tu}_PORTS:M${PKGORIGIN}}
+_WITHOUT_${feature:tu}= yes
+.undef _WITH_${feature:tu}
+. endif
+. endif
. else
-_WITH_OR_WITHOUT= WITH
-. endif
-
-. if defined(${_WITH_OR_WITHOUT}_${feature:tu}_PORTS)
-. if ${${_WITH_OR_WITHOUT}_${feature:tu}_PORTS:M${PKGORIGIN}}
-${_WITH_OR_WITHOUT}_${feature:tu}= yes
+. if defined(WITH_${feature:tu}_PORTS)
+. if ${WITH_${feature:tu}_PORTS:M${PKGORIGIN}}
+_WITH_${feature:tu}= yes
+.undef _WITHOUT_${feature:tu}
+. endif
. endif
. endif
. endfor
@@ -1787,7 +1808,7 @@ CFLAGS:= ${CFLAGS:C/${_CPUCFLAGS}//}
. endif
. for f in ${_LIST_OF_WITH_FEATURES}
-. if defined(WITH_${f:tu}) || ( ${_DEFAULT_WITH_FEATURES:M${f}} && !defined(WITHOUT_${f:tu}) )
+. if defined(_WITH_${f:tu}) || ( ${_DEFAULT_WITH_FEATURES:M${f}} && !defined(_WITHOUT_${f:tu}) )
.include "${PORTSDIR}/Mk/Features/$f.mk"
. endif
. endfor