qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 8/8] configure: automatically parse command line for meson -D


From: Daniel P . Berrangé
Subject: Re: [PATCH 8/8] configure: automatically parse command line for meson -D options
Date: Wed, 13 Jan 2021 10:31:43 +0000
User-agent: Mutt/1.14.6 (2020-07-11)

On Thu, Jan 07, 2021 at 03:00:39PM +0100, Paolo Bonzini wrote:
> Right now meson_options.txt lists almost 60 options.  Each option
> needs code in configure to parse it and pass the option down to Meson as
> a -D command-line argument; in addition the default must be duplicated
> between configure and meson_options.txt.
> 
> This series tries to remove the code duplication by passing unknown
> --enable and --disable options to a Perl program, and using Meson's
> introspection support to match those to meson_options.txt.
> About 80% of the options can be handled completely by the new
> mechanism.  Five meson options are not of the --enable/--disable
> kind.  Six more need to be parsed in configure for various reasons
> documented in the patch, but they still have their help automatically
> generated.
> 
> The advantages are simple to explain, and are basically what you
> can expect from an introspection-based system:
> 
> - there is obviously much less code in configure.  About 1000 lines
>   of the script deal with command line parsing, and the patch removes
>   a quarter of them.
> 
> - the script is higher quality than the repetitive code in configure.
>   Help is generally more complete and useful, for example it consistently
>   lists defaults as well as the possible choices if they are not just
>   enabled/disabled/auto.  Parsing is more consistent too, for example
>   --enable-slirp and --enable-blobs were not supported.
> 
> - new Meson options do not need any change to the configure script.
>   This increases the attractiveness of converting options from
>   hand-crafted parsing and config-host.mak to Meson.
> 
> The disadvantages are:
> 
> - a few options change name: --enable-tcmalloc and --enable-jemalloc
>   become --enable-malloc={tcmalloc,jemalloc}; --disable-blobs becomes
>   --disable-install-blobs.
> 
> - because we need to run the script to generate the full help, we
>   cannot rely on the user supplying the path to a Python interpreter
>   with --python.  For this reason, the script is written in Perl.
>   Perl 5 is universally available as "/usr/bin/env perl", while
>   (even ignoring the Python 2/3 difference) some systems do not
>   have a "python" or "python3" binary on the path.

Can't we just use  "/usr/bin/env python3", and if that doesn't
exist in $PATH, simply show truncated --help output, with a
message requesting that they pass --python to see full help.

> 
> - because we parse command-line options before meson is available,
>   the introspection output is stored in the source tree.  This is
>   the reason for the unattractive diffstat; the number of JSON lines
>   added is higher than the number of configure lines removed.
>   Of course the latter are code that must be maintained manually and
>   the former is not.
> 
> Note that the output of "meson introspect --buildoptions" is massaged
> slightly, in order to make it more stable and avoid horrible conflicts
> on every modification to meson_options.txt.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  Makefile                                |  11 +
>  configure                               | 371 ++----------
>  docs/devel/build-system.rst             |  49 +-
>  meson-buildoptions.json                 | 717 ++++++++++++++++++++++++

I'm not a fan of seeing this file introduced as it has significant
overlap with meson_options.txt.    I feel like the latter has enough
information present to do an acceptable job for help output. After
all that's sufficient if we were using meson directly.


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




reply via email to

[Prev in Thread] Current Thread [Next in Thread]