aboutsummaryrefslogtreecommitdiffstats
path: root/Mk/bsd.options.mk
diff options
context:
space:
mode:
authormarino <marino@FreeBSD.org>2015-12-15 06:44:39 +0800
committermarino <marino@FreeBSD.org>2015-12-15 06:44:39 +0800
commit88518567e218c74b94b010e748beb073f4b4897a (patch)
tree4aa6f003dca5d45a5f5ee6ac108c17c7982046c8 /Mk/bsd.options.mk
parent56328b38327ced1c3c1c5f580dd93f3a8b9bcceb (diff)
downloadfreebsd-ports-gnome-88518567e218c74b94b010e748beb073f4b4897a.tar.gz
freebsd-ports-gnome-88518567e218c74b94b010e748beb073f4b4897a.tar.zst
freebsd-ports-gnome-88518567e218c74b94b010e748beb073f4b4897a.zip
Mk/bsd.options.mk: Introduce SELECTED_OPTIONS, DESELECTED_OPTIONS
Until now, the only way to obtain information on the valid port options and the current selection states is by using the pretty-print-config target. It would look something like this: > make -C /usr/ports/lang/gcc5-aux print-print-config Standard[ +FORT +OBJC +NLS -TESTSUITE -ALLSTAGES -STATIC ] \ Bootstrap[ -BOOTSTRAP ] To process the total options and the selection state of each option requires additional processing, e.g. with awk and/or sed. Moreover, if other information is needed about the port it question, it would require a second execution of "make" to reveal variable values. There simply is no other way to obtain the option selection information in a single pass (this limitation came when options framework was brought in). This enhancement allows the option selection information to revealed with make -V so that all port information can be acquired in a single pass. Moreover, they won't require piping through sed or awk. Two read-only variables are introduced: SELECTED_OPTIONS (list of all "on" options) DESELECTED_OPTIONS (liss of all "off" options) Here's an example of a single pass acquisition: > make -C /usr/dports/lang/gcc5-aux -V PKGNAME -V SELECTED_OPTIONS \ -V DESELECTED_OPTIONS gcc5-aux-20150716 NLS OBJC FORT BOOTSTRAP STATIC ALLSTAGES TESTSUITE Obviously the grouping information seen in pretty-print-config is lost, so these new variables will not help if option group information is required. Approved by: portmgr (bapt)
Diffstat (limited to 'Mk/bsd.options.mk')
-rw-r--r--Mk/bsd.options.mk28
1 files changed, 28 insertions, 0 deletions
diff --git a/Mk/bsd.options.mk b/Mk/bsd.options.mk
index f399660412af..f4581ae13710 100644
--- a/Mk/bsd.options.mk
+++ b/Mk/bsd.options.mk
@@ -68,6 +68,13 @@
# WITHOUT - Unset options from the command line
#
#
+# These variables are strictly informational (read-only). They indicate the
+# current state of the selected options; they are space-delimited lists.
+#
+# SELECTED_OPTIONS - list of options set "on"
+# DESELECTED_OPTIONS - list of options set "off"
+#
+#
# The following knobs are there to simplify the handling of OPTIONS in simple
# cases :
#
@@ -573,4 +580,25 @@ _OPTIONS_${_target}:= ${_OPTIONS_${_target}} ${_prio}:${_type}-${_target}-${opt}
. endif
.endfor
+.undef (SELECTED_OPTIONS)
+.undef (DESELECTED_OPTIONS)
+.for opt in ${ALL_OPTIONS}
+. if ${PORT_OPTIONS:M${opt}}
+SELECTED_OPTIONS:= ${opt} ${SELECTED_OPTIONS}
+. else
+DESELECTED_OPTIONS:= ${opt} ${DESELECTED_OPTIONS}
+. endif
+.endfor
+.for otype in MULTI GROUP SINGLE RADIO
+. for m in ${OPTIONS_${otype}}
+. for opt in ${OPTIONS_${otype}_${m}}
+. if ${PORT_OPTIONS:M${opt}}
+SELECTED_OPTIONS:= ${opt} ${SELECTED_OPTIONS}
+. else
+DESELECTED_OPTIONS:= ${opt} ${DESELECTED_OPTIONS}
+. endif
+. endfor
+. endfor
+.endfor
+
.endif