svn commit: r454266 - head/Mk

Bryan Drewery bdrewery at FreeBSD.org
Wed Nov 15 19:13:51 UTC 2017


Author: bdrewery
Date: Wed Nov 15 19:13:50 2017
New Revision: 454266
URL: https://svnweb.freebsd.org/changeset/ports/454266

Log:
  Fix [DE]SELECTED_OPTIONS to lazily evaluate as late as possible.
  
  If a port modifies OPTIONS_UNSET after including bsd.port.options.mk
  then these values were wrong even though all of 'showconfig',
  'pretty-print-config', and the package generated all had the expected
  options.
  
  Only Poudriere and synth use these variables for incremental build checks.
  
  Reviewed by:	sjg, bapt
  Approved by:	portmgr (bapt)
  Differential Revision:	https://reviews.freebsd.org/D13092

Modified:
  head/Mk/bsd.options.mk

Modified: head/Mk/bsd.options.mk
==============================================================================
--- head/Mk/bsd.options.mk	Wed Nov 15 18:57:48 2017	(r454265)
+++ head/Mk/bsd.options.mk	Wed Nov 15 19:13:50 2017	(r454266)
@@ -640,22 +640,15 @@ _OPTIONS_${_target}:=	${_OPTIONS_${_target}} ${_prio}:
 
 .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
+# Wait to expand PORT_OPTIONS until the last moment in case something modifies
+# the selected OPTIONS after bsd.port.options.mk is included.  This uses
+# bmake's :@ for loop.
+SELECTED_OPTIONS=	${ALL_OPTIONS:@opt@${PORT_OPTIONS:M${opt}}@}
+DESELECTED_OPTIONS=	${ALL_OPTIONS:@opt@${"${PORT_OPTIONS:M${opt}}":?:${opt}}@}
 .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
+SELECTED_OPTIONS+=	${OPTIONS_${otype}_${m}:@opt@${PORT_OPTIONS:M${opt}}@}
+DESELECTED_OPTIONS+=	${OPTIONS_${otype}_${m}:@opt@${"${PORT_OPTIONS:M${opt}}":?:${opt}}@}
 .  endfor
 .endfor
 


More information about the svn-ports-all mailing list