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(a)redhat.com>
Tested-by: Ján Tomko <jtomko(a)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