svn commit: r403743 - head/Mk

John Marino marino at FreeBSD.org
Mon Dec 14 22:44:40 UTC 2015


Author: marino
Date: Mon Dec 14 22:44:39 2015
New Revision: 403743
URL: https://svnweb.freebsd.org/changeset/ports/403743

Log:
  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)

Modified:
  head/Mk/bsd.options.mk

Modified: head/Mk/bsd.options.mk
==============================================================================
--- head/Mk/bsd.options.mk	Mon Dec 14 22:24:07 2015	(r403742)
+++ head/Mk/bsd.options.mk	Mon Dec 14 22:44:39 2015	(r403743)
@@ -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_${_targ
 .  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


More information about the svn-ports-head mailing list