git: bce996791511 - main - options/makeman: Handle __REQUIRED_OPTIONS

From: Colin Percival <cperciva_at_FreeBSD.org>
Date: Tue, 20 Jun 2023 00:23:29 UTC
The branch main has been updated by cperciva:

URL: https://cgit.FreeBSD.org/src/commit/?id=bce9967915115e00271b01f1698bfca30a9be1cc

commit bce9967915115e00271b01f1698bfca30a9be1cc
Author:     Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2023-06-18 00:01:52 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2023-06-20 00:23:09 +0000

    options/makeman: Handle __REQUIRED_OPTIONS
    
    Teach the code which generates src.conf.5 about __REQUIRED_OPTIONS;
    without this change it gets confused and thinks that every option
    turns the required options on.
    
    Reviewed by:    sjg, imp
    Differential Revision:  https://reviews.freebsd.org/D40591
---
 tools/build/options/makeman | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/build/options/makeman b/tools/build/options/makeman
index 5a8b207b228a..68eeaf2a7a11 100755
--- a/tools/build/options/makeman
+++ b/tools/build/options/makeman
@@ -117,10 +117,17 @@ show()
 		exit 1
 		;;
 	esac
+	requireds=`env -i make -f ${srcdir}/share/mk/src.opts.mk \
+	    -V '${__REQUIRED_OPTIONS:ts,}'`
 	env -i ${make} .MAKE.MODE=normal "$@" showconfig __MAKE_CONF=/dev/null \
 	    SRCCONF=/dev/null |
 	while read var _ val ; do
 		opt=${var#MK_}
+		case ,${requireds}, in
+		*,${opt},*)
+			continue
+			;;
+		esac
 		case ${val} in
 		yes)
 			echo ${yes_prefix}_${opt}