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)
This commit is contained in:
John Marino 2015-12-14 22:44:39 +00:00
parent 6c672e24d8
commit cb97dd0575
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=403743

View File

@ -68,6 +68,13 @@
# WITHOUT - Unset options from the command line # 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 # The following knobs are there to simplify the handling of OPTIONS in simple
# cases : # cases :
# #
@ -573,4 +580,25 @@ _OPTIONS_${_target}:= ${_OPTIONS_${_target}} ${_prio}:${_type}-${_target}-${opt}
. endif . endif
.endfor .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 .endif