aboutsummaryrefslogtreecommitdiffstats
path: root/Mk/bsd.options.mk
diff options
context:
space:
mode:
authorbdrewery <bdrewery@FreeBSD.org>2017-11-16 03:13:50 +0800
committerbdrewery <bdrewery@FreeBSD.org>2017-11-16 03:13:50 +0800
commit11b780c544a04003bbd7cbfa66013f40f63bc75f (patch)
tree6fec23a7d4ac03024c5d5ad3adb2ad450642c451 /Mk/bsd.options.mk
parentcaa7a22a14a6b973a0ec6efae8c1b59281a092cf (diff)
downloadfreebsd-ports-gnome-11b780c544a04003bbd7cbfa66013f40f63bc75f.tar.gz
freebsd-ports-gnome-11b780c544a04003bbd7cbfa66013f40f63bc75f.tar.zst
freebsd-ports-gnome-11b780c544a04003bbd7cbfa66013f40f63bc75f.zip
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
Diffstat (limited to 'Mk/bsd.options.mk')
-rw-r--r--Mk/bsd.options.mk21
1 files changed, 7 insertions, 14 deletions
diff --git a/Mk/bsd.options.mk b/Mk/bsd.options.mk
index bede3680f64a..203186addf4a 100644
--- a/Mk/bsd.options.mk
+++ b/Mk/bsd.options.mk
@@ -640,22 +640,15 @@ _OPTIONS_${_target}:= ${_OPTIONS_${_target}} ${_prio}:${_type}-${_target}-${opt}
.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