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

Pavel Hrdina posted 1 patch 4 years, 7 months ago
Failed in applying to current master (apply log)
.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
[libvirt] [dbus PATCH v2] build: convert to Meson/Ninja build system
Posted by Pavel Hrdina 4 years, 7 months ago
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@redhat.com>
Tested-by: Ján Tomko <jtomko@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/.gitignore b/.gitignore
index b4abf66..7ed7554 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,6 +19,7 @@ vgcore.*
 /aclocal.m4
 /autom4te.cache/
 /build-aux/
+/build/
 /config.h
 /config.h.in
 /config.log
diff --git a/AUTHORS.in b/AUTHORS.in
index 52202ea..d5a486e 100644
--- a/AUTHORS.in
+++ b/AUTHORS.in
@@ -13,4 +13,4 @@ The primary maintainers of libvirt-dbus are:
 
 Patches have been received from:
 
-#contributorslist#
+@contributorslist@
diff --git a/HACKING.md b/HACKING.md
index 8903408..e90f136 100644
--- a/HACKING.md
+++ b/HACKING.md
@@ -16,32 +16,40 @@ Alternatively you can use one of the mirrors:
 Running from git repository
 ---------------------------
 
-  * The first step is to run autoreconf to create configure script:
+  * The first step is to run meson to create build directory:
 
     ```
-    ./autogen.sh
+    meson build
     ```
 
     Now you can compile libvirt-dbus:
 
     ```
-    make
+    ninja -C build
     ```
 
 
-  * Before posting a patch, you should run tests and perform syntax-checking:
+  * Before posting a patch, you should run tests:
 
     ```
-    make check
+    ninja -C build test
     ```
 
-    The test tool requires python3, python3-pytest and python3-dbus.
+    The test tool requires python3, python3-pytest, python3-dbus and flake8.
+
+    It is possible to run only specific test using:
+
+    ```
+    meson test -C build $test-name
+    ```
+
+    or a group of tests:
 
     ```
-    make syntax-check
+    meson test -C build --suite $label
     ```
 
-    To run this flake8 package is required.
+    For more information see [https://mesonbuild.com/Unit-tests.html#testing-tool](https://mesonbuild.com/Unit-tests.html#testing-tool).
 
 
   * To run libvirt-dbus directly from the build dir without installing it
diff --git a/Makefile.am b/Makefile.am
deleted file mode 100644
index 0914449..0000000
--- a/Makefile.am
+++ /dev/null
@@ -1,51 +0,0 @@
-SUBDIRS = \
-	data \
-	docs \
-	src \
-	tests \
-	$(NULL)
-
-ACLOCAL_AMFLAGS = -I m4
-
-EXTRA_DIST = \
-	$(PACKAGE).spec \
-	$(PACKAGE).spec.in \
-	AUTHORS.in \
-	HACKING.md \
-	README.md \
-	$(NULL)
-
-DISTCLEAN_FILES = \
-	$(PACKAGE).spec \
-	$(NULL)
-
-rpm: clean
-	@(unset CDPATH ; $(MAKE) dist && rpmbuild -ta $(distdir).tar.xz)
-
-dist-hook: gen-AUTHORS
-
-# Generate the AUTHORS file (with all entries since the switch to git)
-# and insert it into the directory we're about to use to create a tarball.
-.PHONY: gen-AUTHORS
-gen-AUTHORS:
-	$(AM_V_GEN)\
-	if test -d $(srcdir)/.git; then \
-	  ( \
-	    cd $(srcdir) && \
-	    git log --pretty=format:'    %aN <%aE>' | sort -u \
-	  ) > all.list && \
-	  sort -u $(srcdir)/AUTHORS.in > maint.list && \
-	  comm -23 all.list maint.list > contrib.list && \
-	  contrib="`cat contrib.list`" && \
-	  perl -p -e "s/#contributorslist#// and print '$$contrib'" \
-	    < $(srcdir)/AUTHORS.in > $(distdir)/AUTHORS-tmp && \
-	  mv -f $(distdir)/AUTHORS-tmp $(distdir)/AUTHORS && \
-	  rm -f all.list maint.list contrib.list; \
-	fi
-
-# E501: (line too long) warning is ignored.
-.PHONY: flake8
-flake8:
-	$(FLAKE8) --show-source --ignore=E501 $(srcdir)
-
-syntax-check: flake8
diff --git a/README.md b/README.md
index 66aa6f6..e365650 100644
--- a/README.md
+++ b/README.md
@@ -32,21 +32,19 @@ The packages required to build libvirt-dbus are
 Installation
 ------------
 
-libvirt-dbus uses GNU Autotools build system, so the build & install
+libvirt-dbus uses Meson build system, so the build & install
 process is fairly simple. For example, to install as root user:
 
 ```
-# ./configure --prefix=/usr --sysconfigdir=/etc --localstatedir=/var
-# make
-# make install
+# meson build --prefix=/usr --sysconfigdir=/etc --localstatedir=/var
+# ninja -C build install
 ```
 
 or to install as unprivileged user:
 
 ```
-$ ./configure --prefix=$HOME/usr
-$ make
-$ make install
+$ meson build --prefix=$HOME/usr
+$ ninja -C build install
 ```
 
 
diff --git a/autogen.sh b/autogen.sh
deleted file mode 100755
index 6f29899..0000000
--- a/autogen.sh
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/bin/sh
-# Run this to generate all the initial makefiles, etc.
-
-set -e
-srcdir=`dirname $0`
-test -z "$srcdir" && srcdir=.
-
-THEDIR=`pwd`
-cd $srcdir
-
-DIE=0
-
-for prog in autoreconf automake autoconf libtoolize
-do
-    ($prog --version) < /dev/null > /dev/null 2>&1 || {
-        echo
-        echo "You must have $prog installed to compile libvirt-dbus."
-        DIE=1
-    }
-done
-
-if test "$DIE" -eq 1; then
-        exit 1
-fi
-
-if test -z "$*"; then
-        echo "I am going to run ./configure with no args - if you "
-        echo "wish to pass any extra arguments to it, please specify them on "
-        echo "the $0 command line."
-fi
-
-mkdir -p build-aux
-autoreconf -if
-
-cd $THEDIR
-
-if test "x$1" = "x--system"; then
-    shift
-    prefix=/usr
-    libdir=$prefix/lib
-    sysconfdir=/etc
-    localstatedir=/var
-    if [ -d /usr/lib64 ]; then
-      libdir=$prefix/lib64
-    fi
-    EXTRA_ARGS="--prefix=$prefix --sysconfdir=$sysconfdir --localstatedir=$localstatedir --libdir=$libdir"
-fi
-
-$srcdir/configure $EXTRA_ARGS "$@" && {
-    echo
-    echo "Now type 'make' to compile libvirt-dbus."
-}
diff --git a/configure.ac b/configure.ac
deleted file mode 100644
index 24ebb26..0000000
--- a/configure.ac
+++ /dev/null
@@ -1,87 +0,0 @@
-AC_INIT([libvirt-dbus], [1.4.0], [libvir-list@redhat.com], [], [https://libvirt.org])
-
-AC_CONFIG_SRCDIR([src/main.c])
-AC_CONFIG_AUX_DIR([build-aux])
-AC_CONFIG_HEADERS([config.h])
-AC_CONFIG_MACRO_DIR([m4])
-dnl Make automake keep quiet about wildcards & other GNUmake-isms
-AM_INIT_AUTOMAKE([foreign -Wno-portability -Wno-obsolete subdir-objects tar-pax no-dist-gzip dist-xz])
-AC_CANONICAL_HOST
-AC_USE_SYSTEM_EXTENSIONS
-
-AM_SILENT_RULES([yes])
-
-GLIB2_REQUIRED=2.44.0
-LIBVIRT_REQUIRED=3.0.0
-LIBVIRT_GLIB_REQUIRED=0.0.7
-AC_SUBST([GLIB2_REQUIRED]) dnl used in the .spec file
-AC_SUBST([LIBVIRT_REQUIRED]) dnl used in the .spec file
-AC_SUBST([LIBVIRT_GLIB_REQUIRED]) dnl used in the .spec file
-
-LIBVIRT_DBUS_MAJOR_VERSION=`echo $VERSION | awk -F. '{print $1}'`
-LIBVIRT_DBUS_MINOR_VERSION=`echo $VERSION | awk -F. '{print $2}'`
-LIBVIRT_DBUS_MICRO_VERSION=`echo $VERSION | awk -F. '{print $3}'`
-LIBVIRT_DBUS_VERSION=$LIBVIRT_DBUS_MAJOR_VERSION.$LIBVIRT_DBUS_MINOR_VERSION.$LIBVIRT_DBUS_MICRO_VERSION$LIBVIRT_DBUS_MICRO_VERSION_SUFFIX
-LIBVIRT_DBUS_VERSION_NUMBER=`expr $LIBVIRT_DBUS_MAJOR_VERSION \* 1000000 + $LIBVIRT_dbus_MINOR_VERSION \* 1000 + $LIBVIRT_DBUS_MICRO_VERSION`
-
-AC_SUBST([LIBVIRT_DBUS_MAJOR_VERSION])
-AC_SUBST([LIBVIRT_DBUS_MINOR_VERSION])
-AC_SUBST([LIBVIRT_DBUS_MICRO_VERSION])
-AC_SUBST([LIBVIRT_DBUS_VERSION])
-AC_SUBST([LIBVIRT_DBUS_VERSION_INFO])
-AC_SUBST([LIBVIRT_DBUS_VERSION_NUMBER])
-
-AC_PROG_CC
-AC_PROG_MKDIR_P
-AM_PROG_CC_C_O
-AC_PROG_CC_STDC
-AC_PROG_LIBTOOL
-AC_PATH_PROGS([FLAKE8], [flake8 flake8-3.6])
-
-PKG_CHECK_MODULES([GIO2], [gio-unix-2.0 >= $GLIB2_REQUIRED])
-PKG_CHECK_MODULES([GLIB2], [glib-2.0 >= $GLIB2_REQUIRED])
-PKG_CHECK_MODULES([LIBVIRT], [libvirt >= $LIBVIRT_REQUIRED])
-PKG_CHECK_MODULES([LIBVIRT_GLIB], [libvirt-glib-1.0 >= $LIBVIRT_GLIB_REQUIRED])
-
-LIBVIRT_COMPILE_WARNINGS
-LIBVIRT_LINKER_RELRO
-LIBVIRT_COMPILE_PIE
-
-LIBVIRT_ARG_WITH([DBUS_SERVICES], [where D-Bus session services direcotry is],
-                 ['$(datadir)/dbus-1/services'])
-DBUS_SERVICES_DIR="$with_dbus_services"
-AC_SUBST([DBUS_SERVICES_DIR])
-
-LIBVIRT_ARG_WITH([DBUS_SYSTEM_SERVICES], [where D-Bus system services directory is],
-                 ['$(datadir)/dbus-1/system-services'])
-DBUS_SYSTEM_SERVICES_DIR="$with_dbus_system_services"
-AC_SUBST([DBUS_SYSTEM_SERVICES_DIR])
-
-LIBVIRT_ARG_WITH([DBUS_SYSTEM_POLICIES], [where D-Bus system policies directory is],
-                 ['$(datadir)/dbus-1/system.d'])
-DBUS_SYSTEM_POLICIES_DIR="$with_dbus_system_policies"
-AC_SUBST([DBUS_SYSTEM_POLICIES_DIR])
-
-LIBVIRT_ARG_WITH([DBUS_INTERFACES], [where D-Bus interfaces directory is],
-                 ['$(datadir)/dbus-1/interfaces'])
-DBUS_INTERFACES_DIR="$with_dbus_interfaces"
-AC_SUBST([DBUS_INTERFACES_DIR])
-
-LIBVIRT_ARG_WITH([POLKIT_RULES], [directory for polkit rules],
-                 ['$(datadir)/polkit-1/rules.d'])
-POLKIT_RULES_DIR="$with_polkit_rules"
-AC_SUBST([POLKIT_RULES_DIR])
-
-LIBVIRT_ARG_WITH([SYSTEM_USER], [username to run system instance as],
-                 ['libvirtdbus'])
-SYSTEM_USER=$with_system_user
-AC_SUBST([SYSTEM_USER])
-
-AC_CONFIG_FILES([run],
-                [chmod +x,-w run])
-AC_OUTPUT([Makefile
-           data/Makefile
-           docs/Makefile
-           src/Makefile
-           tests/Makefile
-           libvirt-dbus.spec])
diff --git a/data/Makefile.am b/data/Makefile.am
deleted file mode 100644
index f8311bd..0000000
--- a/data/Makefile.am
+++ /dev/null
@@ -1,83 +0,0 @@
-service_in_files = \
-	session/org.libvirt.service.in \
-	$(NULL)
-servicedir = $(DBUS_SERVICES_DIR)
-service_DATA = \
-	$(service_in_files:.service.in=.service) \
-	$(NULL)
-
-system_service_in_files = \
-	system/org.libvirt.service.in \
-	$(NULL)
-system_servicedir = $(DBUS_SYSTEM_SERVICES_DIR)
-system_service_DATA = \
-	$(system_service_in_files:.service.in=.service) \
-	$(NULL)
-
-system_policy_in_files = \
-	system/org.libvirt.conf.in \
-	$(NULL)
-system_policydir = $(DBUS_SYSTEM_POLICIES_DIR)
-system_policy_DATA = \
-	$(system_policy_in_files:.conf.in=.conf) \
-	$(NULL)
-
-polkit_in_files = \
-	system/libvirt-dbus.rules.in \
-	$(NULL)
-polkitdir = $(POLKIT_RULES_DIR)
-polkit_DATA = \
-	$(polkit_in_files:.rules.in=.rules) \
-	$(NULL)
-
-interfaces_files = \
-	org.libvirt.Connect.xml \
-	org.libvirt.Domain.xml \
-	org.libvirt.Interface.xml \
-	org.libvirt.Network.xml \
-	org.libvirt.NodeDevice.xml \
-	org.libvirt.NWFilter.xml \
-	org.libvirt.Secret.xml \
-	org.libvirt.StoragePool.xml \
-	org.libvirt.StorageVol.xml \
-	$(NULL)
-interfacesdir = $(DBUS_INTERFACES_DIR)
-interfaces_DATA = \
-	$(interfaces_files) \
-	$(NULL)
-
-EXTRA_DIST = \
-	$(service_in_files) \
-	$(system_service_in_files) \
-	$(system_policy_in_files) \
-	$(polkit_in_files) \
-	$(interfaces_files) \
-	$(NULL)
-
-CLEANFILES = \
-	$(service_DATA) \
-	$(system_service_DATA) \
-	$(system_policy_DATA) \
-	$(polkit_DATA) \
-	$(NULL)
-
-session/org.libvirt.service: session/org.libvirt.service.in
-	$(AM_V_GEN)$(MKDIR_P) session && \
-		sed -e 's|[@]sbindir[@]|$(sbindir)|g' < $< > $@-t && \
-			mv $@-t $@
-
-system/org.libvirt.service: system/org.libvirt.service.in
-	$(AM_V_GEN)$(MKDIR_P) system && \
-		sed -e 's|[@]sbindir[@]|$(sbindir)|g' \
-		    -e 's|[@]SYSTEM_USER[@]|$(SYSTEM_USER)|' \
-			< $< > $@-t && mv $@-t $@
-
-system/org.libvirt.conf: system/org.libvirt.conf.in
-	$(AM_V_GEN)$(MKDIR_P) system && \
-		sed -e 's|[@]SYSTEM_USER[@]|$(SYSTEM_USER)|' \
-			< $< > $@-t && mv $@-t $@
-
-system/libvirt-dbus.rules: system/libvirt-dbus.rules.in
-	$(AM_V_GEN)$(MKDIR_P) system && \
-		sed -e 's|[@]SYSTEM_USER[@]|$(SYSTEM_USER)|' \
-			< $< > $@-t && mv $@-t $@
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..42a6799
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,15 @@
+install_data(
+    'org.libvirt.Connect.xml',
+    'org.libvirt.Domain.xml',
+    'org.libvirt.Interface.xml',
+    'org.libvirt.Network.xml',
+    'org.libvirt.NodeDevice.xml',
+    'org.libvirt.NWFilter.xml',
+    'org.libvirt.Secret.xml',
+    'org.libvirt.StoragePool.xml',
+    'org.libvirt.StorageVol.xml',
+    install_dir: dbus_interfaces_dir,
+)
+
+subdir('session')
+subdir('system')
diff --git a/data/session/meson.build b/data/session/meson.build
new file mode 100644
index 0000000..240fcef
--- /dev/null
+++ b/data/session/meson.build
@@ -0,0 +1,6 @@
+configure_file(
+    configuration: conf,
+    input: 'org.libvirt.service.in',
+    output: 'org.libvirt.service',
+    install_dir: dbus_services_dir,
+)
diff --git a/data/system/meson.build b/data/system/meson.build
new file mode 100644
index 0000000..74f1949
--- /dev/null
+++ b/data/system/meson.build
@@ -0,0 +1,18 @@
+configure_file(
+    configuration: conf,
+    input: 'org.libvirt.service.in',
+    output: 'org.libvirt.service',
+    install_dir: dbus_system_services_dir,
+)
+configure_file(
+    configuration: conf,
+    input: 'org.libvirt.conf.in',
+    output: 'org.libvirt.conf',
+    install_dir: dbus_system_policies_dir,
+)
+configure_file(
+    configuration: conf,
+    input: 'libvirt-dbus.rules.in',
+    output: 'libvirt-dbus.rules',
+    install_dir: polkit_rules_dir,
+)
diff --git a/docs/Makefile.am b/docs/Makefile.am
deleted file mode 100644
index fe8ca1c..0000000
--- a/docs/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-POD2MAN = pod2man -c "Virtualization Support" -r "$(PACKAGE)-$(VERSION)"
-
-PODFILES = \
-	libvirt-dbus.pod \
-	$(NULL)
-
-%.8: %.pod
-	$(AM_V_GEN)$(POD2MAN) -s 8 $< $@ \
-		&& if grep 'POD ERROR' $@; then rm $@; exit 1; fi
-
-man8_MANS = \
-	libvirt-dbus.8 \
-	$(NULL)
-
-EXTRA_DIST = \
-	$(PODFILES) \
-	$(NULL)
-
-CLEANFILES = \
-	$(man8_MANS) \
-	$(NULL)
diff --git a/docs/meson.build b/docs/meson.build
new file mode 100644
index 0000000..e62e71a
--- /dev/null
+++ b/docs/meson.build
@@ -0,0 +1,8 @@
+prog_pod2man = find_program('pod2man')
+
+configure_file(
+    command: [prog_pod2man.path(), '-s 8', '@INPUT@', '@OUTPUT@'],
+    input: 'libvirt-dbus.pod',
+    output: 'libvirt-dbus.8',
+    install_dir: join_paths (get_option('mandir'), 'man8'),
+)
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}
diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4
deleted file mode 100644
index 0f06ade..0000000
--- a/m4/manywarnings.m4
+++ /dev/null
@@ -1,276 +0,0 @@
-# manywarnings.m4 serial 8
-dnl Copyright (C) 2008-2017 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl From Simon Josefsson
-
-# gl_MANYWARN_COMPLEMENT(OUTVAR, LISTVAR, REMOVEVAR)
-# --------------------------------------------------
-# Copy LISTVAR to OUTVAR except for the entries in REMOVEVAR.
-# Elements separated by whitespace.  In set logic terms, the function
-# does OUTVAR = LISTVAR \ REMOVEVAR.
-AC_DEFUN([gl_MANYWARN_COMPLEMENT],
-[
-  gl_warn_set=
-  set x $2; shift
-  for gl_warn_item
-  do
-    case " $3 " in
-      *" $gl_warn_item "*)
-        ;;
-      *)
-        gl_warn_set="$gl_warn_set $gl_warn_item"
-        ;;
-    esac
-  done
-  $1=$gl_warn_set
-])
-
-# gl_MANYWARN_ALL_GCC(VARIABLE)
-# -----------------------------
-# Add all documented GCC warning parameters to variable VARIABLE.
-# Note that you need to test them using gl_WARN_ADD if you want to
-# make sure your gcc understands it.
-AC_DEFUN([gl_MANYWARN_ALL_GCC],
-[
-  dnl First, check for some issues that only occur when combining multiple
-  dnl gcc warning categories.
-  AC_REQUIRE([AC_PROG_CC])
-  if test -n "$GCC"; then
-
-    dnl Check if -W -Werror -Wno-missing-field-initializers is supported
-    dnl with the current $CC $CFLAGS $CPPFLAGS.
-    AC_MSG_CHECKING([whether -Wno-missing-field-initializers is supported])
-    AC_CACHE_VAL([gl_cv_cc_nomfi_supported], [
-      gl_save_CFLAGS="$CFLAGS"
-      CFLAGS="$CFLAGS -W -Werror -Wno-missing-field-initializers"
-      AC_COMPILE_IFELSE(
-        [AC_LANG_PROGRAM([[]], [[]])],
-        [gl_cv_cc_nomfi_supported=yes],
-        [gl_cv_cc_nomfi_supported=no])
-      CFLAGS="$gl_save_CFLAGS"])
-    AC_MSG_RESULT([$gl_cv_cc_nomfi_supported])
-
-    if test "$gl_cv_cc_nomfi_supported" = yes; then
-      dnl Now check whether -Wno-missing-field-initializers is needed
-      dnl for the { 0, } construct.
-      AC_MSG_CHECKING([whether -Wno-missing-field-initializers is needed])
-      AC_CACHE_VAL([gl_cv_cc_nomfi_needed], [
-        gl_save_CFLAGS="$CFLAGS"
-        CFLAGS="$CFLAGS -W -Werror"
-        AC_COMPILE_IFELSE(
-          [AC_LANG_PROGRAM(
-             [[int f (void)
-               {
-                 typedef struct { int a; int b; } s_t;
-                 s_t s1 = { 0, };
-                 return s1.b;
-               }
-             ]],
-             [[]])],
-          [gl_cv_cc_nomfi_needed=no],
-          [gl_cv_cc_nomfi_needed=yes])
-        CFLAGS="$gl_save_CFLAGS"
-      ])
-      AC_MSG_RESULT([$gl_cv_cc_nomfi_needed])
-    fi
-
-    dnl Next, check if -Werror -Wuninitialized is useful with the
-    dnl user's choice of $CFLAGS; some versions of gcc warn that it
-    dnl has no effect if -O is not also used
-    AC_MSG_CHECKING([whether -Wuninitialized is supported])
-    AC_CACHE_VAL([gl_cv_cc_uninitialized_supported], [
-      gl_save_CFLAGS="$CFLAGS"
-      CFLAGS="$CFLAGS -Werror -Wuninitialized"
-      AC_COMPILE_IFELSE(
-        [AC_LANG_PROGRAM([[]], [[]])],
-        [gl_cv_cc_uninitialized_supported=yes],
-        [gl_cv_cc_uninitialized_supported=no])
-      CFLAGS="$gl_save_CFLAGS"])
-    AC_MSG_RESULT([$gl_cv_cc_uninitialized_supported])
-
-  fi
-
-  # List all gcc warning categories.
-  # To compare this list to your installed GCC's, run this Bash command:
-  #
-  # comm -3 \
-  #  <(sed -n 's/^  *\(-[^ ]*\) .*/\1/p' manywarnings.m4 | sort) \
-  #  <(gcc --help=warnings | sed -n 's/^  \(-[^ ]*\) .*/\1/p' | sort |
-  #      grep -v -x -f <(
-  #         awk '/^[^#]/ {print $1}' ../build-aux/gcc-warning.spec))
-
-  gl_manywarn_set=
-  for gl_manywarn_item in \
-    -fno-common \
-    -W \
-    -Wabi \
-    -Waddress \
-    -Waggressive-loop-optimizations \
-    -Wall \
-    -Wattributes \
-    -Wbad-function-cast \
-    -Wbool-compare \
-    -Wbuiltin-macro-redefined \
-    -Wcast-align \
-    -Wchar-subscripts \
-    -Wchkp \
-    -Wclobbered \
-    -Wcomment \
-    -Wcomments \
-    -Wcoverage-mismatch \
-    -Wcpp \
-    -Wdate-time \
-    -Wdeprecated \
-    -Wdeprecated-declarations \
-    -Wdesignated-init \
-    -Wdisabled-optimization \
-    -Wdiscarded-array-qualifiers \
-    -Wdiscarded-qualifiers \
-    -Wdiv-by-zero \
-    -Wdouble-promotion \
-    -Wduplicated-cond \
-    -Wempty-body \
-    -Wendif-labels \
-    -Wenum-compare \
-    -Wextra \
-    -Wformat-contains-nul \
-    -Wformat-extra-args \
-    -Wformat-nonliteral \
-    -Wformat-security \
-    -Wformat-signedness \
-    -Wformat-y2k \
-    -Wformat-zero-length \
-    -Wframe-address \
-    -Wfree-nonheap-object \
-    -Whsa \
-    -Wignored-attributes \
-    -Wignored-qualifiers \
-    -Wimplicit \
-    -Wimplicit-function-declaration \
-    -Wimplicit-int \
-    -Wincompatible-pointer-types \
-    -Winit-self \
-    -Winline \
-    -Wint-conversion \
-    -Wint-to-pointer-cast \
-    -Winvalid-memory-model \
-    -Winvalid-pch \
-    -Wjump-misses-init \
-    -Wlogical-not-parentheses \
-    -Wlogical-op \
-    -Wmain \
-    -Wmaybe-uninitialized \
-    -Wmemset-transposed-args \
-    -Wmisleading-indentation \
-    -Wmissing-braces \
-    -Wmissing-declarations \
-    -Wmissing-field-initializers \
-    -Wmissing-include-dirs \
-    -Wmissing-parameter-type \
-    -Wmissing-prototypes \
-    -Wmultichar \
-    -Wnarrowing \
-    -Wnested-externs \
-    -Wnonnull \
-    -Wnonnull-compare \
-    -Wnull-dereference \
-    -Wodr \
-    -Wold-style-declaration \
-    -Wold-style-definition \
-    -Wopenmp-simd \
-    -Woverflow \
-    -Woverlength-strings \
-    -Woverride-init \
-    -Wpacked \
-    -Wpacked-bitfield-compat \
-    -Wparentheses \
-    -Wpointer-arith \
-    -Wpointer-sign \
-    -Wpointer-to-int-cast \
-    -Wpragmas \
-    -Wreturn-local-addr \
-    -Wreturn-type \
-    -Wscalar-storage-order \
-    -Wsequence-point \
-    -Wshadow \
-    -Wshift-count-negative \
-    -Wshift-count-overflow \
-    -Wshift-negative-value \
-    -Wsizeof-array-argument \
-    -Wsizeof-pointer-memaccess \
-    -Wstack-protector \
-    -Wstrict-aliasing \
-    -Wstrict-overflow \
-    -Wstrict-prototypes \
-    -Wsuggest-attribute=const \
-    -Wsuggest-attribute=format \
-    -Wsuggest-attribute=noreturn \
-    -Wsuggest-attribute=pure \
-    -Wsuggest-final-methods \
-    -Wsuggest-final-types \
-    -Wswitch \
-    -Wswitch-bool \
-    -Wswitch-default \
-    -Wsync-nand \
-    -Wsystem-headers \
-    -Wtautological-compare \
-    -Wtrampolines \
-    -Wtrigraphs \
-    -Wtype-limits \
-    -Wuninitialized \
-    -Wunknown-pragmas \
-    -Wunsafe-loop-optimizations \
-    -Wunused \
-    -Wunused-but-set-parameter \
-    -Wunused-but-set-variable \
-    -Wunused-function \
-    -Wunused-label \
-    -Wunused-local-typedefs \
-    -Wunused-macros \
-    -Wunused-parameter \
-    -Wunused-result \
-    -Wunused-value \
-    -Wunused-variable \
-    -Wvarargs \
-    -Wvariadic-macros \
-    -Wvector-operation-performance \
-    -Wvla \
-    -Wvolatile-register-var \
-    -Wwrite-strings \
-    \
-    ; do
-    gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
-  done
-
-  # gcc --help=warnings outputs an unusual form for these options; list
-  # them here so that the above 'comm' command doesn't report a false match.
-  gl_manywarn_set="$gl_manywarn_set -Warray-bounds=2"
-  gl_manywarn_set="$gl_manywarn_set -Wnormalized=nfc"
-  gl_manywarn_set="$gl_manywarn_set -Wshift-overflow=2"
-  gl_manywarn_set="$gl_manywarn_set -Wunused-const-variable=2"
-
-  # These are needed for older GCC versions.
-  if test -n "$GCC"; then
-    case `($CC --version) 2>/dev/null` in
-      'gcc (GCC) '[[0-3]].* | \
-      'gcc (GCC) '4.[[0-7]].*)
-        gl_manywarn_set="$gl_manywarn_set -fdiagnostics-show-option"
-        gl_manywarn_set="$gl_manywarn_set -funit-at-a-time"
-          ;;
-    esac
-  fi
-
-  # Disable specific options as needed.
-  if test "$gl_cv_cc_nomfi_needed" = yes; then
-    gl_manywarn_set="$gl_manywarn_set -Wno-missing-field-initializers"
-  fi
-
-  if test "$gl_cv_cc_uninitialized_supported" = no; then
-    gl_manywarn_set="$gl_manywarn_set -Wno-uninitialized"
-  fi
-
-  $1=$gl_manywarn_set
-])
diff --git a/m4/virt-arg.m4 b/m4/virt-arg.m4
deleted file mode 100644
index d626d72..0000000
--- a/m4/virt-arg.m4
+++ /dev/null
@@ -1,154 +0,0 @@
-dnl
-dnl virt-arg.m4: Helper macros for adding configure arguments
-dnl
-dnl Copyright (C) 2012-2014 Red Hat, Inc.
-dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License, or (at your option) any later version.
-dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl Lesser General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library.  If not, see
-dnl <http://www.gnu.org/licenses/>.
-dnl
-
-
-dnl
-dnl To be used instead of AC_ARG_WITH
-dnl
-dnl See LIBVIRT_ARG_WITH_FEATURE if the argument you're adding is going to
-dnl be used for switching a feature on and off.
-dnl
-dnl LIBVIRT_ARG_WITH([CHECK_NAME], [HELP_DESC], [DEFAULT_ACTION])
-dnl
-dnl      CHECK_NAME: Suffix/prefix used for variables/flags, in uppercase.
-dnl       HELP_DESC: Description that will appear in configure --help
-dnl  DEFAULT_ACTION: Default configure action
-dnl
-dnl LIBVIRT_ARG_WITH([PACKAGER], [Extra packager name], [no])
-dnl LIBVIRT_ARG_WITH([HTML_DIR], [path to base html directory], [$(datadir)/doc])
-dnl
-AC_DEFUN([LIBVIRT_ARG_WITH], [
-  m4_pushdef([check_name], [$1])
-  m4_pushdef([help_desc], [[$2]])
-  m4_pushdef([default_action], [$3])
-
-  m4_pushdef([check_name_lc], m4_tolower(check_name))
-  m4_pushdef([check_name_dash], m4_translit(check_name_lc, [_], [-]))
-
-  m4_pushdef([arg_var], [with-]check_name_dash)
-  m4_pushdef([with_var], [with_]check_name_lc)
-
-  m4_divert_text([DEFAULTS], [with_var][[=]][default_action])
-  AC_ARG_WITH([check_name_lc],
-              [AS_HELP_STRING([[--]arg_var],
-                              ]m4_dquote(help_desc)[[ @<:@default=]]m4_dquote(default_action)[[@:>@])])
-
-  m4_popdef([with_var])
-  m4_popdef([arg_var])
-
-  m4_popdef([check_name_dash])
-  m4_popdef([check_name_lc])
-
-  m4_popdef([default_action])
-  m4_popdef([help_desc])
-  m4_popdef([check_name])
-])
-
-dnl
-dnl To be used instead of AC_ARG_WITH
-dnl
-dnl The difference between LIBVIRT_ARG_WITH and this macro is that the former
-dnl is mostly an enhanced drop-in replacement for AC_ARG_WITH, whereas the
-dnl latter is tailored for adding an argument that is going to be used to
-dnl switch a feature on and off: as a consequence, it optionally supports
-dnl specifying the minimum version for libraries the feature depends on and
-dnl automatically builds a suitable description from the feature name.
-dnl
-dnl LIBVIRT_ARG_WITH_FEATURE([CHECK_NAME], [HELP_NAME], [DEFAULT_ACTION], [MIN_VERSION])
-dnl
-dnl      CHECK_NAME: Suffix/prefix used for variables/flags, in uppercase.
-dnl       HELP_NAME: Name that will appear in configure --help
-dnl  DEFAULT_ACTION: Default configure action
-dnl     MIN_VERSION: Specify minimal version that will be added to
-dnl                  configure --help (optional)
-dnl
-dnl LIBVIRT_ARG_WITH_FEATURE([SELINUX], [SeLinux], [check])
-dnl LIBVIRT_ARG_WITH_FEATURE([GLUSTERFS], [glusterfs], [check], [3.4.1])
-dnl
-AC_DEFUN([LIBVIRT_ARG_WITH_FEATURE], [
-  m4_pushdef([check_name], [$1])
-  m4_pushdef([help_name], [[$2]])
-  m4_pushdef([default_action], [$3])
-  m4_pushdef([min_version], [$4])
-
-  m4_pushdef([check_name_lc], m4_tolower(check_name))
-  m4_pushdef([check_name_dash], m4_translit(check_name_lc, [_], [-]))
-
-  m4_pushdef([arg_var], [with-]check_name_dash)
-  m4_pushdef([with_var], [with_]check_name_lc)
-
-  m4_pushdef([version_text], m4_ifnblank(min_version, [[ (>= ]]min_version[[)]]))
-
-  m4_divert_text([DEFAULTS], [with_var][[=]][default_action])
-  AC_ARG_WITH([check_name_lc],
-              [AS_HELP_STRING([[--]arg_var],
-                              [with ]]m4_dquote(help_name)m4_dquote(version_text)[[ support @<:@default=]]m4_dquote(default_action)[[@:>@])])
-
-  m4_popdef([version_text])
-
-  m4_popdef([with_var])
-  m4_popdef([arg_var])
-
-  m4_popdef([check_name_dash])
-  m4_popdef([check_name_lc])
-
-  m4_popdef([min_version])
-  m4_popdef([default_action])
-  m4_popdef([help_name])
-  m4_popdef([check_name])
-])
-
-dnl
-dnl To be used instead of AC_ARG_ENABLE
-dnl
-dnl LIBVIRT_ARG_ENABLE([CHECK_NAME], [HELP_DESC], [DEFAULT_ACTION])
-dnl
-dnl      CHECK_NAME: Suffix/prefix used for variables/flags, in uppercase.
-dnl       HELP_DESC: Description that will appear in configure --help
-dnl  DEFAULT_ACTION: Default configure action
-dnl
-dnl LIBVIRT_ARG_ENABLE([DEBUG], [enable debugging output], [yes])
-dnl
-AC_DEFUN([LIBVIRT_ARG_ENABLE], [
-  m4_pushdef([check_name], [$1])
-  m4_pushdef([help_desc], [[$2]])
-  m4_pushdef([default_action], [$3])
-
-  m4_pushdef([check_name_lc], m4_tolower(check_name))
-  m4_pushdef([check_name_dash], m4_translit(check_name_lc, [_], [-]))
-
-  m4_pushdef([arg_var], [enable-]check_name_dash)
-  m4_pushdef([enable_var], [enable_]check_name_lc)
-
-  m4_divert_text([DEFAULTS], [enable_var][[=]][default_action])
-  AC_ARG_ENABLE([check_name_lc],
-                [AS_HELP_STRING([[--]arg_var],
-                                ]m4_dquote(help_desc)[[ @<:@default=]]m4_dquote(default_action)[[@:>@])])
-
-  m4_popdef([enable_var])
-  m4_popdef([arg_var])
-
-  m4_popdef([check_name_dash])
-  m4_popdef([check_name_lc])
-
-  m4_popdef([default_action])
-  m4_popdef([help_desc])
-  m4_popdef([check_name])
-])
diff --git a/m4/virt-compile-pie.m4 b/m4/virt-compile-pie.m4
deleted file mode 100644
index a2df38e..0000000
--- a/m4/virt-compile-pie.m4
+++ /dev/null
@@ -1,35 +0,0 @@
-dnl
-dnl Check for support for position independent executables
-dnl
-dnl Copyright (C) 2013 Red Hat, Inc.
-dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License, or (at your option) any later version.
-dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl Lesser General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library.  If not, see
-dnl <http://www.gnu.org/licenses/>.
-dnl
-
-AC_DEFUN([LIBVIRT_COMPILE_PIE],[
-    PIE_CFLAGS=
-    PIE_LDFLAGS=
-    case "$host" in
-      *-*-mingw* | *-*-msvc* | *-*-cygwin* )
-         ;; dnl All code is position independent on Win32 target
-      *)
-      gl_COMPILER_OPTION_IF([-fPIE -DPIE -pie], [
-        PIE_CFLAGS="-fPIE -DPIE"
-        PIE_LDFLAGS="-pie"
-      ])
-    esac
-    AC_SUBST([PIE_CFLAGS])
-    AC_SUBST([PIE_LDFLAGS])
-])
diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
deleted file mode 100644
index 6ece136..0000000
--- a/m4/virt-compile-warnings.m4
+++ /dev/null
@@ -1,203 +0,0 @@
-dnl
-dnl Enable all known GCC compiler warnings, except for those
-dnl we can't yet cope with
-dnl
-AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
-    dnl ******************************
-    dnl More compiler warnings
-    dnl ******************************
-
-    LIBVIRT_ARG_ENABLE([WERROR], [Use -Werror (if supported)], [check])
-    if test "$enable_werror" = "check"; then
-        if test -d $srcdir/.git; then
-            is_git_version=true
-            enable_werror=yes
-        else
-            enable_werror=no
-        fi
-    fi
-
-    # List of warnings that are not relevant / wanted
-
-    # Don't care about C++ compiler compat
-    dontwarn="$dontwarn -Wc++-compat"
-    dontwarn="$dontwarn -Wabi"
-    dontwarn="$dontwarn -Wdeprecated"
-    # Don't care about ancient C standard compat
-    dontwarn="$dontwarn -Wtraditional"
-    # Don't care about ancient C standard compat
-    dontwarn="$dontwarn -Wtraditional-conversion"
-    # Ignore warnings in /usr/include
-    dontwarn="$dontwarn -Wsystem-headers"
-    # Happy for compiler to add struct padding
-    dontwarn="$dontwarn -Wpadded"
-    # GCC very confused with -O2
-    dontwarn="$dontwarn -Wunreachable-code"
-    # Too many to deal with
-    dontwarn="$dontwarn -Wconversion"
-    # Too many to deal with
-    dontwarn="$dontwarn -Wsign-conversion"
-    # We need to use long long in many places
-    dontwarn="$dontwarn -Wlong-long"
-    # We allow manual list of all enum cases without default:
-    dontwarn="$dontwarn -Wswitch-default"
-    # We allow optional default: instead of listing all enum values
-    dontwarn="$dontwarn -Wswitch-enum"
-    # Not a problem since we don't use -fstrict-overflow
-    dontwarn="$dontwarn -Wstrict-overflow"
-    # Not a problem since we don't use -funsafe-loop-optimizations
-    dontwarn="$dontwarn -Wunsafe-loop-optimizations"
-    # gcc 4.4.6 complains this is C++ only; gcc 4.7.0 implies this from -Wall
-    dontwarn="$dontwarn -Wenum-compare"
-    # gcc 5.1 -Wformat-signedness mishandles enums, not ready for prime time
-    dontwarn="$dontwarn -Wformat-signedness"
-    # Several conditionals expand the same on both branches
-    # depending on the particular platform/architecture
-    dontwarn="$dontwarn -Wduplicated-branches"
-    # > This warning does not generally indicate that there is anything wrong
-    # > with your code; it merely indicates that GCC's optimizers are unable
-    # > to handle the code effectively.
-    # Source: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
-    dontwarn="$dontwarn -Wdisabled-optimization"
-
-    # gcc 4.2 treats attribute(format) as an implicit attribute(nonnull),
-    # which triggers spurious warnings for our usage
-    AC_CACHE_CHECK([whether the C compiler's -Wformat allows NULL strings],
-      [lv_cv_gcc_wformat_null_works], [
-      save_CFLAGS=$CFLAGS
-      CFLAGS='-Wunknown-pragmas -Werror -Wformat'
-      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-        #include <stddef.h>
-        static __attribute__ ((__format__ (__printf__, 1, 2))) int
-        foo (const char *fmt, ...) { return !fmt; }
-      ]], [[
-        return foo(NULL);
-      ]])],
-      [lv_cv_gcc_wformat_null_works=yes],
-      [lv_cv_gcc_wformat_null_works=no])
-      CFLAGS=$save_CFLAGS])
-
-    AC_CACHE_CHECK([whether gcc gives bogus warnings for -Wlogical-op],
-      [lv_cv_gcc_wlogical_op_equal_expr_broken], [
-        save_CFLAGS="$CFLAGS"
-        CFLAGS="-O2 -Wlogical-op -Werror"
-        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-          #define TEST1 1
-          #define TEST2 TEST1
-        ]], [[
-          int test = 0;
-          return test == TEST1 || test == TEST2;]])],
-        [lv_cv_gcc_wlogical_op_equal_expr_broken=no],
-        [lv_cv_gcc_wlogical_op_equal_expr_broken=yes])
-        CFLAGS="$save_CFLAGS"])
-
-    AC_CACHE_CHECK([whether clang gives bogus warnings for -Wdouble-promotion],
-      [lv_cv_clang_double_promotion_broken], [
-        save_CFLAGS="$CFLAGS"
-        CFLAGS="-O2 -Wdouble-promotion -Werror"
-        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-          #include <math.h>
-        ]], [[
-          float f = 0.0;
-	  return isnan(f);]])],
-        [lv_cv_clang_double_promotion_broken=no],
-        [lv_cv_clang_double_promotion_broken=yes])
-        CFLAGS="$save_CFLAGS"])
-
-    if test "$lv_cv_clang_double_promotion_broken" = "yes";
-    then
-      dontwarn="$dontwarn -Wdouble-promotion"
-    fi
-
-    # Get all possible GCC warnings
-    gl_MANYWARN_ALL_GCC([maybewarn])
-
-    # Remove the ones we don't want, blacklisted earlier
-    gl_MANYWARN_COMPLEMENT([wantwarn], [$maybewarn], [$dontwarn])
-
-    # GNULIB expects this to be part of -Wc++-compat, but we turn
-    # that one off, so we need to manually enable this again
-    wantwarn="$wantwarn -Wjump-misses-init"
-
-    # -Wformat enables this by default, and we should keep it,
-    # but need to rewrite various areas of code first
-    wantwarn="$wantwarn -Wno-format-truncation"
-
-    # This should be < 256 really. Currently we're down to 4096,
-    # but using 1024 bytes sized buffers (mostly for virStrerror)
-    # stops us from going down further
-    gl_WARN_ADD([-Wframe-larger-than=4096], [STRICT_FRAME_LIMIT_CFLAGS])
-    gl_WARN_ADD([-Wframe-larger-than=25600], [RELAXED_FRAME_LIMIT_CFLAGS])
-
-    # Extra special flags
-    dnl -fstack-protector stuff passes gl_WARN_ADD with gcc
-    dnl on Mingw32, but fails when actually used
-    case $host in
-       aarch64-*-*)
-       dnl "error: -fstack-protector not supported for this target [-Werror]"
-       ;;
-       *-*-linux*)
-       dnl Prefer -fstack-protector-strong if it's available.
-       dnl There doesn't seem to be great overhead in adding
-       dnl -fstack-protector-all instead of -fstack-protector.
-       dnl
-       dnl We also don't need ssp-buffer-size with -all or -strong,
-       dnl since functions are protected regardless of buffer size.
-       dnl wantwarn="$wantwarn --param=ssp-buffer-size=4"
-       wantwarn="$wantwarn -fstack-protector-strong"
-       ;;
-       *-*-freebsd*)
-       dnl FreeBSD ships old gcc 4.2.1 which doesn't handle
-       dnl -fstack-protector-all well
-       wantwarn="$wantwarn -fstack-protector"
-
-       wantwarn="$wantwarn -Wno-unused-command-line-argument"
-       ;;
-    esac
-    wantwarn="$wantwarn -fexceptions"
-    wantwarn="$wantwarn -fasynchronous-unwind-tables"
-
-    # Need -fipa-pure-const in order to make -Wsuggest-attribute=pure
-    # fire even without -O.
-    wantwarn="$wantwarn -fipa-pure-const"
-    # We do "bad" function cast to define glib auto cleanup functions
-    wantwarn="$wantwarn -Wno-cast-function-type"
-
-    if test "$enable_werror" = "yes"
-    then
-      wantwarn="$wantwarn -Werror"
-    fi
-
-    # Check for $CC support of each warning
-    for w in $wantwarn; do
-      gl_WARN_ADD([$w])
-    done
-
-    case $host in
-        *-*-linux*)
-        dnl Fall back to -fstack-protector-all if -strong is not available
-        case $WARN_CFLAGS in
-        *-fstack-protector-strong*)
-        ;;
-        *)
-            gl_WARN_ADD([-fstack-protector-all])
-        ;;
-        esac
-        ;;
-    esac
-
-    case $WARN_CFLAGS in
-        *-Wsuggest-attribute=format*)
-           AC_DEFINE([HAVE_SUGGEST_ATTRIBUTE_FORMAT], [1], [Whether -Wsuggest-attribute=format works])
-        ;;
-    esac
-
-    # Silence certain warnings in gnulib, and use improved glibc headers
-    AH_VERBATIM([FORTIFY_SOURCE],
-    [/* Enable compile-time and run-time bounds-checking, and some warnings,
-        without upsetting newer glibc. */
-     #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__
-     # define _FORTIFY_SOURCE 2
-     #endif
-    ])
-])
diff --git a/m4/virt-linker-relro.m4 b/m4/virt-linker-relro.m4
deleted file mode 100644
index 7669b23..0000000
--- a/m4/virt-linker-relro.m4
+++ /dev/null
@@ -1,35 +0,0 @@
-dnl
-dnl Check for -z now and -z relro linker flags
-dnl
-dnl Copyright (C) 2013 Red Hat, Inc.
-dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License, or (at your option) any later version.
-dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl Lesser General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library.  If not, see
-dnl <http://www.gnu.org/licenses/>.
-dnl
-
-AC_DEFUN([LIBVIRT_LINKER_RELRO],[
-    AC_MSG_CHECKING([for how to force completely read-only GOT table])
-
-    RELRO_LDFLAGS=
-    ld_help=`ld --help 2>&1`
-    case $ld_help in
-        *"-z relro"*) RELRO_LDFLAGS="-Wl,-z -Wl,relro" ;;
-    esac
-    case $ld_help in
-        *"-z now"*) RELRO_LDFLAGS="$RELRO_LDFLAGS -Wl,-z -Wl,now" ;;
-    esac
-    AC_SUBST([RELRO_LDFLAGS])
-
-    AC_MSG_RESULT([$RELRO_LDFLAGS])
-])
diff --git a/m4/warnings.m4 b/m4/warnings.m4
deleted file mode 100644
index e697174..0000000
--- a/m4/warnings.m4
+++ /dev/null
@@ -1,79 +0,0 @@
-# warnings.m4 serial 11
-dnl Copyright (C) 2008-2017 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl From Simon Josefsson
-
-# gl_AS_VAR_APPEND(VAR, VALUE)
-# ----------------------------
-# Provide the functionality of AS_VAR_APPEND if Autoconf does not have it.
-m4_ifdef([AS_VAR_APPEND],
-[m4_copy([AS_VAR_APPEND], [gl_AS_VAR_APPEND])],
-[m4_define([gl_AS_VAR_APPEND],
-[AS_VAR_SET([$1], [AS_VAR_GET([$1])$2])])])
-
-
-# gl_COMPILER_OPTION_IF(OPTION, [IF-SUPPORTED], [IF-NOT-SUPPORTED],
-#                       [PROGRAM = AC_LANG_PROGRAM()])
-# -----------------------------------------------------------------
-# Check if the compiler supports OPTION when compiling PROGRAM.
-#
-# FIXME: gl_Warn must be used unquoted until we can assume Autoconf
-# 2.64 or newer.
-AC_DEFUN([gl_COMPILER_OPTION_IF],
-[AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_[]_AC_LANG_ABBREV[]_$1])dnl
-AS_VAR_PUSHDEF([gl_Flags], [_AC_LANG_PREFIX[]FLAGS])dnl
-AS_LITERAL_IF([$1],
-  [m4_pushdef([gl_Positive], m4_bpatsubst([$1], [^-Wno-], [-W]))],
-  [gl_positive="$1"
-case $gl_positive in
-  -Wno-*) gl_positive=-W`expr "X$gl_positive" : 'X-Wno-\(.*\)'` ;;
-esac
-m4_pushdef([gl_Positive], [$gl_positive])])dnl
-AC_CACHE_CHECK([whether _AC_LANG compiler handles $1], m4_defn([gl_Warn]), [
-  gl_save_compiler_FLAGS="$gl_Flags"
-  gl_AS_VAR_APPEND(m4_defn([gl_Flags]),
-    [" $gl_unknown_warnings_are_errors ]m4_defn([gl_Positive])["])
-  AC_LINK_IFELSE([m4_default([$4], [AC_LANG_PROGRAM([])])],
-                 [AS_VAR_SET(gl_Warn, [yes])],
-                 [AS_VAR_SET(gl_Warn, [no])])
-  gl_Flags="$gl_save_compiler_FLAGS"
-])
-AS_VAR_IF(gl_Warn, [yes], [$2], [$3])
-m4_popdef([gl_Positive])dnl
-AS_VAR_POPDEF([gl_Flags])dnl
-AS_VAR_POPDEF([gl_Warn])dnl
-])
-
-# gl_UNKNOWN_WARNINGS_ARE_ERRORS
-# ------------------------------
-# Clang doesn't complain about unknown warning options unless one also
-# specifies -Wunknown-warning-option -Werror.  Detect this.
-AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS],
-[gl_COMPILER_OPTION_IF([-Werror -Wunknown-warning-option],
-   [gl_unknown_warnings_are_errors='-Wunknown-warning-option -Werror'],
-   [gl_unknown_warnings_are_errors=])])
-
-# gl_WARN_ADD(OPTION, [VARIABLE = WARN_CFLAGS],
-#             [PROGRAM = AC_LANG_PROGRAM()])
-# ---------------------------------------------
-# Adds parameter to WARN_CFLAGS if the compiler supports it when
-# compiling PROGRAM.  For example, gl_WARN_ADD([-Wparentheses]).
-#
-# If VARIABLE is a variable name, AC_SUBST it.
-AC_DEFUN([gl_WARN_ADD],
-[AC_REQUIRE([gl_UNKNOWN_WARNINGS_ARE_ERRORS])
-gl_COMPILER_OPTION_IF([$1],
-  [gl_AS_VAR_APPEND(m4_if([$2], [], [[WARN_CFLAGS]], [[$2]]), [" $1"])],
-  [],
-  [$3])
-m4_ifval([$2],
-         [AS_LITERAL_IF([$2], [AC_SUBST([$2])])],
-         [AC_SUBST([WARN_CFLAGS])])dnl
-])
-
-# Local Variables:
-# mode: autoconf
-# End:
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..30eeebe
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,279 @@
+project(
+    'libvirt-dbus', 'c',
+    version: '1.4.0',
+    license: 'LGPLv2+',
+    meson_version: '>= 0.49.0',
+    default_options: [
+        'buildtype=debugoptimized',
+        'c_std=gnu99',
+    ],
+)
+
+
+conf = configuration_data()
+conf.set('MESON_VERSION', '0.49.0')
+conf.set('PACKAGE', meson.project_name())
+conf.set('VERSION', meson.project_version())
+conf.set('build_root', meson.build_root())
+conf.set('sbindir', get_option('sbindir'))
+conf.set('source_root', meson.source_root())
+
+# Dependencies
+
+glib2_version = '2.44.0'
+libvirt_version = '3.0.0'
+libvirt_glib_version = '0.0.7'
+
+dep_gio_unix = dependency('gio-unix-2.0', version: '>=' + glib2_version)
+dep_glib = dependency('glib-2.0', version: '>=' + glib2_version)
+dep_libvirt = dependency('libvirt', version: '>=' + libvirt_version)
+dep_libvirt_glib = dependency('libvirt-glib-1.0', version: '>=' + libvirt_glib_version)
+
+conf.set('GLIB2_REQUIRED', glib2_version)
+conf.set('LIBVIRT_REQUIRED', libvirt_version)
+conf.set('LIBVIRT_GLIB_REQUIRED', libvirt_glib_version)
+
+git = run_command('test', '-d', '.git').returncode() == 0
+
+
+# Configure options
+
+conf.set('SYSTEM_USER', get_option('system_user'))
+
+opt_dirs = [
+    'dbus_interfaces',
+    'dbus_services',
+    'dbus_system_services',
+    'dbus_system_policies',
+    'polkit_rules',
+]
+
+foreach opt_dir : opt_dirs
+    value = get_option(opt_dir)
+    varname = '@0@_dir'.format(opt_dir)
+    if opt_dir.startswith('/')
+        set_variable(varname, value)
+    else
+        set_variable(varname, join_paths(get_option('datadir'), value))
+    endif
+endforeach
+
+
+# Compile flags
+
+common_flags = [
+    '-DVIRT_DBUS_INTERFACES_DIR="@0@"'.format(dbus_interfaces_dir),
+]
+
+cc_flags = [
+    '-W',
+    '-Waddress',
+    '-Waggressive-loop-optimizations',
+    '-Wall',
+    '-Warray-bounds=2',
+    '-Wattributes',
+    '-Wbad-function-cast',
+    '-Wbool-compare',
+    '-Wbuiltin-macro-redefined',
+    '-Wcast-align',
+    '-Wchar-subscripts',
+    '-Wclobbered',
+    '-Wcomment',
+    '-Wcomments',
+    '-Wcoverage-mismatch',
+    '-Wcpp',
+    '-Wdate-time',
+    '-Wdeprecated-declarations',
+    '-Wdesignated-init',
+    '-Wdiscarded-array-qualifiers',
+    '-Wdiscarded-qualifiers',
+    '-Wdiv-by-zero',
+    '-Wdouble-promotion',
+    '-Wduplicated-cond',
+    '-Wempty-body',
+    '-Wendif-labels',
+    '-Wextra',
+    '-Wformat',
+    '-Wformat-contains-nul',
+    '-Wformat-extra-args',
+    '-Wformat-nonliteral',
+    '-Wformat-security',
+    '-Wformat-y2k',
+    '-Wformat-zero-length',
+    '-Wframe-address',
+    '-Wframe-larger-than=1024',
+    '-Wfree-nonheap-object',
+    '-Whsa',
+    '-Wignored-attributes',
+    '-Wignored-qualifiers',
+    '-Wimplicit',
+    '-Wimplicit-function-declaration',
+    '-Wimplicit-int',
+    '-Wincompatible-pointer-types',
+    '-Winit-self',
+    '-Winline',
+    '-Wint-conversion',
+    '-Wint-to-pointer-cast',
+    '-Winvalid-memory-model',
+    '-Winvalid-pch',
+    '-Wjump-misses-init',
+    '-Wlogical-not-parentheses',
+    '-Wlogical-op',
+    '-Wmain',
+    '-Wmaybe-uninitialized',
+    '-Wmemset-transposed-args',
+    '-Wmisleading-indentation',
+    '-Wmissing-braces',
+    '-Wmissing-declarations',
+    '-Wmissing-field-initializers',
+    '-Wmissing-include-dirs',
+    '-Wmissing-parameter-type',
+    '-Wmissing-prototypes',
+    '-Wmultichar',
+    '-Wnarrowing',
+    '-Wnested-externs',
+    '-Wno-cast-function-type',
+    '-Wnonnull',
+    '-Wnonnull-compare',
+    '-Wnormalized=nfc',
+    '-Wnull-dereference',
+    '-Wodr',
+    '-Wold-style-declaration',
+    '-Wold-style-definition',
+    '-Wopenmp-simd',
+    '-Woverflow',
+    '-Woverlength-strings',
+    '-Woverride-init',
+    '-Wpacked',
+    '-Wpacked-bitfield-compat',
+    '-Wparentheses',
+    '-Wpointer-arith',
+    '-Wpointer-sign',
+    '-Wpointer-to-int-cast',
+    '-Wpragmas',
+    '-Wreturn-local-addr',
+    '-Wreturn-type',
+    '-Wscalar-storage-order',
+    '-Wsequence-point',
+    '-Wshadow',
+    '-Wshift-count-negative',
+    '-Wshift-count-overflow',
+    '-Wshift-negative-value',
+    '-Wshift-overflow=2',
+    '-Wsizeof-array-argument',
+    '-Wsizeof-pointer-memaccess',
+    '-Wstack-protector',
+    '-Wstrict-aliasing',
+    '-Wstrict-prototypes',
+    '-Wsuggest-attribute=const',
+    '-Wsuggest-attribute=format',
+    '-Wsuggest-attribute=noreturn',
+    '-Wsuggest-attribute=pure',
+    '-Wsuggest-final-methods',
+    '-Wsuggest-final-types',
+    '-Wswitch',
+    '-Wswitch-bool',
+    '-Wsync-nand',
+    '-Wtautological-compare',
+    '-Wtrampolines',
+    '-Wtrigraphs',
+    '-Wtype-limits',
+    '-Wuninitialized',
+    '-Wunknown-pragmas',
+    '-Wunused',
+    '-Wunused-but-set-parameter',
+    '-Wunused-but-set-variable',
+    '-Wunused-const-variable=2',
+    '-Wunused-function',
+    '-Wunused-label',
+    '-Wunused-local-typedefs',
+    '-Wunused-macros',
+    '-Wunused-parameter',
+    '-Wunused-result',
+    '-Wunused-value',
+    '-Wunused-variable',
+    '-Wvarargs',
+    '-Wvariadic-macros',
+    '-Wvector-operation-performance',
+    '-Wvla',
+    '-Wvolatile-register-var',
+    '-Wwrite-strings',
+    '-fasynchronous-unwind-tables',
+    '-fexceptions',
+    '-fipa-pure-const',
+    '-fno-common',
+]
+ld_flags = [
+    '-Wl,-z,now',
+    '-Wl,-z,relro',
+]
+
+if git
+    cc_flags += ['-Werror']
+endif
+
+if host_machine.cpu_family() != 'aarch64'
+    if host_machine.system() == 'linux'
+        cc_flags += ['-fstack-protector-strong']
+    endif
+    if host_machine.system() == 'freebsd'
+        cc_flags += ['-fstack-protector']
+    endif
+endif
+
+if host_machine.system() not in ['cygwin', 'windows']
+    cc_flags += ['-fPIE', '-DPIE']
+    ld_flags += ['-pie']
+endif
+
+cc = meson.get_compiler('c')
+common_flags += cc.get_supported_arguments(cc_flags)
+link_flags = cc.get_supported_link_arguments(ld_flags)
+
+add_project_arguments(common_flags, language: 'c')
+add_project_link_arguments(link_flags, language: 'c')
+
+
+# Generate run helper
+
+configure_file(
+    input: 'run.in',
+    output: 'run',
+    configuration: conf,
+)
+run_command('tools/fix-perm.sh', 'a+x', 'run')
+
+
+# Generate dist files
+
+if git
+    configure_file(
+        input: 'libvirt-dbus.spec.in',
+        output: 'libvirt-dbus.spec',
+        configuration: conf,
+    )
+
+    authors = run_command('tools/gen-authors.sh')
+    configure_file(
+        configuration: { 'contributorslist': authors.stdout() },
+        input: 'AUTHORS.in',
+        output: 'AUTHORS',
+    )
+
+    foreach file : [ 'libvirt-dbus.spec', 'AUTHORS' ]
+        path = join_paths(meson.build_root(), file)
+        meson.add_dist_script(
+            'sh',
+            '-c',
+            'cp "@0@" "$MESON_DIST_ROOT/"'.format(path),
+        )
+    endforeach
+endif
+
+
+# Include sub-directories
+
+subdir('data')
+subdir('docs')
+subdir('src')
+subdir('tests')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..36e8065
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,6 @@
+option('dbus_services', type: 'string', value: 'dbus-1/services', description: 'D-Bus session services directory')
+option('dbus_system_services', type: 'string', value: 'dbus-1/system-services', description: 'D-Bus system services directory')
+option('dbus_system_policies', type: 'string', value: 'dbus-1/system.d', description: 'D-Bus system policies directory')
+option('dbus_interfaces', type: 'string', value: 'dbus-1/interfaces', description: 'D-Bus interfaces directory')
+option('polkit_rules', type: 'string', value: 'polkit-1/rules.d', description: 'polkit rules directory')
+option('system_user', type: 'string', value: 'libvirtdbus', description: 'username to run system instance as')
diff --git a/run.in b/run.in
index 0744a80..1b2207e 100644
--- a/run.in
+++ b/run.in
@@ -14,7 +14,7 @@
 #   ./run gdb --args ./src/libvirt-dbus [args ...]
 #
 
-export abs_top_builddir="@abs_top_builddir@"
-export VIRT_DBUS_INTERFACES_DIR="@abs_top_srcdir@/data"
+export abs_top_builddir="@build_root@"
+export VIRT_DBUS_INTERFACES_DIR="@source_root@/data"
 
 exec "$@"
diff --git a/src/Makefile.am b/src/Makefile.am
deleted file mode 100644
index 845696e..0000000
--- a/src/Makefile.am
+++ /dev/null
@@ -1,66 +0,0 @@
-AM_CPPFLAGS = \
-	-I$(top_srcdir)/src \
-	-DVIRT_DBUS_INTERFACES_DIR=\"$(DBUS_INTERFACES_DIR)\" \
-	$(NULL)
-AM_CFLAGS = \
-	$(GIO2_CFLAGS) \
-	$(GLIB2_CFLAGS) \
-	$(LIBVIRT_CFLAGS) \
-	$(LIBVIRT_GLIB_CFLAGS) \
-	$(WARN_CFLAGS) \
-	$(PIE_CFLAGS) \
-	$(NULL)
-AM_LDFLAGS = \
-	$(GIO2_LDFLAGS) \
-	$(GLIB2_LDFLAGS) \
-	$(LIBVIRT_LDFLAGS) \
-	$(LIBVIRT_GLIB_LDFLAGS) \
-	$(RELRO_LDFLAGS) \
-	$(PIE_LDFLAGS) \
-	$(NULL)
-
-noinst_LTLIBRARIES = \
-	libutil.la \
-	$(NULL)
-
-libutil_la_SOURCES = \
-	util.c \
-	util.h \
-	$(NULL)
-
-sbin_PROGRAMS = \
-	libvirt-dbus \
-	$(NULL)
-
-libvirt_dbus_SOURCES = \
-	connect.c \
-	connect.h \
-	domain.c \
-	domain.h \
-	events.c \
-	events.h \
-	gdbus.c \
-	gdbus.h \
-	interface.c \
-	interface.h \
-	main.c \
-	network.c \
-	network.h \
-	nodedev.c \
-	nodedev.h \
-	nwfilter.c \
-	nwfilter.h \
-	secret.c \
-	secret.h \
-	storagepool.c \
-	storagepool.h \
-	storagevol.c \
-	storagevol.h \
-	$(NULL)
-libvirt_dbus_LDADD = \
-	libutil.la \
-	$(GIO2_LIBS) \
-	$(GLIB2_LIBS) \
-	$(LIBVIRT_LIBS) \
-	$(LIBVIRT_GLIB_LIBS) \
-	$(NULL)
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..a848bcd
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,42 @@
+lib_util = static_library(
+    'libutil',
+    [
+        'util.c',
+    ],
+    dependencies: [
+        dep_gio_unix,
+        dep_glib,
+        dep_libvirt,
+        dep_libvirt_glib
+    ],
+)
+
+exe_libvirt_dbus = executable(
+    'libvirt-dbus',
+    [
+        'connect.c',
+        'domain.c',
+        'events.c',
+        'gdbus.c',
+        'interface.c',
+        'main.c',
+        'network.c',
+        'nodedev.c',
+        'nwfilter.c',
+        'secret.c',
+        'storagepool.c',
+        'storagevol.c',
+    ],
+    dependencies: [
+        dep_gio_unix,
+        dep_glib,
+        dep_libvirt,
+        dep_libvirt_glib
+    ],
+    link_with: [
+        lib_util,
+    ],
+    install: true,
+    install_dir: get_option('sbindir'),
+)
+
diff --git a/tests/Makefile.am b/tests/Makefile.am
deleted file mode 100644
index cd1fbd7..0000000
--- a/tests/Makefile.am
+++ /dev/null
@@ -1,57 +0,0 @@
-AM_CPPFLAGS = \
-	-I$(top_srcdir)/src \
-	$(NULL)
-
-test_helpers = \
-	xmldata.py \
-	libvirttest.py \
-	conftest.py \
-	$(NULL)
-
-test_programs = \
-	test_connect.py \
-	test_domain.py \
-	test_interface.py \
-	test_network.py \
-	test_nodedev.py \
-	test_storage.py \
-	$(NULL)
-
-check_PROGRAMS = \
-	test_util \
-	$(NULL)
-
-test_util_SOURCES = \
-	test_util.c \
-	$(NULL)
-test_util_CFLAGS = \
-	$(GIO2_CFLAGS) \
-	$(GLIB2_CFLAGS) \
-	$(LIBVIRT_CFLAGS) \
-	$(NULL)
-test_util_LDFLAGS = \
-	$(GIO2_LDFLAGS) \
-	$(GLIB2_LDFLAGS) \
-	$(LIBVIRT_LDFLAGS) \
-	$(NULL)
-test_util_LDADD = \
-	$(top_builddir)/src/libutil.la \
-	$(GIO2_LIBS) \
-	$(GLIB2_LIBS) \
-	$(LIBVIRT_LIBS) \
-	$(NULL)
-
-EXTRA_DIST = \
-	$(test_helpers) \
-	$(test_programs) \
-	travis-run \
-	$(NULL)
-
-TESTS = \
-	$(check_PROGRAMS) \
-	$(test_programs) \
-	$(NULL)
-
-AM_TESTS_ENVIRONMENT = \
-	export abs_top_builddir="$(abs_top_builddir)"; \
-	export VIRT_DBUS_INTERFACES_DIR="$(abs_top_srcdir)/data";
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..6617d4c
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,52 @@
+src_include = include_directories('../src')
+
+test_exec = executable(
+    'test_util',
+    [
+        'test_util.c',
+    ],
+    dependencies: [
+        dep_gio_unix,
+        dep_glib,
+        dep_libvirt,
+        dep_libvirt_glib
+    ],
+    link_with: [
+        lib_util,
+    ],
+    include_directories: src_include,
+)
+
+test('test_util', test_exec, suite: 'unit')
+
+python_tests = [
+    'test_connect.py',
+    'test_domain.py',
+    'test_interface.py',
+    'test_network.py',
+    'test_nodedev.py',
+    'test_storage.py',
+]
+
+python_env = [
+    'abs_top_builddir=' + meson.build_root(),
+    'VIRT_DBUS_INTERFACES_DIR=' + meson.source_root() + '/data'
+]
+
+foreach name : python_tests
+    prog = find_program(name)
+    test(name, prog, env: python_env, suite: 'unit')
+endforeach
+
+flake8 = find_program('flake8', 'flake8-3', required: false)
+if flake8.found()
+    test(
+        'flake8', flake8,
+        args: [
+            '--show-source',
+            '--ignore=E501', # E501: (line too long) warning is ignored.
+            meson.source_root(),
+        ],
+        suite: 'syntax',
+    )
+endif
diff --git a/tools/fix-perm.sh b/tools/fix-perm.sh
new file mode 100755
index 0000000..ed444d4
--- /dev/null
+++ b/tools/fix-perm.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+chmod $1 $MESON_BUILD_ROOT/$2
diff --git a/tools/gen-authors.sh b/tools/gen-authors.sh
new file mode 100755
index 0000000..eb39215
--- /dev/null
+++ b/tools/gen-authors.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+cd $MESON_SOURCE_ROOT
+git log --pretty=format:'    %aN <%aE>' | sort -u
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [dbus PATCH v2] build: convert to Meson/Ninja build system
Posted by Fabiano Fidêncio 4 years, 7 months ago
On Fri, Sep 20, 2019 at 11:05 AM Pavel Hrdina <phrdina@redhat.com> 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@redhat.com>
> Tested-by: Ján Tomko <jtomko@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

Why? Not opposed to this decision, just want to understand the reason for that.

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

By using 0.50.0 you're dropping support on:
- Debian 10;
- Ubuntu 19.04;

Personally, I would stick to 0.49.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/.gitignore b/.gitignore
> index b4abf66..7ed7554 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -19,6 +19,7 @@ vgcore.*
>  /aclocal.m4
>  /autom4te.cache/
>  /build-aux/
> +/build/
>  /config.h
>  /config.h.in
>  /config.log
> diff --git a/AUTHORS.in b/AUTHORS.in
> index 52202ea..d5a486e 100644
> --- a/AUTHORS.in
> +++ b/AUTHORS.in
> @@ -13,4 +13,4 @@ The primary maintainers of libvirt-dbus are:
>
>  Patches have been received from:
>
> -#contributorslist#
> +@contributorslist@
> diff --git a/HACKING.md b/HACKING.md
> index 8903408..e90f136 100644
> --- a/HACKING.md
> +++ b/HACKING.md
> @@ -16,32 +16,40 @@ Alternatively you can use one of the mirrors:
>  Running from git repository
>  ---------------------------
>
> -  * The first step is to run autoreconf to create configure script:
> +  * The first step is to run meson to create build directory:
>
>      ```
> -    ./autogen.sh
> +    meson build
>      ```
>
>      Now you can compile libvirt-dbus:
>
>      ```
> -    make
> +    ninja -C build
>      ```
>
>
> -  * Before posting a patch, you should run tests and perform syntax-checking:
> +  * Before posting a patch, you should run tests:
>
>      ```
> -    make check
> +    ninja -C build test
>      ```
>
> -    The test tool requires python3, python3-pytest and python3-dbus.
> +    The test tool requires python3, python3-pytest, python3-dbus and flake8.
> +
> +    It is possible to run only specific test using:
> +
> +    ```
> +    meson test -C build $test-name
> +    ```
> +
> +    or a group of tests:
>
>      ```
> -    make syntax-check
> +    meson test -C build --suite $label
>      ```
>
> -    To run this flake8 package is required.
> +    For more information see [https://mesonbuild.com/Unit-tests.html#testing-tool](https://mesonbuild.com/Unit-tests.html#testing-tool).
>
>
>    * To run libvirt-dbus directly from the build dir without installing it
> diff --git a/Makefile.am b/Makefile.am
> deleted file mode 100644
> index 0914449..0000000
> --- a/Makefile.am
> +++ /dev/null
> @@ -1,51 +0,0 @@
> -SUBDIRS = \
> -       data \
> -       docs \
> -       src \
> -       tests \
> -       $(NULL)
> -
> -ACLOCAL_AMFLAGS = -I m4
> -
> -EXTRA_DIST = \
> -       $(PACKAGE).spec \
> -       $(PACKAGE).spec.in \
> -       AUTHORS.in \
> -       HACKING.md \
> -       README.md \
> -       $(NULL)
> -
> -DISTCLEAN_FILES = \
> -       $(PACKAGE).spec \
> -       $(NULL)
> -
> -rpm: clean
> -       @(unset CDPATH ; $(MAKE) dist && rpmbuild -ta $(distdir).tar.xz)
> -
> -dist-hook: gen-AUTHORS
> -
> -# Generate the AUTHORS file (with all entries since the switch to git)
> -# and insert it into the directory we're about to use to create a tarball.
> -.PHONY: gen-AUTHORS
> -gen-AUTHORS:
> -       $(AM_V_GEN)\
> -       if test -d $(srcdir)/.git; then \
> -         ( \
> -           cd $(srcdir) && \
> -           git log --pretty=format:'    %aN <%aE>' | sort -u \
> -         ) > all.list && \
> -         sort -u $(srcdir)/AUTHORS.in > maint.list && \
> -         comm -23 all.list maint.list > contrib.list && \
> -         contrib="`cat contrib.list`" && \
> -         perl -p -e "s/#contributorslist#// and print '$$contrib'" \
> -           < $(srcdir)/AUTHORS.in > $(distdir)/AUTHORS-tmp && \
> -         mv -f $(distdir)/AUTHORS-tmp $(distdir)/AUTHORS && \
> -         rm -f all.list maint.list contrib.list; \
> -       fi
> -
> -# E501: (line too long) warning is ignored.
> -.PHONY: flake8
> -flake8:
> -       $(FLAKE8) --show-source --ignore=E501 $(srcdir)
> -
> -syntax-check: flake8
> diff --git a/README.md b/README.md
> index 66aa6f6..e365650 100644
> --- a/README.md
> +++ b/README.md
> @@ -32,21 +32,19 @@ The packages required to build libvirt-dbus are
>  Installation
>  ------------
>
> -libvirt-dbus uses GNU Autotools build system, so the build & install
> +libvirt-dbus uses Meson build system, so the build & install
>  process is fairly simple. For example, to install as root user:
>
>  ```
> -# ./configure --prefix=/usr --sysconfigdir=/etc --localstatedir=/var
> -# make
> -# make install
> +# meson build --prefix=/usr --sysconfigdir=/etc --localstatedir=/var
> +# ninja -C build install
>  ```
>
>  or to install as unprivileged user:
>
>  ```
> -$ ./configure --prefix=$HOME/usr
> -$ make
> -$ make install
> +$ meson build --prefix=$HOME/usr
> +$ ninja -C build install
>  ```
>
>
> diff --git a/autogen.sh b/autogen.sh
> deleted file mode 100755
> index 6f29899..0000000
> --- a/autogen.sh
> +++ /dev/null
> @@ -1,52 +0,0 @@
> -#!/bin/sh
> -# Run this to generate all the initial makefiles, etc.
> -
> -set -e
> -srcdir=`dirname $0`
> -test -z "$srcdir" && srcdir=.
> -
> -THEDIR=`pwd`
> -cd $srcdir
> -
> -DIE=0
> -
> -for prog in autoreconf automake autoconf libtoolize
> -do
> -    ($prog --version) < /dev/null > /dev/null 2>&1 || {
> -        echo
> -        echo "You must have $prog installed to compile libvirt-dbus."
> -        DIE=1
> -    }
> -done
> -
> -if test "$DIE" -eq 1; then
> -        exit 1
> -fi
> -
> -if test -z "$*"; then
> -        echo "I am going to run ./configure with no args - if you "
> -        echo "wish to pass any extra arguments to it, please specify them on "
> -        echo "the $0 command line."
> -fi
> -
> -mkdir -p build-aux
> -autoreconf -if
> -
> -cd $THEDIR
> -
> -if test "x$1" = "x--system"; then
> -    shift
> -    prefix=/usr
> -    libdir=$prefix/lib
> -    sysconfdir=/etc
> -    localstatedir=/var
> -    if [ -d /usr/lib64 ]; then
> -      libdir=$prefix/lib64
> -    fi
> -    EXTRA_ARGS="--prefix=$prefix --sysconfdir=$sysconfdir --localstatedir=$localstatedir --libdir=$libdir"
> -fi

--system ended up being remove here but never added back.
AFAIU that's a pattern followed by libvirt* projects and, if that's
the case, may be worth to adding it back.

> -
> -$srcdir/configure $EXTRA_ARGS "$@" && {
> -    echo
> -    echo "Now type 'make' to compile libvirt-dbus."
> -}
> diff --git a/configure.ac b/configure.ac
> deleted file mode 100644
> index 24ebb26..0000000
> --- a/configure.ac
> +++ /dev/null
> @@ -1,87 +0,0 @@
> -AC_INIT([libvirt-dbus], [1.4.0], [libvir-list@redhat.com], [], [https://libvirt.org])
> -
> -AC_CONFIG_SRCDIR([src/main.c])
> -AC_CONFIG_AUX_DIR([build-aux])
> -AC_CONFIG_HEADERS([config.h])
> -AC_CONFIG_MACRO_DIR([m4])
> -dnl Make automake keep quiet about wildcards & other GNUmake-isms
> -AM_INIT_AUTOMAKE([foreign -Wno-portability -Wno-obsolete subdir-objects tar-pax no-dist-gzip dist-xz])
> -AC_CANONICAL_HOST
> -AC_USE_SYSTEM_EXTENSIONS
> -
> -AM_SILENT_RULES([yes])
> -
> -GLIB2_REQUIRED=2.44.0
> -LIBVIRT_REQUIRED=3.0.0
> -LIBVIRT_GLIB_REQUIRED=0.0.7
> -AC_SUBST([GLIB2_REQUIRED]) dnl used in the .spec file
> -AC_SUBST([LIBVIRT_REQUIRED]) dnl used in the .spec file
> -AC_SUBST([LIBVIRT_GLIB_REQUIRED]) dnl used in the .spec file
> -
> -LIBVIRT_DBUS_MAJOR_VERSION=`echo $VERSION | awk -F. '{print $1}'`
> -LIBVIRT_DBUS_MINOR_VERSION=`echo $VERSION | awk -F. '{print $2}'`
> -LIBVIRT_DBUS_MICRO_VERSION=`echo $VERSION | awk -F. '{print $3}'`
> -LIBVIRT_DBUS_VERSION=$LIBVIRT_DBUS_MAJOR_VERSION.$LIBVIRT_DBUS_MINOR_VERSION.$LIBVIRT_DBUS_MICRO_VERSION$LIBVIRT_DBUS_MICRO_VERSION_SUFFIX
> -LIBVIRT_DBUS_VERSION_NUMBER=`expr $LIBVIRT_DBUS_MAJOR_VERSION \* 1000000 + $LIBVIRT_dbus_MINOR_VERSION \* 1000 + $LIBVIRT_DBUS_MICRO_VERSION`
> -
> -AC_SUBST([LIBVIRT_DBUS_MAJOR_VERSION])
> -AC_SUBST([LIBVIRT_DBUS_MINOR_VERSION])
> -AC_SUBST([LIBVIRT_DBUS_MICRO_VERSION])
> -AC_SUBST([LIBVIRT_DBUS_VERSION])
> -AC_SUBST([LIBVIRT_DBUS_VERSION_INFO])
> -AC_SUBST([LIBVIRT_DBUS_VERSION_NUMBER])
> -
> -AC_PROG_CC
> -AC_PROG_MKDIR_P
> -AM_PROG_CC_C_O
> -AC_PROG_CC_STDC
> -AC_PROG_LIBTOOL
> -AC_PATH_PROGS([FLAKE8], [flake8 flake8-3.6])
> -
> -PKG_CHECK_MODULES([GIO2], [gio-unix-2.0 >= $GLIB2_REQUIRED])
> -PKG_CHECK_MODULES([GLIB2], [glib-2.0 >= $GLIB2_REQUIRED])
> -PKG_CHECK_MODULES([LIBVIRT], [libvirt >= $LIBVIRT_REQUIRED])
> -PKG_CHECK_MODULES([LIBVIRT_GLIB], [libvirt-glib-1.0 >= $LIBVIRT_GLIB_REQUIRED])
> -
> -LIBVIRT_COMPILE_WARNINGS
> -LIBVIRT_LINKER_RELRO
> -LIBVIRT_COMPILE_PIE
> -
> -LIBVIRT_ARG_WITH([DBUS_SERVICES], [where D-Bus session services direcotry is],
> -                 ['$(datadir)/dbus-1/services'])
> -DBUS_SERVICES_DIR="$with_dbus_services"
> -AC_SUBST([DBUS_SERVICES_DIR])
> -
> -LIBVIRT_ARG_WITH([DBUS_SYSTEM_SERVICES], [where D-Bus system services directory is],
> -                 ['$(datadir)/dbus-1/system-services'])
> -DBUS_SYSTEM_SERVICES_DIR="$with_dbus_system_services"
> -AC_SUBST([DBUS_SYSTEM_SERVICES_DIR])
> -
> -LIBVIRT_ARG_WITH([DBUS_SYSTEM_POLICIES], [where D-Bus system policies directory is],
> -                 ['$(datadir)/dbus-1/system.d'])
> -DBUS_SYSTEM_POLICIES_DIR="$with_dbus_system_policies"
> -AC_SUBST([DBUS_SYSTEM_POLICIES_DIR])
> -
> -LIBVIRT_ARG_WITH([DBUS_INTERFACES], [where D-Bus interfaces directory is],
> -                 ['$(datadir)/dbus-1/interfaces'])
> -DBUS_INTERFACES_DIR="$with_dbus_interfaces"
> -AC_SUBST([DBUS_INTERFACES_DIR])
> -
> -LIBVIRT_ARG_WITH([POLKIT_RULES], [directory for polkit rules],
> -                 ['$(datadir)/polkit-1/rules.d'])
> -POLKIT_RULES_DIR="$with_polkit_rules"
> -AC_SUBST([POLKIT_RULES_DIR])
> -
> -LIBVIRT_ARG_WITH([SYSTEM_USER], [username to run system instance as],
> -                 ['libvirtdbus'])
> -SYSTEM_USER=$with_system_user
> -AC_SUBST([SYSTEM_USER])
> -
> -AC_CONFIG_FILES([run],
> -                [chmod +x,-w run])
> -AC_OUTPUT([Makefile
> -           data/Makefile
> -           docs/Makefile
> -           src/Makefile
> -           tests/Makefile
> -           libvirt-dbus.spec])
> diff --git a/data/Makefile.am b/data/Makefile.am
> deleted file mode 100644
> index f8311bd..0000000
> --- a/data/Makefile.am
> +++ /dev/null
> @@ -1,83 +0,0 @@
> -service_in_files = \
> -       session/org.libvirt.service.in \
> -       $(NULL)
> -servicedir = $(DBUS_SERVICES_DIR)
> -service_DATA = \
> -       $(service_in_files:.service.in=.service) \
> -       $(NULL)
> -
> -system_service_in_files = \
> -       system/org.libvirt.service.in \
> -       $(NULL)
> -system_servicedir = $(DBUS_SYSTEM_SERVICES_DIR)
> -system_service_DATA = \
> -       $(system_service_in_files:.service.in=.service) \
> -       $(NULL)
> -
> -system_policy_in_files = \
> -       system/org.libvirt.conf.in \
> -       $(NULL)
> -system_policydir = $(DBUS_SYSTEM_POLICIES_DIR)
> -system_policy_DATA = \
> -       $(system_policy_in_files:.conf.in=.conf) \
> -       $(NULL)
> -
> -polkit_in_files = \
> -       system/libvirt-dbus.rules.in \
> -       $(NULL)
> -polkitdir = $(POLKIT_RULES_DIR)
> -polkit_DATA = \
> -       $(polkit_in_files:.rules.in=.rules) \
> -       $(NULL)
> -
> -interfaces_files = \
> -       org.libvirt.Connect.xml \
> -       org.libvirt.Domain.xml \
> -       org.libvirt.Interface.xml \
> -       org.libvirt.Network.xml \
> -       org.libvirt.NodeDevice.xml \
> -       org.libvirt.NWFilter.xml \
> -       org.libvirt.Secret.xml \
> -       org.libvirt.StoragePool.xml \
> -       org.libvirt.StorageVol.xml \
> -       $(NULL)
> -interfacesdir = $(DBUS_INTERFACES_DIR)
> -interfaces_DATA = \
> -       $(interfaces_files) \
> -       $(NULL)
> -
> -EXTRA_DIST = \
> -       $(service_in_files) \
> -       $(system_service_in_files) \
> -       $(system_policy_in_files) \
> -       $(polkit_in_files) \
> -       $(interfaces_files) \
> -       $(NULL)
> -
> -CLEANFILES = \
> -       $(service_DATA) \
> -       $(system_service_DATA) \
> -       $(system_policy_DATA) \
> -       $(polkit_DATA) \
> -       $(NULL)
> -
> -session/org.libvirt.service: session/org.libvirt.service.in
> -       $(AM_V_GEN)$(MKDIR_P) session && \
> -               sed -e 's|[@]sbindir[@]|$(sbindir)|g' < $< > $@-t && \
> -                       mv $@-t $@
> -
> -system/org.libvirt.service: system/org.libvirt.service.in
> -       $(AM_V_GEN)$(MKDIR_P) system && \
> -               sed -e 's|[@]sbindir[@]|$(sbindir)|g' \
> -                   -e 's|[@]SYSTEM_USER[@]|$(SYSTEM_USER)|' \
> -                       < $< > $@-t && mv $@-t $@
> -
> -system/org.libvirt.conf: system/org.libvirt.conf.in
> -       $(AM_V_GEN)$(MKDIR_P) system && \
> -               sed -e 's|[@]SYSTEM_USER[@]|$(SYSTEM_USER)|' \
> -                       < $< > $@-t && mv $@-t $@
> -
> -system/libvirt-dbus.rules: system/libvirt-dbus.rules.in
> -       $(AM_V_GEN)$(MKDIR_P) system && \
> -               sed -e 's|[@]SYSTEM_USER[@]|$(SYSTEM_USER)|' \
> -                       < $< > $@-t && mv $@-t $@
> diff --git a/data/meson.build b/data/meson.build
> new file mode 100644
> index 0000000..42a6799
> --- /dev/null
> +++ b/data/meson.build
> @@ -0,0 +1,15 @@
> +install_data(
> +    'org.libvirt.Connect.xml',
> +    'org.libvirt.Domain.xml',
> +    'org.libvirt.Interface.xml',
> +    'org.libvirt.Network.xml',
> +    'org.libvirt.NodeDevice.xml',
> +    'org.libvirt.NWFilter.xml',
> +    'org.libvirt.Secret.xml',
> +    'org.libvirt.StoragePool.xml',
> +    'org.libvirt.StorageVol.xml',
> +    install_dir: dbus_interfaces_dir,
> +)
> +
> +subdir('session')
> +subdir('system')
> diff --git a/data/session/meson.build b/data/session/meson.build
> new file mode 100644
> index 0000000..240fcef
> --- /dev/null
> +++ b/data/session/meson.build
> @@ -0,0 +1,6 @@
> +configure_file(
> +    configuration: conf,
> +    input: 'org.libvirt.service.in',
> +    output: 'org.libvirt.service',
> +    install_dir: dbus_services_dir,
> +)
> diff --git a/data/system/meson.build b/data/system/meson.build
> new file mode 100644
> index 0000000..74f1949
> --- /dev/null
> +++ b/data/system/meson.build
> @@ -0,0 +1,18 @@
> +configure_file(
> +    configuration: conf,
> +    input: 'org.libvirt.service.in',
> +    output: 'org.libvirt.service',
> +    install_dir: dbus_system_services_dir,
> +)
> +configure_file(
> +    configuration: conf,
> +    input: 'org.libvirt.conf.in',
> +    output: 'org.libvirt.conf',
> +    install_dir: dbus_system_policies_dir,
> +)
> +configure_file(
> +    configuration: conf,
> +    input: 'libvirt-dbus.rules.in',
> +    output: 'libvirt-dbus.rules',
> +    install_dir: polkit_rules_dir,
> +)
> diff --git a/docs/Makefile.am b/docs/Makefile.am
> deleted file mode 100644
> index fe8ca1c..0000000
> --- a/docs/Makefile.am
> +++ /dev/null
> @@ -1,21 +0,0 @@
> -POD2MAN = pod2man -c "Virtualization Support" -r "$(PACKAGE)-$(VERSION)"
> -
> -PODFILES = \
> -       libvirt-dbus.pod \
> -       $(NULL)
> -
> -%.8: %.pod
> -       $(AM_V_GEN)$(POD2MAN) -s 8 $< $@ \
> -               && if grep 'POD ERROR' $@; then rm $@; exit 1; fi
> -
> -man8_MANS = \
> -       libvirt-dbus.8 \
> -       $(NULL)
> -
> -EXTRA_DIST = \
> -       $(PODFILES) \
> -       $(NULL)
> -
> -CLEANFILES = \
> -       $(man8_MANS) \
> -       $(NULL)
> diff --git a/docs/meson.build b/docs/meson.build
> new file mode 100644
> index 0000000..e62e71a
> --- /dev/null
> +++ b/docs/meson.build
> @@ -0,0 +1,8 @@
> +prog_pod2man = find_program('pod2man')
> +
> +configure_file(
> +    command: [prog_pod2man.path(), '-s 8', '@INPUT@', '@OUTPUT@'],
> +    input: 'libvirt-dbus.pod',
> +    output: 'libvirt-dbus.8',
> +    install_dir: join_paths (get_option('mandir'), 'man8'),
> +)
> 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}
> diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4
> deleted file mode 100644
> index 0f06ade..0000000
> --- a/m4/manywarnings.m4
> +++ /dev/null
> @@ -1,276 +0,0 @@
> -# manywarnings.m4 serial 8
> -dnl Copyright (C) 2008-2017 Free Software Foundation, Inc.
> -dnl This file is free software; the Free Software Foundation
> -dnl gives unlimited permission to copy and/or distribute it,
> -dnl with or without modifications, as long as this notice is preserved.
> -
> -dnl From Simon Josefsson
> -
> -# gl_MANYWARN_COMPLEMENT(OUTVAR, LISTVAR, REMOVEVAR)
> -# --------------------------------------------------
> -# Copy LISTVAR to OUTVAR except for the entries in REMOVEVAR.
> -# Elements separated by whitespace.  In set logic terms, the function
> -# does OUTVAR = LISTVAR \ REMOVEVAR.
> -AC_DEFUN([gl_MANYWARN_COMPLEMENT],
> -[
> -  gl_warn_set=
> -  set x $2; shift
> -  for gl_warn_item
> -  do
> -    case " $3 " in
> -      *" $gl_warn_item "*)
> -        ;;
> -      *)
> -        gl_warn_set="$gl_warn_set $gl_warn_item"
> -        ;;
> -    esac
> -  done
> -  $1=$gl_warn_set
> -])
> -
> -# gl_MANYWARN_ALL_GCC(VARIABLE)
> -# -----------------------------
> -# Add all documented GCC warning parameters to variable VARIABLE.
> -# Note that you need to test them using gl_WARN_ADD if you want to
> -# make sure your gcc understands it.
> -AC_DEFUN([gl_MANYWARN_ALL_GCC],
> -[
> -  dnl First, check for some issues that only occur when combining multiple
> -  dnl gcc warning categories.
> -  AC_REQUIRE([AC_PROG_CC])
> -  if test -n "$GCC"; then
> -
> -    dnl Check if -W -Werror -Wno-missing-field-initializers is supported
> -    dnl with the current $CC $CFLAGS $CPPFLAGS.
> -    AC_MSG_CHECKING([whether -Wno-missing-field-initializers is supported])
> -    AC_CACHE_VAL([gl_cv_cc_nomfi_supported], [
> -      gl_save_CFLAGS="$CFLAGS"
> -      CFLAGS="$CFLAGS -W -Werror -Wno-missing-field-initializers"
> -      AC_COMPILE_IFELSE(
> -        [AC_LANG_PROGRAM([[]], [[]])],
> -        [gl_cv_cc_nomfi_supported=yes],
> -        [gl_cv_cc_nomfi_supported=no])
> -      CFLAGS="$gl_save_CFLAGS"])
> -    AC_MSG_RESULT([$gl_cv_cc_nomfi_supported])
> -
> -    if test "$gl_cv_cc_nomfi_supported" = yes; then
> -      dnl Now check whether -Wno-missing-field-initializers is needed
> -      dnl for the { 0, } construct.
> -      AC_MSG_CHECKING([whether -Wno-missing-field-initializers is needed])
> -      AC_CACHE_VAL([gl_cv_cc_nomfi_needed], [
> -        gl_save_CFLAGS="$CFLAGS"
> -        CFLAGS="$CFLAGS -W -Werror"
> -        AC_COMPILE_IFELSE(
> -          [AC_LANG_PROGRAM(
> -             [[int f (void)
> -               {
> -                 typedef struct { int a; int b; } s_t;
> -                 s_t s1 = { 0, };
> -                 return s1.b;
> -               }
> -             ]],
> -             [[]])],
> -          [gl_cv_cc_nomfi_needed=no],
> -          [gl_cv_cc_nomfi_needed=yes])
> -        CFLAGS="$gl_save_CFLAGS"
> -      ])
> -      AC_MSG_RESULT([$gl_cv_cc_nomfi_needed])
> -    fi
> -
> -    dnl Next, check if -Werror -Wuninitialized is useful with the
> -    dnl user's choice of $CFLAGS; some versions of gcc warn that it
> -    dnl has no effect if -O is not also used
> -    AC_MSG_CHECKING([whether -Wuninitialized is supported])
> -    AC_CACHE_VAL([gl_cv_cc_uninitialized_supported], [
> -      gl_save_CFLAGS="$CFLAGS"
> -      CFLAGS="$CFLAGS -Werror -Wuninitialized"
> -      AC_COMPILE_IFELSE(
> -        [AC_LANG_PROGRAM([[]], [[]])],
> -        [gl_cv_cc_uninitialized_supported=yes],
> -        [gl_cv_cc_uninitialized_supported=no])
> -      CFLAGS="$gl_save_CFLAGS"])
> -    AC_MSG_RESULT([$gl_cv_cc_uninitialized_supported])
> -
> -  fi
> -
> -  # List all gcc warning categories.
> -  # To compare this list to your installed GCC's, run this Bash command:
> -  #
> -  # comm -3 \
> -  #  <(sed -n 's/^  *\(-[^ ]*\) .*/\1/p' manywarnings.m4 | sort) \
> -  #  <(gcc --help=warnings | sed -n 's/^  \(-[^ ]*\) .*/\1/p' | sort |
> -  #      grep -v -x -f <(
> -  #         awk '/^[^#]/ {print $1}' ../build-aux/gcc-warning.spec))
> -
> -  gl_manywarn_set=
> -  for gl_manywarn_item in \
> -    -fno-common \
> -    -W \
> -    -Wabi \
> -    -Waddress \
> -    -Waggressive-loop-optimizations \
> -    -Wall \
> -    -Wattributes \
> -    -Wbad-function-cast \
> -    -Wbool-compare \
> -    -Wbuiltin-macro-redefined \
> -    -Wcast-align \
> -    -Wchar-subscripts \
> -    -Wchkp \
> -    -Wclobbered \
> -    -Wcomment \
> -    -Wcomments \
> -    -Wcoverage-mismatch \
> -    -Wcpp \
> -    -Wdate-time \
> -    -Wdeprecated \
> -    -Wdeprecated-declarations \
> -    -Wdesignated-init \
> -    -Wdisabled-optimization \
> -    -Wdiscarded-array-qualifiers \
> -    -Wdiscarded-qualifiers \
> -    -Wdiv-by-zero \
> -    -Wdouble-promotion \
> -    -Wduplicated-cond \
> -    -Wempty-body \
> -    -Wendif-labels \
> -    -Wenum-compare \
> -    -Wextra \
> -    -Wformat-contains-nul \
> -    -Wformat-extra-args \
> -    -Wformat-nonliteral \
> -    -Wformat-security \
> -    -Wformat-signedness \
> -    -Wformat-y2k \
> -    -Wformat-zero-length \
> -    -Wframe-address \
> -    -Wfree-nonheap-object \
> -    -Whsa \
> -    -Wignored-attributes \
> -    -Wignored-qualifiers \
> -    -Wimplicit \
> -    -Wimplicit-function-declaration \
> -    -Wimplicit-int \
> -    -Wincompatible-pointer-types \
> -    -Winit-self \
> -    -Winline \
> -    -Wint-conversion \
> -    -Wint-to-pointer-cast \
> -    -Winvalid-memory-model \
> -    -Winvalid-pch \
> -    -Wjump-misses-init \
> -    -Wlogical-not-parentheses \
> -    -Wlogical-op \
> -    -Wmain \
> -    -Wmaybe-uninitialized \
> -    -Wmemset-transposed-args \
> -    -Wmisleading-indentation \
> -    -Wmissing-braces \
> -    -Wmissing-declarations \
> -    -Wmissing-field-initializers \
> -    -Wmissing-include-dirs \
> -    -Wmissing-parameter-type \
> -    -Wmissing-prototypes \
> -    -Wmultichar \
> -    -Wnarrowing \
> -    -Wnested-externs \
> -    -Wnonnull \
> -    -Wnonnull-compare \
> -    -Wnull-dereference \
> -    -Wodr \
> -    -Wold-style-declaration \
> -    -Wold-style-definition \
> -    -Wopenmp-simd \
> -    -Woverflow \
> -    -Woverlength-strings \
> -    -Woverride-init \
> -    -Wpacked \
> -    -Wpacked-bitfield-compat \
> -    -Wparentheses \
> -    -Wpointer-arith \
> -    -Wpointer-sign \
> -    -Wpointer-to-int-cast \
> -    -Wpragmas \
> -    -Wreturn-local-addr \
> -    -Wreturn-type \
> -    -Wscalar-storage-order \
> -    -Wsequence-point \
> -    -Wshadow \
> -    -Wshift-count-negative \
> -    -Wshift-count-overflow \
> -    -Wshift-negative-value \
> -    -Wsizeof-array-argument \
> -    -Wsizeof-pointer-memaccess \
> -    -Wstack-protector \
> -    -Wstrict-aliasing \
> -    -Wstrict-overflow \
> -    -Wstrict-prototypes \
> -    -Wsuggest-attribute=const \
> -    -Wsuggest-attribute=format \
> -    -Wsuggest-attribute=noreturn \
> -    -Wsuggest-attribute=pure \
> -    -Wsuggest-final-methods \
> -    -Wsuggest-final-types \
> -    -Wswitch \
> -    -Wswitch-bool \
> -    -Wswitch-default \
> -    -Wsync-nand \
> -    -Wsystem-headers \
> -    -Wtautological-compare \
> -    -Wtrampolines \
> -    -Wtrigraphs \
> -    -Wtype-limits \
> -    -Wuninitialized \
> -    -Wunknown-pragmas \
> -    -Wunsafe-loop-optimizations \
> -    -Wunused \
> -    -Wunused-but-set-parameter \
> -    -Wunused-but-set-variable \
> -    -Wunused-function \
> -    -Wunused-label \
> -    -Wunused-local-typedefs \
> -    -Wunused-macros \
> -    -Wunused-parameter \
> -    -Wunused-result \
> -    -Wunused-value \
> -    -Wunused-variable \
> -    -Wvarargs \
> -    -Wvariadic-macros \
> -    -Wvector-operation-performance \
> -    -Wvla \
> -    -Wvolatile-register-var \
> -    -Wwrite-strings \
> -    \
> -    ; do
> -    gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
> -  done
> -
> -  # gcc --help=warnings outputs an unusual form for these options; list
> -  # them here so that the above 'comm' command doesn't report a false match.
> -  gl_manywarn_set="$gl_manywarn_set -Warray-bounds=2"
> -  gl_manywarn_set="$gl_manywarn_set -Wnormalized=nfc"
> -  gl_manywarn_set="$gl_manywarn_set -Wshift-overflow=2"
> -  gl_manywarn_set="$gl_manywarn_set -Wunused-const-variable=2"
> -
> -  # These are needed for older GCC versions.
> -  if test -n "$GCC"; then
> -    case `($CC --version) 2>/dev/null` in
> -      'gcc (GCC) '[[0-3]].* | \
> -      'gcc (GCC) '4.[[0-7]].*)
> -        gl_manywarn_set="$gl_manywarn_set -fdiagnostics-show-option"
> -        gl_manywarn_set="$gl_manywarn_set -funit-at-a-time"
> -          ;;
> -    esac
> -  fi
> -
> -  # Disable specific options as needed.
> -  if test "$gl_cv_cc_nomfi_needed" = yes; then
> -    gl_manywarn_set="$gl_manywarn_set -Wno-missing-field-initializers"
> -  fi
> -
> -  if test "$gl_cv_cc_uninitialized_supported" = no; then
> -    gl_manywarn_set="$gl_manywarn_set -Wno-uninitialized"
> -  fi
> -
> -  $1=$gl_manywarn_set
> -])
> diff --git a/m4/virt-arg.m4 b/m4/virt-arg.m4
> deleted file mode 100644
> index d626d72..0000000
> --- a/m4/virt-arg.m4
> +++ /dev/null
> @@ -1,154 +0,0 @@
> -dnl
> -dnl virt-arg.m4: Helper macros for adding configure arguments
> -dnl
> -dnl Copyright (C) 2012-2014 Red Hat, Inc.
> -dnl
> -dnl This library is free software; you can redistribute it and/or
> -dnl modify it under the terms of the GNU Lesser General Public
> -dnl License as published by the Free Software Foundation; either
> -dnl version 2.1 of the License, or (at your option) any later version.
> -dnl
> -dnl This library is distributed in the hope that it will be useful,
> -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
> -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> -dnl Lesser General Public License for more details.
> -dnl
> -dnl You should have received a copy of the GNU Lesser General Public
> -dnl License along with this library.  If not, see
> -dnl <http://www.gnu.org/licenses/>.
> -dnl
> -
> -
> -dnl
> -dnl To be used instead of AC_ARG_WITH
> -dnl
> -dnl See LIBVIRT_ARG_WITH_FEATURE if the argument you're adding is going to
> -dnl be used for switching a feature on and off.
> -dnl
> -dnl LIBVIRT_ARG_WITH([CHECK_NAME], [HELP_DESC], [DEFAULT_ACTION])
> -dnl
> -dnl      CHECK_NAME: Suffix/prefix used for variables/flags, in uppercase.
> -dnl       HELP_DESC: Description that will appear in configure --help
> -dnl  DEFAULT_ACTION: Default configure action
> -dnl
> -dnl LIBVIRT_ARG_WITH([PACKAGER], [Extra packager name], [no])
> -dnl LIBVIRT_ARG_WITH([HTML_DIR], [path to base html directory], [$(datadir)/doc])
> -dnl
> -AC_DEFUN([LIBVIRT_ARG_WITH], [
> -  m4_pushdef([check_name], [$1])
> -  m4_pushdef([help_desc], [[$2]])
> -  m4_pushdef([default_action], [$3])
> -
> -  m4_pushdef([check_name_lc], m4_tolower(check_name))
> -  m4_pushdef([check_name_dash], m4_translit(check_name_lc, [_], [-]))
> -
> -  m4_pushdef([arg_var], [with-]check_name_dash)
> -  m4_pushdef([with_var], [with_]check_name_lc)
> -
> -  m4_divert_text([DEFAULTS], [with_var][[=]][default_action])
> -  AC_ARG_WITH([check_name_lc],
> -              [AS_HELP_STRING([[--]arg_var],
> -                              ]m4_dquote(help_desc)[[ @<:@default=]]m4_dquote(default_action)[[@:>@])])
> -
> -  m4_popdef([with_var])
> -  m4_popdef([arg_var])
> -
> -  m4_popdef([check_name_dash])
> -  m4_popdef([check_name_lc])
> -
> -  m4_popdef([default_action])
> -  m4_popdef([help_desc])
> -  m4_popdef([check_name])
> -])
> -
> -dnl
> -dnl To be used instead of AC_ARG_WITH
> -dnl
> -dnl The difference between LIBVIRT_ARG_WITH and this macro is that the former
> -dnl is mostly an enhanced drop-in replacement for AC_ARG_WITH, whereas the
> -dnl latter is tailored for adding an argument that is going to be used to
> -dnl switch a feature on and off: as a consequence, it optionally supports
> -dnl specifying the minimum version for libraries the feature depends on and
> -dnl automatically builds a suitable description from the feature name.
> -dnl
> -dnl LIBVIRT_ARG_WITH_FEATURE([CHECK_NAME], [HELP_NAME], [DEFAULT_ACTION], [MIN_VERSION])
> -dnl
> -dnl      CHECK_NAME: Suffix/prefix used for variables/flags, in uppercase.
> -dnl       HELP_NAME: Name that will appear in configure --help
> -dnl  DEFAULT_ACTION: Default configure action
> -dnl     MIN_VERSION: Specify minimal version that will be added to
> -dnl                  configure --help (optional)
> -dnl
> -dnl LIBVIRT_ARG_WITH_FEATURE([SELINUX], [SeLinux], [check])
> -dnl LIBVIRT_ARG_WITH_FEATURE([GLUSTERFS], [glusterfs], [check], [3.4.1])
> -dnl
> -AC_DEFUN([LIBVIRT_ARG_WITH_FEATURE], [
> -  m4_pushdef([check_name], [$1])
> -  m4_pushdef([help_name], [[$2]])
> -  m4_pushdef([default_action], [$3])
> -  m4_pushdef([min_version], [$4])
> -
> -  m4_pushdef([check_name_lc], m4_tolower(check_name))
> -  m4_pushdef([check_name_dash], m4_translit(check_name_lc, [_], [-]))
> -
> -  m4_pushdef([arg_var], [with-]check_name_dash)
> -  m4_pushdef([with_var], [with_]check_name_lc)
> -
> -  m4_pushdef([version_text], m4_ifnblank(min_version, [[ (>= ]]min_version[[)]]))
> -
> -  m4_divert_text([DEFAULTS], [with_var][[=]][default_action])
> -  AC_ARG_WITH([check_name_lc],
> -              [AS_HELP_STRING([[--]arg_var],
> -                              [with ]]m4_dquote(help_name)m4_dquote(version_text)[[ support @<:@default=]]m4_dquote(default_action)[[@:>@])])
> -
> -  m4_popdef([version_text])
> -
> -  m4_popdef([with_var])
> -  m4_popdef([arg_var])
> -
> -  m4_popdef([check_name_dash])
> -  m4_popdef([check_name_lc])
> -
> -  m4_popdef([min_version])
> -  m4_popdef([default_action])
> -  m4_popdef([help_name])
> -  m4_popdef([check_name])
> -])
> -
> -dnl
> -dnl To be used instead of AC_ARG_ENABLE
> -dnl
> -dnl LIBVIRT_ARG_ENABLE([CHECK_NAME], [HELP_DESC], [DEFAULT_ACTION])
> -dnl
> -dnl      CHECK_NAME: Suffix/prefix used for variables/flags, in uppercase.
> -dnl       HELP_DESC: Description that will appear in configure --help
> -dnl  DEFAULT_ACTION: Default configure action
> -dnl
> -dnl LIBVIRT_ARG_ENABLE([DEBUG], [enable debugging output], [yes])
> -dnl
> -AC_DEFUN([LIBVIRT_ARG_ENABLE], [
> -  m4_pushdef([check_name], [$1])
> -  m4_pushdef([help_desc], [[$2]])
> -  m4_pushdef([default_action], [$3])
> -
> -  m4_pushdef([check_name_lc], m4_tolower(check_name))
> -  m4_pushdef([check_name_dash], m4_translit(check_name_lc, [_], [-]))
> -
> -  m4_pushdef([arg_var], [enable-]check_name_dash)
> -  m4_pushdef([enable_var], [enable_]check_name_lc)
> -
> -  m4_divert_text([DEFAULTS], [enable_var][[=]][default_action])
> -  AC_ARG_ENABLE([check_name_lc],
> -                [AS_HELP_STRING([[--]arg_var],
> -                                ]m4_dquote(help_desc)[[ @<:@default=]]m4_dquote(default_action)[[@:>@])])
> -
> -  m4_popdef([enable_var])
> -  m4_popdef([arg_var])
> -
> -  m4_popdef([check_name_dash])
> -  m4_popdef([check_name_lc])
> -
> -  m4_popdef([default_action])
> -  m4_popdef([help_desc])
> -  m4_popdef([check_name])
> -])
> diff --git a/m4/virt-compile-pie.m4 b/m4/virt-compile-pie.m4
> deleted file mode 100644
> index a2df38e..0000000
> --- a/m4/virt-compile-pie.m4
> +++ /dev/null
> @@ -1,35 +0,0 @@
> -dnl
> -dnl Check for support for position independent executables
> -dnl
> -dnl Copyright (C) 2013 Red Hat, Inc.
> -dnl
> -dnl This library is free software; you can redistribute it and/or
> -dnl modify it under the terms of the GNU Lesser General Public
> -dnl License as published by the Free Software Foundation; either
> -dnl version 2.1 of the License, or (at your option) any later version.
> -dnl
> -dnl This library is distributed in the hope that it will be useful,
> -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
> -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> -dnl Lesser General Public License for more details.
> -dnl
> -dnl You should have received a copy of the GNU Lesser General Public
> -dnl License along with this library.  If not, see
> -dnl <http://www.gnu.org/licenses/>.
> -dnl
> -
> -AC_DEFUN([LIBVIRT_COMPILE_PIE],[
> -    PIE_CFLAGS=
> -    PIE_LDFLAGS=
> -    case "$host" in
> -      *-*-mingw* | *-*-msvc* | *-*-cygwin* )
> -         ;; dnl All code is position independent on Win32 target
> -      *)
> -      gl_COMPILER_OPTION_IF([-fPIE -DPIE -pie], [
> -        PIE_CFLAGS="-fPIE -DPIE"
> -        PIE_LDFLAGS="-pie"
> -      ])
> -    esac
> -    AC_SUBST([PIE_CFLAGS])
> -    AC_SUBST([PIE_LDFLAGS])
> -])
> diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
> deleted file mode 100644
> index 6ece136..0000000
> --- a/m4/virt-compile-warnings.m4
> +++ /dev/null
> @@ -1,203 +0,0 @@
> -dnl
> -dnl Enable all known GCC compiler warnings, except for those
> -dnl we can't yet cope with
> -dnl
> -AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
> -    dnl ******************************
> -    dnl More compiler warnings
> -    dnl ******************************
> -
> -    LIBVIRT_ARG_ENABLE([WERROR], [Use -Werror (if supported)], [check])
> -    if test "$enable_werror" = "check"; then
> -        if test -d $srcdir/.git; then
> -            is_git_version=true
> -            enable_werror=yes
> -        else
> -            enable_werror=no
> -        fi
> -    fi
> -
> -    # List of warnings that are not relevant / wanted
> -
> -    # Don't care about C++ compiler compat
> -    dontwarn="$dontwarn -Wc++-compat"
> -    dontwarn="$dontwarn -Wabi"
> -    dontwarn="$dontwarn -Wdeprecated"
> -    # Don't care about ancient C standard compat
> -    dontwarn="$dontwarn -Wtraditional"
> -    # Don't care about ancient C standard compat
> -    dontwarn="$dontwarn -Wtraditional-conversion"
> -    # Ignore warnings in /usr/include
> -    dontwarn="$dontwarn -Wsystem-headers"
> -    # Happy for compiler to add struct padding
> -    dontwarn="$dontwarn -Wpadded"
> -    # GCC very confused with -O2
> -    dontwarn="$dontwarn -Wunreachable-code"
> -    # Too many to deal with
> -    dontwarn="$dontwarn -Wconversion"
> -    # Too many to deal with
> -    dontwarn="$dontwarn -Wsign-conversion"
> -    # We need to use long long in many places
> -    dontwarn="$dontwarn -Wlong-long"
> -    # We allow manual list of all enum cases without default:
> -    dontwarn="$dontwarn -Wswitch-default"
> -    # We allow optional default: instead of listing all enum values
> -    dontwarn="$dontwarn -Wswitch-enum"
> -    # Not a problem since we don't use -fstrict-overflow
> -    dontwarn="$dontwarn -Wstrict-overflow"
> -    # Not a problem since we don't use -funsafe-loop-optimizations
> -    dontwarn="$dontwarn -Wunsafe-loop-optimizations"
> -    # gcc 4.4.6 complains this is C++ only; gcc 4.7.0 implies this from -Wall
> -    dontwarn="$dontwarn -Wenum-compare"
> -    # gcc 5.1 -Wformat-signedness mishandles enums, not ready for prime time
> -    dontwarn="$dontwarn -Wformat-signedness"
> -    # Several conditionals expand the same on both branches
> -    # depending on the particular platform/architecture
> -    dontwarn="$dontwarn -Wduplicated-branches"
> -    # > This warning does not generally indicate that there is anything wrong
> -    # > with your code; it merely indicates that GCC's optimizers are unable
> -    # > to handle the code effectively.
> -    # Source: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
> -    dontwarn="$dontwarn -Wdisabled-optimization"
> -
> -    # gcc 4.2 treats attribute(format) as an implicit attribute(nonnull),
> -    # which triggers spurious warnings for our usage
> -    AC_CACHE_CHECK([whether the C compiler's -Wformat allows NULL strings],
> -      [lv_cv_gcc_wformat_null_works], [
> -      save_CFLAGS=$CFLAGS
> -      CFLAGS='-Wunknown-pragmas -Werror -Wformat'
> -      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
> -        #include <stddef.h>
> -        static __attribute__ ((__format__ (__printf__, 1, 2))) int
> -        foo (const char *fmt, ...) { return !fmt; }
> -      ]], [[
> -        return foo(NULL);
> -      ]])],
> -      [lv_cv_gcc_wformat_null_works=yes],
> -      [lv_cv_gcc_wformat_null_works=no])
> -      CFLAGS=$save_CFLAGS])
> -
> -    AC_CACHE_CHECK([whether gcc gives bogus warnings for -Wlogical-op],
> -      [lv_cv_gcc_wlogical_op_equal_expr_broken], [
> -        save_CFLAGS="$CFLAGS"
> -        CFLAGS="-O2 -Wlogical-op -Werror"
> -        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
> -          #define TEST1 1
> -          #define TEST2 TEST1
> -        ]], [[
> -          int test = 0;
> -          return test == TEST1 || test == TEST2;]])],
> -        [lv_cv_gcc_wlogical_op_equal_expr_broken=no],
> -        [lv_cv_gcc_wlogical_op_equal_expr_broken=yes])
> -        CFLAGS="$save_CFLAGS"])
> -
> -    AC_CACHE_CHECK([whether clang gives bogus warnings for -Wdouble-promotion],
> -      [lv_cv_clang_double_promotion_broken], [
> -        save_CFLAGS="$CFLAGS"
> -        CFLAGS="-O2 -Wdouble-promotion -Werror"
> -        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
> -          #include <math.h>
> -        ]], [[
> -          float f = 0.0;
> -         return isnan(f);]])],
> -        [lv_cv_clang_double_promotion_broken=no],
> -        [lv_cv_clang_double_promotion_broken=yes])
> -        CFLAGS="$save_CFLAGS"])
> -
> -    if test "$lv_cv_clang_double_promotion_broken" = "yes";
> -    then
> -      dontwarn="$dontwarn -Wdouble-promotion"
> -    fi
> -
> -    # Get all possible GCC warnings
> -    gl_MANYWARN_ALL_GCC([maybewarn])
> -
> -    # Remove the ones we don't want, blacklisted earlier
> -    gl_MANYWARN_COMPLEMENT([wantwarn], [$maybewarn], [$dontwarn])
> -
> -    # GNULIB expects this to be part of -Wc++-compat, but we turn
> -    # that one off, so we need to manually enable this again
> -    wantwarn="$wantwarn -Wjump-misses-init"
> -
> -    # -Wformat enables this by default, and we should keep it,
> -    # but need to rewrite various areas of code first
> -    wantwarn="$wantwarn -Wno-format-truncation"
> -
> -    # This should be < 256 really. Currently we're down to 4096,
> -    # but using 1024 bytes sized buffers (mostly for virStrerror)
> -    # stops us from going down further
> -    gl_WARN_ADD([-Wframe-larger-than=4096], [STRICT_FRAME_LIMIT_CFLAGS])
> -    gl_WARN_ADD([-Wframe-larger-than=25600], [RELAXED_FRAME_LIMIT_CFLAGS])
> -
> -    # Extra special flags
> -    dnl -fstack-protector stuff passes gl_WARN_ADD with gcc
> -    dnl on Mingw32, but fails when actually used
> -    case $host in
> -       aarch64-*-*)
> -       dnl "error: -fstack-protector not supported for this target [-Werror]"
> -       ;;
> -       *-*-linux*)
> -       dnl Prefer -fstack-protector-strong if it's available.
> -       dnl There doesn't seem to be great overhead in adding
> -       dnl -fstack-protector-all instead of -fstack-protector.
> -       dnl
> -       dnl We also don't need ssp-buffer-size with -all or -strong,
> -       dnl since functions are protected regardless of buffer size.
> -       dnl wantwarn="$wantwarn --param=ssp-buffer-size=4"
> -       wantwarn="$wantwarn -fstack-protector-strong"
> -       ;;
> -       *-*-freebsd*)
> -       dnl FreeBSD ships old gcc 4.2.1 which doesn't handle
> -       dnl -fstack-protector-all well
> -       wantwarn="$wantwarn -fstack-protector"
> -
> -       wantwarn="$wantwarn -Wno-unused-command-line-argument"
> -       ;;
> -    esac
> -    wantwarn="$wantwarn -fexceptions"
> -    wantwarn="$wantwarn -fasynchronous-unwind-tables"
> -
> -    # Need -fipa-pure-const in order to make -Wsuggest-attribute=pure
> -    # fire even without -O.
> -    wantwarn="$wantwarn -fipa-pure-const"
> -    # We do "bad" function cast to define glib auto cleanup functions
> -    wantwarn="$wantwarn -Wno-cast-function-type"
> -
> -    if test "$enable_werror" = "yes"
> -    then
> -      wantwarn="$wantwarn -Werror"
> -    fi
> -
> -    # Check for $CC support of each warning
> -    for w in $wantwarn; do
> -      gl_WARN_ADD([$w])
> -    done
> -
> -    case $host in
> -        *-*-linux*)
> -        dnl Fall back to -fstack-protector-all if -strong is not available
> -        case $WARN_CFLAGS in
> -        *-fstack-protector-strong*)
> -        ;;
> -        *)
> -            gl_WARN_ADD([-fstack-protector-all])
> -        ;;
> -        esac
> -        ;;
> -    esac
> -
> -    case $WARN_CFLAGS in
> -        *-Wsuggest-attribute=format*)
> -           AC_DEFINE([HAVE_SUGGEST_ATTRIBUTE_FORMAT], [1], [Whether -Wsuggest-attribute=format works])
> -        ;;
> -    esac
> -
> -    # Silence certain warnings in gnulib, and use improved glibc headers
> -    AH_VERBATIM([FORTIFY_SOURCE],
> -    [/* Enable compile-time and run-time bounds-checking, and some warnings,
> -        without upsetting newer glibc. */
> -     #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__
> -     # define _FORTIFY_SOURCE 2
> -     #endif
> -    ])
> -])
> diff --git a/m4/virt-linker-relro.m4 b/m4/virt-linker-relro.m4
> deleted file mode 100644
> index 7669b23..0000000
> --- a/m4/virt-linker-relro.m4
> +++ /dev/null
> @@ -1,35 +0,0 @@
> -dnl
> -dnl Check for -z now and -z relro linker flags
> -dnl
> -dnl Copyright (C) 2013 Red Hat, Inc.
> -dnl
> -dnl This library is free software; you can redistribute it and/or
> -dnl modify it under the terms of the GNU Lesser General Public
> -dnl License as published by the Free Software Foundation; either
> -dnl version 2.1 of the License, or (at your option) any later version.
> -dnl
> -dnl This library is distributed in the hope that it will be useful,
> -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
> -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> -dnl Lesser General Public License for more details.
> -dnl
> -dnl You should have received a copy of the GNU Lesser General Public
> -dnl License along with this library.  If not, see
> -dnl <http://www.gnu.org/licenses/>.
> -dnl
> -
> -AC_DEFUN([LIBVIRT_LINKER_RELRO],[
> -    AC_MSG_CHECKING([for how to force completely read-only GOT table])
> -
> -    RELRO_LDFLAGS=
> -    ld_help=`ld --help 2>&1`
> -    case $ld_help in
> -        *"-z relro"*) RELRO_LDFLAGS="-Wl,-z -Wl,relro" ;;
> -    esac
> -    case $ld_help in
> -        *"-z now"*) RELRO_LDFLAGS="$RELRO_LDFLAGS -Wl,-z -Wl,now" ;;
> -    esac
> -    AC_SUBST([RELRO_LDFLAGS])
> -
> -    AC_MSG_RESULT([$RELRO_LDFLAGS])
> -])
> diff --git a/m4/warnings.m4 b/m4/warnings.m4
> deleted file mode 100644
> index e697174..0000000
> --- a/m4/warnings.m4
> +++ /dev/null
> @@ -1,79 +0,0 @@
> -# warnings.m4 serial 11
> -dnl Copyright (C) 2008-2017 Free Software Foundation, Inc.
> -dnl This file is free software; the Free Software Foundation
> -dnl gives unlimited permission to copy and/or distribute it,
> -dnl with or without modifications, as long as this notice is preserved.
> -
> -dnl From Simon Josefsson
> -
> -# gl_AS_VAR_APPEND(VAR, VALUE)
> -# ----------------------------
> -# Provide the functionality of AS_VAR_APPEND if Autoconf does not have it.
> -m4_ifdef([AS_VAR_APPEND],
> -[m4_copy([AS_VAR_APPEND], [gl_AS_VAR_APPEND])],
> -[m4_define([gl_AS_VAR_APPEND],
> -[AS_VAR_SET([$1], [AS_VAR_GET([$1])$2])])])
> -
> -
> -# gl_COMPILER_OPTION_IF(OPTION, [IF-SUPPORTED], [IF-NOT-SUPPORTED],
> -#                       [PROGRAM = AC_LANG_PROGRAM()])
> -# -----------------------------------------------------------------
> -# Check if the compiler supports OPTION when compiling PROGRAM.
> -#
> -# FIXME: gl_Warn must be used unquoted until we can assume Autoconf
> -# 2.64 or newer.
> -AC_DEFUN([gl_COMPILER_OPTION_IF],
> -[AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_[]_AC_LANG_ABBREV[]_$1])dnl
> -AS_VAR_PUSHDEF([gl_Flags], [_AC_LANG_PREFIX[]FLAGS])dnl
> -AS_LITERAL_IF([$1],
> -  [m4_pushdef([gl_Positive], m4_bpatsubst([$1], [^-Wno-], [-W]))],
> -  [gl_positive="$1"
> -case $gl_positive in
> -  -Wno-*) gl_positive=-W`expr "X$gl_positive" : 'X-Wno-\(.*\)'` ;;
> -esac
> -m4_pushdef([gl_Positive], [$gl_positive])])dnl
> -AC_CACHE_CHECK([whether _AC_LANG compiler handles $1], m4_defn([gl_Warn]), [
> -  gl_save_compiler_FLAGS="$gl_Flags"
> -  gl_AS_VAR_APPEND(m4_defn([gl_Flags]),
> -    [" $gl_unknown_warnings_are_errors ]m4_defn([gl_Positive])["])
> -  AC_LINK_IFELSE([m4_default([$4], [AC_LANG_PROGRAM([])])],
> -                 [AS_VAR_SET(gl_Warn, [yes])],
> -                 [AS_VAR_SET(gl_Warn, [no])])
> -  gl_Flags="$gl_save_compiler_FLAGS"
> -])
> -AS_VAR_IF(gl_Warn, [yes], [$2], [$3])
> -m4_popdef([gl_Positive])dnl
> -AS_VAR_POPDEF([gl_Flags])dnl
> -AS_VAR_POPDEF([gl_Warn])dnl
> -])
> -
> -# gl_UNKNOWN_WARNINGS_ARE_ERRORS
> -# ------------------------------
> -# Clang doesn't complain about unknown warning options unless one also
> -# specifies -Wunknown-warning-option -Werror.  Detect this.
> -AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS],
> -[gl_COMPILER_OPTION_IF([-Werror -Wunknown-warning-option],
> -   [gl_unknown_warnings_are_errors='-Wunknown-warning-option -Werror'],
> -   [gl_unknown_warnings_are_errors=])])
> -
> -# gl_WARN_ADD(OPTION, [VARIABLE = WARN_CFLAGS],
> -#             [PROGRAM = AC_LANG_PROGRAM()])
> -# ---------------------------------------------
> -# Adds parameter to WARN_CFLAGS if the compiler supports it when
> -# compiling PROGRAM.  For example, gl_WARN_ADD([-Wparentheses]).
> -#
> -# If VARIABLE is a variable name, AC_SUBST it.
> -AC_DEFUN([gl_WARN_ADD],
> -[AC_REQUIRE([gl_UNKNOWN_WARNINGS_ARE_ERRORS])
> -gl_COMPILER_OPTION_IF([$1],
> -  [gl_AS_VAR_APPEND(m4_if([$2], [], [[WARN_CFLAGS]], [[$2]]), [" $1"])],
> -  [],
> -  [$3])
> -m4_ifval([$2],
> -         [AS_LITERAL_IF([$2], [AC_SUBST([$2])])],
> -         [AC_SUBST([WARN_CFLAGS])])dnl
> -])
> -
> -# Local Variables:
> -# mode: autoconf
> -# End:
> diff --git a/meson.build b/meson.build
> new file mode 100644
> index 0000000..30eeebe
> --- /dev/null
> +++ b/meson.build
> @@ -0,0 +1,279 @@
> +project(
> +    'libvirt-dbus', 'c',
> +    version: '1.4.0',
> +    license: 'LGPLv2+',
> +    meson_version: '>= 0.49.0',

In case you're really going for 0.50.0, this needs to be bumped ...

> +    default_options: [
> +        'buildtype=debugoptimized',
> +        'c_std=gnu99',
> +    ],
> +)
> +
> +
> +conf = configuration_data()
> +conf.set('MESON_VERSION', '0.49.0')

... and this one as well ...

> +conf.set('PACKAGE', meson.project_name())
> +conf.set('VERSION', meson.project_version())
> +conf.set('build_root', meson.build_root())
> +conf.set('sbindir', get_option('sbindir'))
> +conf.set('source_root', meson.source_root())
> +
> +# Dependencies
> +
> +glib2_version = '2.44.0'
> +libvirt_version = '3.0.0'
> +libvirt_glib_version = '0.0.7'
> +
> +dep_gio_unix = dependency('gio-unix-2.0', version: '>=' + glib2_version)
> +dep_glib = dependency('glib-2.0', version: '>=' + glib2_version)
> +dep_libvirt = dependency('libvirt', version: '>=' + libvirt_version)
> +dep_libvirt_glib = dependency('libvirt-glib-1.0', version: '>=' + libvirt_glib_version)
> +
> +conf.set('GLIB2_REQUIRED', glib2_version)
> +conf.set('LIBVIRT_REQUIRED', libvirt_version)
> +conf.set('LIBVIRT_GLIB_REQUIRED', libvirt_glib_version)
> +
> +git = run_command('test', '-d', '.git').returncode() == 0
> +
> +
> +# Configure options
> +
> +conf.set('SYSTEM_USER', get_option('system_user'))
> +
> +opt_dirs = [
> +    'dbus_interfaces',
> +    'dbus_services',
> +    'dbus_system_services',
> +    'dbus_system_policies',
> +    'polkit_rules',
> +]
> +
> +foreach opt_dir : opt_dirs
> +    value = get_option(opt_dir)
> +    varname = '@0@_dir'.format(opt_dir)
> +    if opt_dir.startswith('/')
> +        set_variable(varname, value)
> +    else
> +        set_variable(varname, join_paths(get_option('datadir'), value))
> +    endif
> +endforeach
> +
> +
> +# Compile flags
> +
> +common_flags = [
> +    '-DVIRT_DBUS_INTERFACES_DIR="@0@"'.format(dbus_interfaces_dir),
> +]
> +
> +cc_flags = [
> +    '-W',
> +    '-Waddress',
> +    '-Waggressive-loop-optimizations',
> +    '-Wall',
> +    '-Warray-bounds=2',
> +    '-Wattributes',
> +    '-Wbad-function-cast',
> +    '-Wbool-compare',
> +    '-Wbuiltin-macro-redefined',
> +    '-Wcast-align',
> +    '-Wchar-subscripts',
> +    '-Wclobbered',
> +    '-Wcomment',
> +    '-Wcomments',
> +    '-Wcoverage-mismatch',
> +    '-Wcpp',
> +    '-Wdate-time',
> +    '-Wdeprecated-declarations',
> +    '-Wdesignated-init',
> +    '-Wdiscarded-array-qualifiers',
> +    '-Wdiscarded-qualifiers',
> +    '-Wdiv-by-zero',
> +    '-Wdouble-promotion',
> +    '-Wduplicated-cond',
> +    '-Wempty-body',
> +    '-Wendif-labels',
> +    '-Wextra',
> +    '-Wformat',
> +    '-Wformat-contains-nul',
> +    '-Wformat-extra-args',
> +    '-Wformat-nonliteral',
> +    '-Wformat-security',
> +    '-Wformat-y2k',
> +    '-Wformat-zero-length',
> +    '-Wframe-address',
> +    '-Wframe-larger-than=1024',
> +    '-Wfree-nonheap-object',
> +    '-Whsa',
> +    '-Wignored-attributes',
> +    '-Wignored-qualifiers',
> +    '-Wimplicit',
> +    '-Wimplicit-function-declaration',
> +    '-Wimplicit-int',
> +    '-Wincompatible-pointer-types',
> +    '-Winit-self',
> +    '-Winline',
> +    '-Wint-conversion',
> +    '-Wint-to-pointer-cast',
> +    '-Winvalid-memory-model',
> +    '-Winvalid-pch',
> +    '-Wjump-misses-init',
> +    '-Wlogical-not-parentheses',
> +    '-Wlogical-op',
> +    '-Wmain',
> +    '-Wmaybe-uninitialized',
> +    '-Wmemset-transposed-args',
> +    '-Wmisleading-indentation',
> +    '-Wmissing-braces',
> +    '-Wmissing-declarations',
> +    '-Wmissing-field-initializers',
> +    '-Wmissing-include-dirs',
> +    '-Wmissing-parameter-type',
> +    '-Wmissing-prototypes',
> +    '-Wmultichar',
> +    '-Wnarrowing',
> +    '-Wnested-externs',
> +    '-Wno-cast-function-type',
> +    '-Wnonnull',
> +    '-Wnonnull-compare',
> +    '-Wnormalized=nfc',
> +    '-Wnull-dereference',
> +    '-Wodr',
> +    '-Wold-style-declaration',
> +    '-Wold-style-definition',
> +    '-Wopenmp-simd',
> +    '-Woverflow',
> +    '-Woverlength-strings',
> +    '-Woverride-init',
> +    '-Wpacked',
> +    '-Wpacked-bitfield-compat',
> +    '-Wparentheses',
> +    '-Wpointer-arith',
> +    '-Wpointer-sign',
> +    '-Wpointer-to-int-cast',
> +    '-Wpragmas',
> +    '-Wreturn-local-addr',
> +    '-Wreturn-type',
> +    '-Wscalar-storage-order',
> +    '-Wsequence-point',
> +    '-Wshadow',
> +    '-Wshift-count-negative',
> +    '-Wshift-count-overflow',
> +    '-Wshift-negative-value',
> +    '-Wshift-overflow=2',
> +    '-Wsizeof-array-argument',
> +    '-Wsizeof-pointer-memaccess',
> +    '-Wstack-protector',
> +    '-Wstrict-aliasing',
> +    '-Wstrict-prototypes',
> +    '-Wsuggest-attribute=const',
> +    '-Wsuggest-attribute=format',
> +    '-Wsuggest-attribute=noreturn',
> +    '-Wsuggest-attribute=pure',
> +    '-Wsuggest-final-methods',
> +    '-Wsuggest-final-types',
> +    '-Wswitch',
> +    '-Wswitch-bool',
> +    '-Wsync-nand',
> +    '-Wtautological-compare',
> +    '-Wtrampolines',
> +    '-Wtrigraphs',
> +    '-Wtype-limits',
> +    '-Wuninitialized',
> +    '-Wunknown-pragmas',
> +    '-Wunused',
> +    '-Wunused-but-set-parameter',
> +    '-Wunused-but-set-variable',
> +    '-Wunused-const-variable=2',
> +    '-Wunused-function',
> +    '-Wunused-label',
> +    '-Wunused-local-typedefs',
> +    '-Wunused-macros',
> +    '-Wunused-parameter',
> +    '-Wunused-result',
> +    '-Wunused-value',
> +    '-Wunused-variable',
> +    '-Wvarargs',
> +    '-Wvariadic-macros',
> +    '-Wvector-operation-performance',
> +    '-Wvla',
> +    '-Wvolatile-register-var',
> +    '-Wwrite-strings',
> +    '-fasynchronous-unwind-tables',
> +    '-fexceptions',
> +    '-fipa-pure-const',
> +    '-fno-common',
> +]
> +ld_flags = [
> +    '-Wl,-z,now',
> +    '-Wl,-z,relro',
> +]
> +
> +if git
> +    cc_flags += ['-Werror']
> +endif
> +
> +if host_machine.cpu_family() != 'aarch64'
> +    if host_machine.system() == 'linux'
> +        cc_flags += ['-fstack-protector-strong']
> +    endif
> +    if host_machine.system() == 'freebsd'
> +        cc_flags += ['-fstack-protector']
> +    endif
> +endif
> +
> +if host_machine.system() not in ['cygwin', 'windows']
> +    cc_flags += ['-fPIE', '-DPIE']
> +    ld_flags += ['-pie']
> +endif
> +
> +cc = meson.get_compiler('c')
> +common_flags += cc.get_supported_arguments(cc_flags)
> +link_flags = cc.get_supported_link_arguments(ld_flags)
> +
> +add_project_arguments(common_flags, language: 'c')
> +add_project_link_arguments(link_flags, language: 'c')
> +
> +
> +# Generate run helper
> +
> +configure_file(
> +    input: 'run.in',
> +    output: 'run',
> +    configuration: conf,
> +)
> +run_command('tools/fix-perm.sh', 'a+x', 'run')
> +
> +
> +# Generate dist files
> +
> +if git
> +    configure_file(
> +        input: 'libvirt-dbus.spec.in',
> +        output: 'libvirt-dbus.spec',
> +        configuration: conf,
> +    )
> +
> +    authors = run_command('tools/gen-authors.sh')
> +    configure_file(
> +        configuration: { 'contributorslist': authors.stdout() },
> +        input: 'AUTHORS.in',
> +        output: 'AUTHORS',
> +    )
> +
> +    foreach file : [ 'libvirt-dbus.spec', 'AUTHORS' ]
> +        path = join_paths(meson.build_root(), file)
> +        meson.add_dist_script(
> +            'sh',
> +            '-c',
> +            'cp "@0@" "$MESON_DIST_ROOT/"'.format(path),
> +        )
> +    endforeach

You're using scripts everywhere, I'd use one here as well, as
suggested by Andrea during our face-to-face meeting.


> +endif
> +
> +
> +# Include sub-directories
> +
> +subdir('data')
> +subdir('docs')
> +subdir('src')
> +subdir('tests')
> diff --git a/meson_options.txt b/meson_options.txt
> new file mode 100644
> index 0000000..36e8065
> --- /dev/null
> +++ b/meson_options.txt
> @@ -0,0 +1,6 @@
> +option('dbus_services', type: 'string', value: 'dbus-1/services', description: 'D-Bus session services directory')
> +option('dbus_system_services', type: 'string', value: 'dbus-1/system-services', description: 'D-Bus system services directory')
> +option('dbus_system_policies', type: 'string', value: 'dbus-1/system.d', description: 'D-Bus system policies directory')
> +option('dbus_interfaces', type: 'string', value: 'dbus-1/interfaces', description: 'D-Bus interfaces directory')
> +option('polkit_rules', type: 'string', value: 'polkit-1/rules.d', description: 'polkit rules directory')
> +option('system_user', type: 'string', value: 'libvirtdbus', description: 'username to run system instance as')
> diff --git a/run.in b/run.in
> index 0744a80..1b2207e 100644
> --- a/run.in
> +++ b/run.in
> @@ -14,7 +14,7 @@
>  #   ./run gdb --args ./src/libvirt-dbus [args ...]
>  #
>
> -export abs_top_builddir="@abs_top_builddir@"
> -export VIRT_DBUS_INTERFACES_DIR="@abs_top_srcdir@/data"
> +export abs_top_builddir="@build_root@"
> +export VIRT_DBUS_INTERFACES_DIR="@source_root@/data"
>
>  exec "$@"
> diff --git a/src/Makefile.am b/src/Makefile.am
> deleted file mode 100644
> index 845696e..0000000
> --- a/src/Makefile.am
> +++ /dev/null
> @@ -1,66 +0,0 @@
> -AM_CPPFLAGS = \
> -       -I$(top_srcdir)/src \
> -       -DVIRT_DBUS_INTERFACES_DIR=\"$(DBUS_INTERFACES_DIR)\" \
> -       $(NULL)
> -AM_CFLAGS = \
> -       $(GIO2_CFLAGS) \
> -       $(GLIB2_CFLAGS) \
> -       $(LIBVIRT_CFLAGS) \
> -       $(LIBVIRT_GLIB_CFLAGS) \
> -       $(WARN_CFLAGS) \
> -       $(PIE_CFLAGS) \
> -       $(NULL)
> -AM_LDFLAGS = \
> -       $(GIO2_LDFLAGS) \
> -       $(GLIB2_LDFLAGS) \
> -       $(LIBVIRT_LDFLAGS) \
> -       $(LIBVIRT_GLIB_LDFLAGS) \
> -       $(RELRO_LDFLAGS) \
> -       $(PIE_LDFLAGS) \
> -       $(NULL)
> -
> -noinst_LTLIBRARIES = \
> -       libutil.la \
> -       $(NULL)
> -
> -libutil_la_SOURCES = \
> -       util.c \
> -       util.h \
> -       $(NULL)
> -
> -sbin_PROGRAMS = \
> -       libvirt-dbus \
> -       $(NULL)
> -
> -libvirt_dbus_SOURCES = \
> -       connect.c \
> -       connect.h \
> -       domain.c \
> -       domain.h \
> -       events.c \
> -       events.h \
> -       gdbus.c \
> -       gdbus.h \
> -       interface.c \
> -       interface.h \
> -       main.c \
> -       network.c \
> -       network.h \
> -       nodedev.c \
> -       nodedev.h \
> -       nwfilter.c \
> -       nwfilter.h \
> -       secret.c \
> -       secret.h \
> -       storagepool.c \
> -       storagepool.h \
> -       storagevol.c \
> -       storagevol.h \
> -       $(NULL)
> -libvirt_dbus_LDADD = \
> -       libutil.la \
> -       $(GIO2_LIBS) \
> -       $(GLIB2_LIBS) \
> -       $(LIBVIRT_LIBS) \
> -       $(LIBVIRT_GLIB_LIBS) \
> -       $(NULL)
> diff --git a/src/meson.build b/src/meson.build
> new file mode 100644
> index 0000000..a848bcd
> --- /dev/null
> +++ b/src/meson.build
> @@ -0,0 +1,42 @@
> +lib_util = static_library(
> +    'libutil',
> +    [
> +        'util.c',
> +    ],
> +    dependencies: [
> +        dep_gio_unix,
> +        dep_glib,
> +        dep_libvirt,
> +        dep_libvirt_glib
> +    ],
> +)
> +
> +exe_libvirt_dbus = executable(
> +    'libvirt-dbus',
> +    [
> +        'connect.c',
> +        'domain.c',
> +        'events.c',
> +        'gdbus.c',
> +        'interface.c',
> +        'main.c',
> +        'network.c',
> +        'nodedev.c',
> +        'nwfilter.c',
> +        'secret.c',
> +        'storagepool.c',
> +        'storagevol.c',
> +    ],
> +    dependencies: [
> +        dep_gio_unix,
> +        dep_glib,
> +        dep_libvirt,
> +        dep_libvirt_glib
> +    ],
> +    link_with: [
> +        lib_util,
> +    ],
> +    install: true,
> +    install_dir: get_option('sbindir'),
> +)
> +
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> deleted file mode 100644
> index cd1fbd7..0000000
> --- a/tests/Makefile.am
> +++ /dev/null
> @@ -1,57 +0,0 @@
> -AM_CPPFLAGS = \
> -       -I$(top_srcdir)/src \
> -       $(NULL)
> -
> -test_helpers = \
> -       xmldata.py \
> -       libvirttest.py \
> -       conftest.py \
> -       $(NULL)
> -
> -test_programs = \
> -       test_connect.py \
> -       test_domain.py \
> -       test_interface.py \
> -       test_network.py \
> -       test_nodedev.py \
> -       test_storage.py \
> -       $(NULL)
> -
> -check_PROGRAMS = \
> -       test_util \
> -       $(NULL)
> -
> -test_util_SOURCES = \
> -       test_util.c \
> -       $(NULL)
> -test_util_CFLAGS = \
> -       $(GIO2_CFLAGS) \
> -       $(GLIB2_CFLAGS) \
> -       $(LIBVIRT_CFLAGS) \
> -       $(NULL)
> -test_util_LDFLAGS = \
> -       $(GIO2_LDFLAGS) \
> -       $(GLIB2_LDFLAGS) \
> -       $(LIBVIRT_LDFLAGS) \
> -       $(NULL)
> -test_util_LDADD = \
> -       $(top_builddir)/src/libutil.la \
> -       $(GIO2_LIBS) \
> -       $(GLIB2_LIBS) \
> -       $(LIBVIRT_LIBS) \
> -       $(NULL)
> -
> -EXTRA_DIST = \
> -       $(test_helpers) \
> -       $(test_programs) \
> -       travis-run \
> -       $(NULL)
> -
> -TESTS = \
> -       $(check_PROGRAMS) \
> -       $(test_programs) \
> -       $(NULL)
> -
> -AM_TESTS_ENVIRONMENT = \
> -       export abs_top_builddir="$(abs_top_builddir)"; \
> -       export VIRT_DBUS_INTERFACES_DIR="$(abs_top_srcdir)/data";
> diff --git a/tests/meson.build b/tests/meson.build
> new file mode 100644
> index 0000000..6617d4c
> --- /dev/null
> +++ b/tests/meson.build
> @@ -0,0 +1,52 @@
> +src_include = include_directories('../src')
> +
> +test_exec = executable(
> +    'test_util',
> +    [
> +        'test_util.c',
> +    ],
> +    dependencies: [
> +        dep_gio_unix,
> +        dep_glib,
> +        dep_libvirt,
> +        dep_libvirt_glib
> +    ],
> +    link_with: [
> +        lib_util,
> +    ],
> +    include_directories: src_include,
> +)
> +
> +test('test_util', test_exec, suite: 'unit')
> +
> +python_tests = [
> +    'test_connect.py',
> +    'test_domain.py',
> +    'test_interface.py',
> +    'test_network.py',
> +    'test_nodedev.py',
> +    'test_storage.py',
> +]
> +
> +python_env = [
> +    'abs_top_builddir=' + meson.build_root(),
> +    'VIRT_DBUS_INTERFACES_DIR=' + meson.source_root() + '/data'
> +]
> +
> +foreach name : python_tests
> +    prog = find_program(name)
> +    test(name, prog, env: python_env, suite: 'unit')
> +endforeach
> +
> +flake8 = find_program('flake8', 'flake8-3', required: false)
> +if flake8.found()
> +    test(
> +        'flake8', flake8,
> +        args: [
> +            '--show-source',
> +            '--ignore=E501', # E501: (line too long) warning is ignored.
> +            meson.source_root(),
> +        ],
> +        suite: 'syntax',
> +    )
> +endif
> diff --git a/tools/fix-perm.sh b/tools/fix-perm.sh
> new file mode 100755
> index 0000000..ed444d4
> --- /dev/null
> +++ b/tools/fix-perm.sh
> @@ -0,0 +1,3 @@
> +#!/bin/sh
> +
> +chmod $1 $MESON_BUILD_ROOT/$2
> diff --git a/tools/gen-authors.sh b/tools/gen-authors.sh
> new file mode 100755
> index 0000000..eb39215
> --- /dev/null
> +++ b/tools/gen-authors.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh
> +
> +cd $MESON_SOURCE_ROOT
> +git log --pretty=format:'    %aN <%aE>' | sort -u
> --
> 2.21.0
>
> --
> libvir-list mailing list
> libvir-list@redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

In general, it looks good and works as expected.
I will add my "Reviewed-by: " after we discuss the points raised.

Another thing, please, let's sync to have the libvirt-jenkins-ci work
done and merged before this one gets merged.

Best Regards,
-- 
Fabiano Fidêncio

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [dbus PATCH v2] build: convert to Meson/Ninja build system
Posted by Fabiano Fidêncio 4 years, 7 months ago
On Fri, Sep 20, 2019 at 1:28 PM Fabiano Fidêncio <fidencio@redhat.com> wrote:
>
> On Fri, Sep 20, 2019 at 11:05 AM Pavel Hrdina <phrdina@redhat.com> 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@redhat.com>
> > Tested-by: Ján Tomko <jtomko@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
>
> Why? Not opposed to this decision, just want to understand the reason for that.
>
> >         - 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
>
> By using 0.50.0 you're dropping support on:
> - Debian 10;
> - Ubuntu 19.04;
>
> Personally, I would stick to 0.49.0.

So, let me see if I properly understood your comment.
You mean that before you were requiring 0.50.0 and now, because you
changed the way to deal with the include_directories, you require
0.49.0. Is it?
If so, just ignore my comment in the previous email.

Best Regards,
-- 
Fabiano Fidêncio

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [dbus PATCH v2] build: convert to Meson/Ninja build system
Posted by Pavel Hrdina 4 years, 7 months ago
On Fri, Sep 20, 2019 at 01:28:28PM +0200, Fabiano Fidêncio wrote:
> On Fri, Sep 20, 2019 at 11:05 AM Pavel Hrdina <phrdina@redhat.com> 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@redhat.com>
> > Tested-by: Ján Tomko <jtomko@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
> 
> Why? Not opposed to this decision, just want to understand the reason for that.

This is what was done by Autotools, at least for AUTHORS.  If you are
compiling libvirt-dbus from tarball you don't have git so you will not
be able to generate AUTHORS.  For the spec file my idea was that there
is no need to regenerate it from tarball as that one is usually used as
it is.

> >         - 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
> 
> By using 0.50.0 you're dropping support on:
> - Debian 10;
> - Ubuntu 19.04;
> 
> Personally, I would stick to 0.49.0.

Ignored per following email :).

> >         - flake8 is optional as it was with autotools
> >         - added meson version into spec file

[...]

> > --- a/autogen.sh
> > +++ /dev/null
> > @@ -1,52 +0,0 @@
> > -#!/bin/sh
> > -# Run this to generate all the initial makefiles, etc.
> > -
> > -set -e
> > -srcdir=`dirname $0`
> > -test -z "$srcdir" && srcdir=.
> > -
> > -THEDIR=`pwd`
> > -cd $srcdir
> > -
> > -DIE=0
> > -
> > -for prog in autoreconf automake autoconf libtoolize
> > -do
> > -    ($prog --version) < /dev/null > /dev/null 2>&1 || {
> > -        echo
> > -        echo "You must have $prog installed to compile libvirt-dbus."
> > -        DIE=1
> > -    }
> > -done
> > -
> > -if test "$DIE" -eq 1; then
> > -        exit 1
> > -fi
> > -
> > -if test -z "$*"; then
> > -        echo "I am going to run ./configure with no args - if you "
> > -        echo "wish to pass any extra arguments to it, please specify them on "
> > -        echo "the $0 command line."
> > -fi
> > -
> > -mkdir -p build-aux
> > -autoreconf -if
> > -
> > -cd $THEDIR
> > -
> > -if test "x$1" = "x--system"; then
> > -    shift
> > -    prefix=/usr
> > -    libdir=$prefix/lib
> > -    sysconfdir=/etc
> > -    localstatedir=/var
> > -    if [ -d /usr/lib64 ]; then
> > -      libdir=$prefix/lib64
> > -    fi
> > -    EXTRA_ARGS="--prefix=$prefix --sysconfdir=$sysconfdir --localstatedir=$localstatedir --libdir=$libdir"
> > -fi
> 
> --system ended up being remove here but never added back.
> AFAIU that's a pattern followed by libvirt* projects and, if that's
> the case, may be worth to adding it back.

Good point, should have mentioned it in the commit message.
The --system option is usually used only by libvirt developers if they
need to run libvirt from git with system configuration files, I doubt
that anyone is actually using it with libvirt-dbus as there is probably
no need at all.

> > -
> > -$srcdir/configure $EXTRA_ARGS "$@" && {
> > -    echo
> > -    echo "Now type 'make' to compile libvirt-dbus."
> > -}

[...]

> > diff --git a/meson.build b/meson.build
> > new file mode 100644
> > index 0000000..30eeebe
> > --- /dev/null
> > +++ b/meson.build
> > @@ -0,0 +1,279 @@
> > +project(
> > +    'libvirt-dbus', 'c',
> > +    version: '1.4.0',
> > +    license: 'LGPLv2+',
> > +    meson_version: '>= 0.49.0',
> 
> In case you're really going for 0.50.0, this needs to be bumped ...
> 
> > +    default_options: [
> > +        'buildtype=debugoptimized',
> > +        'c_std=gnu99',
> > +    ],
> > +)
> > +
> > +
> > +conf = configuration_data()
> > +conf.set('MESON_VERSION', '0.49.0')
> 
> ... and this one as well ...
> 
> > +conf.set('PACKAGE', meson.project_name())
> > +conf.set('VERSION', meson.project_version())
> > +conf.set('build_root', meson.build_root())
> > +conf.set('sbindir', get_option('sbindir'))
> > +conf.set('source_root', meson.source_root())
> > +
> > +# Dependencies
> > +
> > +glib2_version = '2.44.0'
> > +libvirt_version = '3.0.0'
> > +libvirt_glib_version = '0.0.7'
> > +
> > +dep_gio_unix = dependency('gio-unix-2.0', version: '>=' + glib2_version)
> > +dep_glib = dependency('glib-2.0', version: '>=' + glib2_version)
> > +dep_libvirt = dependency('libvirt', version: '>=' + libvirt_version)
> > +dep_libvirt_glib = dependency('libvirt-glib-1.0', version: '>=' + libvirt_glib_version)
> > +
> > +conf.set('GLIB2_REQUIRED', glib2_version)
> > +conf.set('LIBVIRT_REQUIRED', libvirt_version)
> > +conf.set('LIBVIRT_GLIB_REQUIRED', libvirt_glib_version)
> > +
> > +git = run_command('test', '-d', '.git').returncode() == 0
> > +
> > +
> > +# Configure options
> > +
> > +conf.set('SYSTEM_USER', get_option('system_user'))
> > +
> > +opt_dirs = [
> > +    'dbus_interfaces',
> > +    'dbus_services',
> > +    'dbus_system_services',
> > +    'dbus_system_policies',
> > +    'polkit_rules',
> > +]
> > +
> > +foreach opt_dir : opt_dirs
> > +    value = get_option(opt_dir)
> > +    varname = '@0@_dir'.format(opt_dir)
> > +    if opt_dir.startswith('/')
> > +        set_variable(varname, value)
> > +    else
> > +        set_variable(varname, join_paths(get_option('datadir'), value))
> > +    endif
> > +endforeach
> > +
> > +
> > +# Compile flags
> > +
> > +common_flags = [
> > +    '-DVIRT_DBUS_INTERFACES_DIR="@0@"'.format(dbus_interfaces_dir),
> > +]
> > +
> > +cc_flags = [
> > +    '-W',
> > +    '-Waddress',
> > +    '-Waggressive-loop-optimizations',
> > +    '-Wall',
> > +    '-Warray-bounds=2',
> > +    '-Wattributes',
> > +    '-Wbad-function-cast',
> > +    '-Wbool-compare',
> > +    '-Wbuiltin-macro-redefined',
> > +    '-Wcast-align',
> > +    '-Wchar-subscripts',
> > +    '-Wclobbered',
> > +    '-Wcomment',
> > +    '-Wcomments',
> > +    '-Wcoverage-mismatch',
> > +    '-Wcpp',
> > +    '-Wdate-time',
> > +    '-Wdeprecated-declarations',
> > +    '-Wdesignated-init',
> > +    '-Wdiscarded-array-qualifiers',
> > +    '-Wdiscarded-qualifiers',
> > +    '-Wdiv-by-zero',
> > +    '-Wdouble-promotion',
> > +    '-Wduplicated-cond',
> > +    '-Wempty-body',
> > +    '-Wendif-labels',
> > +    '-Wextra',
> > +    '-Wformat',
> > +    '-Wformat-contains-nul',
> > +    '-Wformat-extra-args',
> > +    '-Wformat-nonliteral',
> > +    '-Wformat-security',
> > +    '-Wformat-y2k',
> > +    '-Wformat-zero-length',
> > +    '-Wframe-address',
> > +    '-Wframe-larger-than=1024',
> > +    '-Wfree-nonheap-object',
> > +    '-Whsa',
> > +    '-Wignored-attributes',
> > +    '-Wignored-qualifiers',
> > +    '-Wimplicit',
> > +    '-Wimplicit-function-declaration',
> > +    '-Wimplicit-int',
> > +    '-Wincompatible-pointer-types',
> > +    '-Winit-self',
> > +    '-Winline',
> > +    '-Wint-conversion',
> > +    '-Wint-to-pointer-cast',
> > +    '-Winvalid-memory-model',
> > +    '-Winvalid-pch',
> > +    '-Wjump-misses-init',
> > +    '-Wlogical-not-parentheses',
> > +    '-Wlogical-op',
> > +    '-Wmain',
> > +    '-Wmaybe-uninitialized',
> > +    '-Wmemset-transposed-args',
> > +    '-Wmisleading-indentation',
> > +    '-Wmissing-braces',
> > +    '-Wmissing-declarations',
> > +    '-Wmissing-field-initializers',
> > +    '-Wmissing-include-dirs',
> > +    '-Wmissing-parameter-type',
> > +    '-Wmissing-prototypes',
> > +    '-Wmultichar',
> > +    '-Wnarrowing',
> > +    '-Wnested-externs',
> > +    '-Wno-cast-function-type',
> > +    '-Wnonnull',
> > +    '-Wnonnull-compare',
> > +    '-Wnormalized=nfc',
> > +    '-Wnull-dereference',
> > +    '-Wodr',
> > +    '-Wold-style-declaration',
> > +    '-Wold-style-definition',
> > +    '-Wopenmp-simd',
> > +    '-Woverflow',
> > +    '-Woverlength-strings',
> > +    '-Woverride-init',
> > +    '-Wpacked',
> > +    '-Wpacked-bitfield-compat',
> > +    '-Wparentheses',
> > +    '-Wpointer-arith',
> > +    '-Wpointer-sign',
> > +    '-Wpointer-to-int-cast',
> > +    '-Wpragmas',
> > +    '-Wreturn-local-addr',
> > +    '-Wreturn-type',
> > +    '-Wscalar-storage-order',
> > +    '-Wsequence-point',
> > +    '-Wshadow',
> > +    '-Wshift-count-negative',
> > +    '-Wshift-count-overflow',
> > +    '-Wshift-negative-value',
> > +    '-Wshift-overflow=2',
> > +    '-Wsizeof-array-argument',
> > +    '-Wsizeof-pointer-memaccess',
> > +    '-Wstack-protector',
> > +    '-Wstrict-aliasing',
> > +    '-Wstrict-prototypes',
> > +    '-Wsuggest-attribute=const',
> > +    '-Wsuggest-attribute=format',
> > +    '-Wsuggest-attribute=noreturn',
> > +    '-Wsuggest-attribute=pure',
> > +    '-Wsuggest-final-methods',
> > +    '-Wsuggest-final-types',
> > +    '-Wswitch',
> > +    '-Wswitch-bool',
> > +    '-Wsync-nand',
> > +    '-Wtautological-compare',
> > +    '-Wtrampolines',
> > +    '-Wtrigraphs',
> > +    '-Wtype-limits',
> > +    '-Wuninitialized',
> > +    '-Wunknown-pragmas',
> > +    '-Wunused',
> > +    '-Wunused-but-set-parameter',
> > +    '-Wunused-but-set-variable',
> > +    '-Wunused-const-variable=2',
> > +    '-Wunused-function',
> > +    '-Wunused-label',
> > +    '-Wunused-local-typedefs',
> > +    '-Wunused-macros',
> > +    '-Wunused-parameter',
> > +    '-Wunused-result',
> > +    '-Wunused-value',
> > +    '-Wunused-variable',
> > +    '-Wvarargs',
> > +    '-Wvariadic-macros',
> > +    '-Wvector-operation-performance',
> > +    '-Wvla',
> > +    '-Wvolatile-register-var',
> > +    '-Wwrite-strings',
> > +    '-fasynchronous-unwind-tables',
> > +    '-fexceptions',
> > +    '-fipa-pure-const',
> > +    '-fno-common',
> > +]
> > +ld_flags = [
> > +    '-Wl,-z,now',
> > +    '-Wl,-z,relro',
> > +]
> > +
> > +if git
> > +    cc_flags += ['-Werror']
> > +endif
> > +
> > +if host_machine.cpu_family() != 'aarch64'
> > +    if host_machine.system() == 'linux'
> > +        cc_flags += ['-fstack-protector-strong']
> > +    endif
> > +    if host_machine.system() == 'freebsd'
> > +        cc_flags += ['-fstack-protector']
> > +    endif
> > +endif
> > +
> > +if host_machine.system() not in ['cygwin', 'windows']
> > +    cc_flags += ['-fPIE', '-DPIE']
> > +    ld_flags += ['-pie']
> > +endif
> > +
> > +cc = meson.get_compiler('c')
> > +common_flags += cc.get_supported_arguments(cc_flags)
> > +link_flags = cc.get_supported_link_arguments(ld_flags)
> > +
> > +add_project_arguments(common_flags, language: 'c')
> > +add_project_link_arguments(link_flags, language: 'c')
> > +
> > +
> > +# Generate run helper
> > +
> > +configure_file(
> > +    input: 'run.in',
> > +    output: 'run',
> > +    configuration: conf,
> > +)
> > +run_command('tools/fix-perm.sh', 'a+x', 'run')
> > +
> > +
> > +# Generate dist files
> > +
> > +if git
> > +    configure_file(
> > +        input: 'libvirt-dbus.spec.in',
> > +        output: 'libvirt-dbus.spec',
> > +        configuration: conf,
> > +    )
> > +
> > +    authors = run_command('tools/gen-authors.sh')
> > +    configure_file(
> > +        configuration: { 'contributorslist': authors.stdout() },
> > +        input: 'AUTHORS.in',
> > +        output: 'AUTHORS',
> > +    )
> > +
> > +    foreach file : [ 'libvirt-dbus.spec', 'AUTHORS' ]
> > +        path = join_paths(meson.build_root(), file)
> > +        meson.add_dist_script(
> > +            'sh',
> > +            '-c',
> > +            'cp "@0@" "$MESON_DIST_ROOT/"'.format(path),
> > +        )
> > +    endforeach
> 
> You're using scripts everywhere, I'd use one here as well, as
> suggested by Andrea during our face-to-face meeting.

Right, I knew that I've missed something, will fix, thanks.

> > +endif
> > +
> > +
> > +# Include sub-directories
> > +
> > +subdir('data')
> > +subdir('docs')
> > +subdir('src')
> > +subdir('tests')

[...]

> In general, it looks good and works as expected.
> I will add my "Reviewed-by: " after we discuss the points raised.
> 
> Another thing, please, let's sync to have the libvirt-jenkins-ci work
> done and merged before this one gets merged.

Works for me, thanks for review, I'll fix the dist script to use a shell
script.

Pavel
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [dbus PATCH v2] build: convert to Meson/Ninja build system
Posted by Fabiano Fidêncio 4 years, 7 months ago
[snip]

>
> > In general, it looks good and works as expected.
> > I will add my "Reviewed-by: " after we discuss the points raised.
> >
> > Another thing, please, let's sync to have the libvirt-jenkins-ci work
> > done and merged before this one gets merged.
>
> Works for me, thanks for review, I'll fix the dist script to use a shell
> script.
>

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [dbus PATCH v2] build: convert to Meson/Ninja build system
Posted by Fabiano Fidêncio 4 years, 7 months ago
On Fri, Sep 20, 2019 at 2:34 PM Fabiano Fidêncio <fidencio@redhat.com> wrote:
>
> [snip]
>
> >
> > > In general, it looks good and works as expected.
> > > I will add my "Reviewed-by: " after we discuss the points raised.
> > >
> > > Another thing, please, let's sync to have the libvirt-jenkins-ci work
> > > done and merged before this one gets merged.
> >
> > Works for me, thanks for review, I'll fix the dist script to use a shell
> > script.
> >
>
> Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>

One last things here (thanks, Pavel, for pointing this out), I'd
prefer the 'syntax' suite being called 'syntax-check' just because
people are already used to the 'syntax-check' name.

So, please, would you mind changing it as well?

Best Regards,
-- 
Fabiano Fidêncio

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [dbus PATCH v2] build: convert to Meson/Ninja build system
Posted by Pavel Hrdina 4 years, 6 months ago
On Sat, Sep 21, 2019 at 09:22:38AM +0200, Fabiano Fidêncio wrote:
> On Fri, Sep 20, 2019 at 2:34 PM Fabiano Fidêncio <fidencio@redhat.com> wrote:
> >
> > [snip]
> >
> > >
> > > > In general, it looks good and works as expected.
> > > > I will add my "Reviewed-by: " after we discuss the points raised.
> > > >
> > > > Another thing, please, let's sync to have the libvirt-jenkins-ci work
> > > > done and merged before this one gets merged.
> > >
> > > Works for me, thanks for review, I'll fix the dist script to use a shell
> > > script.
> > >
> >
> > Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
> 
> One last things here (thanks, Pavel, for pointing this out), I'd
> prefer the 'syntax' suite being called 'syntax-check' just because
> people are already used to the 'syntax-check' name.
> 
> So, please, would you mind changing it as well?

I don't mind changing it if we agree on the naming, I'll have one last
argument for the shorter and easier to type name, coping it from the
comment on gitlab:

To me it feels redundant to have the `check` as part of the suit label
as you already know that you are running test suit so the check is
somehow implied. Consistency is a nice thing if it makes sense, but we
are completely changing the workflow so I don't see any reason to pick
longer and redundant name just for consistency reasons.

Based on that I still prefer using simply `syntax`, let's see of others
have some opinion about it.

Thanks,

Pavel
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [dbus PATCH v2] build: convert to Meson/Ninja build system
Posted by Andrea Bolognani 4 years, 6 months ago
On Mon, 2019-09-23 at 10:17 +0200, Pavel Hrdina wrote:
> On Sat, Sep 21, 2019 at 09:22:38AM +0200, Fabiano Fidêncio wrote:
> > One last things here (thanks, Pavel, for pointing this out), I'd
> > prefer the 'syntax' suite being called 'syntax-check' just because
> > people are already used to the 'syntax-check' name.
> > 
> > So, please, would you mind changing it as well?
> 
> I don't mind changing it if we agree on the naming, I'll have one last
> argument for the shorter and easier to type name, coping it from the
> comment on gitlab:
> 
> To me it feels redundant to have the `check` as part of the suit label
> as you already know that you are running test suit so the check is
> somehow implied. Consistency is a nice thing if it makes sense, but we
> are completely changing the workflow so I don't see any reason to pick
> longer and redundant name just for consistency reasons.
> 
> Based on that I still prefer using simply `syntax`, let's see of others
> have some opinion about it.

For what it's worth, I also prefer 'syntax': the -check suffix is
useful for make because it highlights that you're verifying some
property of the program, and also clearly ties

  make check
  make syntax-check

together. In the case of Meson, the fact that you're verifying
something is explicit in the name of the ninja target, and also

  ninja test --suite unit
  ninja test --suite syntax

are already very obviously connected. Using 'syntax-check' for the
latter would, if anything, make the relationship unbalanced: why
didn't we call the former 'unit-check' then?

The switch to Meson is a clear-cut break from what we had before,
and we should take the opportunity to re-evaluate whether our
existing decisions are still valid in a post-autotools world: in
this specific case, I think it makes more sense to change the name
rather than stick with the historical one.

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [dbus PATCH v2] build: convert to Meson/Ninja build system
Posted by Daniel P. Berrangé 4 years, 6 months ago
On Mon, Sep 23, 2019 at 11:59:01AM +0200, Andrea Bolognani wrote:
> On Mon, 2019-09-23 at 10:17 +0200, Pavel Hrdina wrote:
> > On Sat, Sep 21, 2019 at 09:22:38AM +0200, Fabiano Fidêncio wrote:
> > > One last things here (thanks, Pavel, for pointing this out), I'd
> > > prefer the 'syntax' suite being called 'syntax-check' just because
> > > people are already used to the 'syntax-check' name.
> > > 
> > > So, please, would you mind changing it as well?
> > 
> > I don't mind changing it if we agree on the naming, I'll have one last
> > argument for the shorter and easier to type name, coping it from the
> > comment on gitlab:
> > 
> > To me it feels redundant to have the `check` as part of the suit label
> > as you already know that you are running test suit so the check is
> > somehow implied. Consistency is a nice thing if it makes sense, but we
> > are completely changing the workflow so I don't see any reason to pick
> > longer and redundant name just for consistency reasons.
> > 
> > Based on that I still prefer using simply `syntax`, let's see of others
> > have some opinion about it.
> 
> For what it's worth, I also prefer 'syntax': the -check suffix is
> useful for make because it highlights that you're verifying some
> property of the program, and also clearly ties
> 
>   make check
>   make syntax-check
> 
> together. In the case of Meson, the fact that you're verifying
> something is explicit in the name of the ninja target, and also
> 
>   ninja test --suite unit
>   ninja test --suite syntax
> 
> are already very obviously connected. Using 'syntax-check' for the
> latter would, if anything, make the relationship unbalanced: why
> didn't we call the former 'unit-check' then?

How about calling the suite "style" rather than "syntax" since I
think that better reflects what it is actually doing. It is coding
style / guidelines checks.

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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [dbus PATCH v2] build: convert to Meson/Ninja build system
Posted by Andrea Bolognani 4 years, 6 months ago
On Mon, 2019-09-23 at 11:02 +0100, Daniel P. Berrangé wrote:
> On Mon, Sep 23, 2019 at 11:59:01AM +0200, Andrea Bolognani wrote:
> > For what it's worth, I also prefer 'syntax': the -check suffix is
> > useful for make because it highlights that you're verifying some
> > property of the program, and also clearly ties
> > 
> >   make check
> >   make syntax-check
> > 
> > together. In the case of Meson, the fact that you're verifying
> > something is explicit in the name of the ninja target, and also
> > 
> >   ninja test --suite unit
> >   ninja test --suite syntax
> > 
> > are already very obviously connected. Using 'syntax-check' for the
> > latter would, if anything, make the relationship unbalanced: why
> > didn't we call the former 'unit-check' then?
> 
> How about calling the suite "style" rather than "syntax" since I
> think that better reflects what it is actually doing. It is coding
> style / guidelines checks.

Sounds good to me!

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [dbus PATCH v2] build: convert to Meson/Ninja build system
Posted by Pavel Hrdina 4 years, 6 months ago
On Mon, Sep 23, 2019 at 12:31:34PM +0200, Andrea Bolognani wrote:
> On Mon, 2019-09-23 at 11:02 +0100, Daniel P. Berrangé wrote:
> > On Mon, Sep 23, 2019 at 11:59:01AM +0200, Andrea Bolognani wrote:
> > > For what it's worth, I also prefer 'syntax': the -check suffix is
> > > useful for make because it highlights that you're verifying some
> > > property of the program, and also clearly ties
> > > 
> > >   make check
> > >   make syntax-check
> > > 
> > > together. In the case of Meson, the fact that you're verifying
> > > something is explicit in the name of the ninja target, and also
> > > 
> > >   ninja test --suite unit
> > >   ninja test --suite syntax
> > > 
> > > are already very obviously connected. Using 'syntax-check' for the
> > > latter would, if anything, make the relationship unbalanced: why
> > > didn't we call the former 'unit-check' then?
> > 
> > How about calling the suite "style" rather than "syntax" since I
> > think that better reflects what it is actually doing. It is coding
> > style / guidelines checks.
> 
> Sounds good to me!

Works for me as well.

Pavel
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [dbus PATCH v2] build: convert to Meson/Ninja build system
Posted by Fabiano Fidêncio 4 years, 6 months ago
On Mon, Sep 23, 2019 at 12:38 PM Pavel Hrdina <phrdina@redhat.com> wrote:
>
> On Mon, Sep 23, 2019 at 12:31:34PM +0200, Andrea Bolognani wrote:
> > On Mon, 2019-09-23 at 11:02 +0100, Daniel P. Berrangé wrote:
> > > On Mon, Sep 23, 2019 at 11:59:01AM +0200, Andrea Bolognani wrote:
> > > > For what it's worth, I also prefer 'syntax': the -check suffix is
> > > > useful for make because it highlights that you're verifying some
> > > > property of the program, and also clearly ties
> > > >
> > > >   make check
> > > >   make syntax-check
> > > >
> > > > together. In the case of Meson, the fact that you're verifying
> > > > something is explicit in the name of the ninja target, and also
> > > >
> > > >   ninja test --suite unit
> > > >   ninja test --suite syntax
> > > >
> > > > are already very obviously connected. Using 'syntax-check' for the
> > > > latter would, if anything, make the relationship unbalanced: why
> > > > didn't we call the former 'unit-check' then?
> > >
> > > How about calling the suite "style" rather than "syntax" since I
> > > think that better reflects what it is actually doing. It is coding
> > > style / guidelines checks.
> >
> > Sounds good to me!
>
> Works for me as well.

+1.

>
> Pavel

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [dbus PATCH v2] build: convert to Meson/Ninja build system
Posted by Ján Tomko 4 years, 6 months ago
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@redhat.com>

>Tested-by: Ján Tomko <jtomko@redhat.com>

Still true.

>---
>
>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(-)

[...]

>diff --git a/README.md b/README.md
>index 66aa6f6..e365650 100644
>--- a/README.md
>+++ b/README.md
>@@ -32,21 +32,19 @@ The packages required to build libvirt-dbus are
> Installation
> ------------
>
>-libvirt-dbus uses GNU Autotools build system, so the build & install
>+libvirt-dbus uses Meson build system, so the build & install
> process is fairly simple. For example, to install as root user:
>
> ```
>-# ./configure --prefix=/usr --sysconfigdir=/etc --localstatedir=/var
>-# make
>-# make install
>+# meson build --prefix=/usr --sysconfigdir=/etc --localstatedir=/var

In meson, the parameter is called --sysconfdir

  $ meson build --prefix=/usr --sysconfigdir=/etc --localstatedir=/var
  usage: meson [-h] {setup,configure,install,introspect,init,test,wrap,subprojects,help,rewrite} ...
  meson: error: unrecognized arguments: --sysconfigdir=/etc

>+# ninja -C build install
> ```
>
> or to install as unprivileged user:
>
> ```
>-$ ./configure --prefix=$HOME/usr
>-$ make
>-$ make install
>+$ meson build --prefix=$HOME/usr
>+$ ninja -C build install
> ```

[...]

>diff --git a/src/meson.build b/src/meson.build
>new file mode 100644
>index 0000000..a848bcd
>--- /dev/null
>+++ b/src/meson.build
>@@ -0,0 +1,42 @@
>+lib_util = static_library(
>+    'libutil',
>+    [
>+        'util.c',
>+    ],
>+    dependencies: [
>+        dep_gio_unix,
>+        dep_glib,
>+        dep_libvirt,
>+        dep_libvirt_glib
>+    ],
>+)
>+
>+exe_libvirt_dbus = executable(
>+    'libvirt-dbus',
>+    [
>+        'connect.c',
>+        'domain.c',
>+        'events.c',
>+        'gdbus.c',
>+        'interface.c',
>+        'main.c',
>+        'network.c',
>+        'nodedev.c',
>+        'nwfilter.c',
>+        'secret.c',
>+        'storagepool.c',
>+        'storagevol.c',
>+    ],
>+    dependencies: [
>+        dep_gio_unix,
>+        dep_glib,
>+        dep_libvirt,
>+        dep_libvirt_glib
>+    ],
>+    link_with: [
>+        lib_util,
>+    ],
>+    install: true,
>+    install_dir: get_option('sbindir'),
>+)
>+

Whitespace at EOL (git am complains about this)

Jano
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [dbus PATCH v2] build: convert to Meson/Ninja build system
Posted by Pavel Hrdina 4 years, 6 months ago
On Mon, Sep 23, 2019 at 10:07:59AM +0200, Ján Tomko wrote:
> 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@redhat.com>
> 
> > Tested-by: Ján Tomko <jtomko@redhat.com>
> 
> Still true.
> 
> > ---
> > 
> > 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(-)
> 
> [...]
> 
> > diff --git a/README.md b/README.md
> > index 66aa6f6..e365650 100644
> > --- a/README.md
> > +++ b/README.md
> > @@ -32,21 +32,19 @@ The packages required to build libvirt-dbus are
> > Installation
> > ------------
> > 
> > -libvirt-dbus uses GNU Autotools build system, so the build & install
> > +libvirt-dbus uses Meson build system, so the build & install
> > process is fairly simple. For example, to install as root user:
> > 
> > ```
> > -# ./configure --prefix=/usr --sysconfigdir=/etc --localstatedir=/var
> > -# make
> > -# make install
> > +# meson build --prefix=/usr --sysconfigdir=/etc --localstatedir=/var
> 
> In meson, the parameter is called --sysconfdir
> 
>  $ meson build --prefix=/usr --sysconfigdir=/etc --localstatedir=/var
>  usage: meson [-h] {setup,configure,install,introspect,init,test,wrap,subprojects,help,rewrite} ...
>  meson: error: unrecognized arguments: --sysconfigdir=/etc

Nice catch, I'll fix that.

> > +# ninja -C build install
> > ```
> > 
> > or to install as unprivileged user:
> > 
> > ```
> > -$ ./configure --prefix=$HOME/usr
> > -$ make
> > -$ make install
> > +$ meson build --prefix=$HOME/usr
> > +$ ninja -C build install
> > ```
> 
> [...]
> 
> > diff --git a/src/meson.build b/src/meson.build
> > new file mode 100644
> > index 0000000..a848bcd
> > --- /dev/null
> > +++ b/src/meson.build
> > @@ -0,0 +1,42 @@
> > +lib_util = static_library(
> > +    'libutil',
> > +    [
> > +        'util.c',
> > +    ],
> > +    dependencies: [
> > +        dep_gio_unix,
> > +        dep_glib,
> > +        dep_libvirt,
> > +        dep_libvirt_glib
> > +    ],
> > +)
> > +
> > +exe_libvirt_dbus = executable(
> > +    'libvirt-dbus',
> > +    [
> > +        'connect.c',
> > +        'domain.c',
> > +        'events.c',
> > +        'gdbus.c',
> > +        'interface.c',
> > +        'main.c',
> > +        'network.c',
> > +        'nodedev.c',
> > +        'nwfilter.c',
> > +        'secret.c',
> > +        'storagepool.c',
> > +        'storagevol.c',
> > +    ],
> > +    dependencies: [
> > +        dep_gio_unix,
> > +        dep_glib,
> > +        dep_libvirt,
> > +        dep_libvirt_glib
> > +    ],
> > +    link_with: [
> > +        lib_util,
> > +    ],
> > +    install: true,
> > +    install_dir: get_option('sbindir'),
> > +)
> > +
> 
> Whitespace at EOL (git am complains about this)

Thanks, I'll fix that too.

Pavel
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [dbus PATCH v2] build: convert to Meson/Ninja build system
Posted by Daniel P. Berrangé 4 years, 7 months ago
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@redhat.com>
> Tested-by: Ján Tomko <jtomko@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 :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [dbus PATCH v2] build: convert to Meson/Ninja build system
Posted by Pavel Hrdina 4 years, 7 months ago
On Fri, Sep 20, 2019 at 10:14:00AM +0100, Daniel P. Berrangé wrote:
> 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@redhat.com>
> > Tested-by: Ján Tomko <jtomko@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.

I would rather do it as a followup patch where we wound have to add
more build dependencies into our spec file (python3, python3-pytest,
python3-dbus and python3-flake8).

Pavel
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [dbus PATCH v2] build: convert to Meson/Ninja build system
Posted by Daniel P. Berrangé 4 years, 7 months ago
On Fri, Sep 20, 2019 at 11:36:53AM +0200, Pavel Hrdina wrote:
> On Fri, Sep 20, 2019 at 10:14:00AM +0100, Daniel P. Berrangé wrote:
> > 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@redhat.com>
> > > Tested-by: Ján Tomko <jtomko@redhat.com>


> > > @@ -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.
> 
> I would rather do it as a followup patch where we wound have to add
> more build dependencies into our spec file (python3, python3-pytest,
> python3-dbus and python3-flake8).

Sure, fine with me.


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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list