From 87c6387898b4c930076ebed4775da8e01ebf9cea Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Wed, 22 Jan 2025 01:05:50 -0500 Subject: [PATCH] meson: use more idiomatic manpage checks The "man" option is defined as a meson feature option. Feature options possess tristate values, but using the .allowed() method casts it to a dual-valued option. Effectively, both "auto" and "enabled" were treated as boolean true, and disabled was treated as boolean false. find_program was informed that it should always check for the manpage generator, but with a boolean `required:` kwarg, it is nonfatal if not found. That meant configuring with "man=disabled", the manpage would be automatically built if the generator program was available, and with "man=auto" the project would fatally error when configuring but the generator program was not available. This is clearly confusing/wrong, so pass the option value directly instead. The default value of the option was formerly effectively set to "auto". Change its value to truly be that, so that the default behavior is preserved. --- meson.build | 6 ++---- meson_options.txt | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/meson.build b/meson.build index b53590c3..5521f30a 100644 --- a/meson.build +++ b/meson.build @@ -134,7 +134,7 @@ endif ##################################################################### -xsltproc = find_program('xsltproc', required: get_option('man').allowed()) +xsltproc = find_program('xsltproc', required: get_option('man')) ##################################################################### @@ -159,9 +159,7 @@ subdir('src') ##################################################################### -if xsltproc.found() - subdir('man') -endif +subdir('man', if_found: xsltproc) install_data('LICENSE', 'CODING_STYLE', diff --git a/meson_options.txt b/meson_options.txt index 1b4474b5..f9486a3d 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -2,7 +2,7 @@ # SPDX-License-Identifier: LGPL-2.1-or-later option('man', type : 'feature', - value : 'disabled', + value : 'auto', description : 'build and install man pages') option('docdir', type : 'string',