[libvirt] [dbus PATCH v2] build: convert to Meson/Ninja build system

Daniel P. Berrangé berrange at redhat.com
Fri Sep 20 09:14:00 UTC 2019


On Fri, Sep 20, 2019 at 11:03:42AM +0200, Pavel Hrdina wrote:
> Meson build system is simple and quick compared to Autotools and it's
> able to fully replace our Autotools usage.  There are few drawbacks as
> it's a fairly new build system, it requires Python 3.5 and Ninja 1.5.0,
> it's still evolving and the user base is not that large and there were
> some tweaks required to achieve the same functionality.
> 
> However, there are benefits, the configure and build time is way shorter
> and build definition files are more readable and easier to maintain.
> 
> There are some major changes with Meson build system:
> 
>     - there is no syntax-check target, the syntax-check is part of Meson
>       test suite but it's still possible to run it separately,
> 
>     - Meson forces separation between source and build directories
> 
> Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
> Tested-by: Ján Tomko <jtomko at redhat.com>
> ---
> 
> Notes:
>     changes in v2:
>     
>         - add -Werror if we are building from git
>         - fixed -Wframe-larger-than
>         - removed unrelated fix
>         - added comment for flake8 ignore warning
>         - added 'suite' labels 'syntax' and 'unit' for tests
>         - AUTHORS and libvirt-dbus.spec are generated only when building from git
>         - run.in is no longer executable, there is a helper script to fix permissions
>           for the generated run script
>         - fixed include_directories for test executable, direct paths can be used
>           since meson 0.50.0
>         - flake8 is optional as it was with autotools
>         - added meson version into spec file
> 
>  .gitignore                  |   1 +
>  AUTHORS.in                  |   2 +-
>  HACKING.md                  |  24 ++--
>  Makefile.am                 |  51 -------
>  README.md                   |  12 +-
>  autogen.sh                  |  52 -------
>  configure.ac                |  87 -----------
>  data/Makefile.am            |  83 -----------
>  data/meson.build            |  15 ++
>  data/session/meson.build    |   6 +
>  data/system/meson.build     |  18 +++
>  docs/Makefile.am            |  21 ---
>  docs/meson.build            |   8 ++
>  libvirt-dbus.spec.in        |   9 +-
>  m4/manywarnings.m4          | 276 -----------------------------------
>  m4/virt-arg.m4              | 154 --------------------
>  m4/virt-compile-pie.m4      |  35 -----
>  m4/virt-compile-warnings.m4 | 203 --------------------------
>  m4/virt-linker-relro.m4     |  35 -----
>  m4/warnings.m4              |  79 ----------
>  meson.build                 | 279 ++++++++++++++++++++++++++++++++++++
>  meson_options.txt           |   6 +
>  run.in                      |   4 +-
>  src/Makefile.am             |  66 ---------
>  src/meson.build             |  42 ++++++
>  tests/Makefile.am           |  57 --------
>  tests/meson.build           |  52 +++++++
>  tools/fix-perm.sh           |   3 +
>  tools/gen-authors.sh        |   4 +
>  29 files changed, 463 insertions(+), 1221 deletions(-)
>  delete mode 100644 Makefile.am
>  delete mode 100755 autogen.sh
>  delete mode 100644 configure.ac
>  delete mode 100644 data/Makefile.am
>  create mode 100644 data/meson.build
>  create mode 100644 data/session/meson.build
>  create mode 100644 data/system/meson.build
>  delete mode 100644 docs/Makefile.am
>  create mode 100644 docs/meson.build
>  delete mode 100644 m4/manywarnings.m4
>  delete mode 100644 m4/virt-arg.m4
>  delete mode 100644 m4/virt-compile-pie.m4
>  delete mode 100644 m4/virt-compile-warnings.m4
>  delete mode 100644 m4/virt-linker-relro.m4
>  delete mode 100644 m4/warnings.m4
>  create mode 100644 meson.build
>  create mode 100644 meson_options.txt
>  delete mode 100644 src/Makefile.am
>  create mode 100644 src/meson.build
>  delete mode 100644 tests/Makefile.am
>  create mode 100644 tests/meson.build
>  create mode 100755 tools/fix-perm.sh
>  create mode 100755 tools/gen-authors.sh


> diff --git a/libvirt-dbus.spec.in b/libvirt-dbus.spec.in
> index 626e2da..3425e9e 100644
> --- a/libvirt-dbus.spec.in
> +++ b/libvirt-dbus.spec.in
> @@ -1,5 +1,6 @@
>  # -*- rpm-spec -*-
>  
> +%global meson_version @MESON_VERSION@
>  %global glib2_version @GLIB2_REQUIRED@
>  %global libvirt_version @LIBVIRT_REQUIRED@
>  %global libvirt_glib_version @LIBVIRT_GLIB_REQUIRED@
> @@ -14,7 +15,7 @@ URL: https://libvirt.org/
>  Source0: https://libvirt.org/sources/dbus/%{name}-%{version}.tar.xz
>  
>  BuildRequires: gcc
> -BuildRequires: libtool
> +BuildRequires: meson >= %{meson_version}
>  BuildRequires: glib2-devel >= %{glib2_version}
>  BuildRequires: libvirt-devel >= %{libvirt_version}
>  BuildRequires: libvirt-glib-devel >= %{libvirt_glib_version}
> @@ -35,11 +36,11 @@ This package provides D-Bus API for libvirt
>  %autosetup
>  
>  %build
> -%configure
> -%make_build
> +%meson
> +%meson_build
>  
>  %install
> -%make_install
> +%meson_install
>  
>  %pre
>  getent group %{system_user} >/dev/null || groupadd -r %{system_user}

Should this add a '%check' section to run '%meson_test' as sanity
check for the build.


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 :|




More information about the libvir-list mailing list