On Fri, Sep 03, 2021 at 10:13:57AM +0200, Thomas Huth wrote:
> It's cumbersome to maintain the option help texts twice, once in the
> "configure" script and once in meson_options.txt. So let's add some logic to
> the configure script to read most of the help texts from meson_options.txt.
> 
> Signed-off-by: Thomas Huth <[email protected]>
> ---
>  configure | 95 ++++++++++++++++++-------------------------------------
>  1 file changed, 31 insertions(+), 64 deletions(-)
> 

> +
> +# Read remaining options and help text from meson_options.txt:
> +current_feature=""
> +while read first rest ; do
> +    case "$first" in
> +    option*)
> +        case "$rest" in
> +        *type*:*"'feature'"*)
> +            current_feature=${first%\'*}
> +            current_feature=${current_feature#*\'}
> +        ;;
> +        *)
> +            current_feature=""
> +        ;;
> +        esac
> +    ;;
> +    description:)
> +        if [ -n "$current_feature" ]; then
> +            rest=${rest%\'*}
> +            printf "  %-15s %s\n" "$current_feature" "${rest#\'}"
> +        fi
> +    ;;
> +    *)
> +        current_feature=""
> +    ;;
> +    esac
> +done < "$source_path/meson_options.txt" | sort

Reviewed-by: Eric Blake <[email protected]>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


Reply via email to