Meson build system is a way simpler and easier to understand build
system that can provide (with some work-arounds here and there) the same
functionalities currently available with our current build system
(autotools).
For now, as meson support is not fully complete* and requires a quite
new version of meson still not present in all systems supported on
libvirt-jenkis-ci, let's keep autotools around so more extensive testing
if meson's functionalities can be done before actually removing
autotools support.
*: the support is not fully complete as there's still no equivalent of
`make syntax-check` provided.
Signed-off-by: Fabiano Fidêncio
---
build-aux/dist.sh | 11 +++
meson.build | 218 ++
po/meson.build| 2 +
tests/meson.build | 21 +
tools/meson.build | 97 +
5 files changed, 349 insertions(+)
create mode 100755 build-aux/dist.sh
create mode 100644 meson.build
create mode 100644 po/meson.build
create mode 100644 tests/meson.build
create mode 100644 tools/meson.build
diff --git a/build-aux/dist.sh b/build-aux/dist.sh
new file mode 100755
index 000..422d593
--- /dev/null
+++ b/build-aux/dist.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+SOURCE_ROOT=$1
+BUILD_ROOT=$2
+
+$SOURCE_ROOT/build-aux/gitlog-to-changelog > $MESON_DIST_ROOT/ChangeLog
+
+cp $BUILD_ROOT/{mingw-,}osinfo-db-tools.spec $MESON_DIST_ROOT/
+
+out="`git log --pretty=format:'%aN <%aE>' | sort -u`"
+perl -p -e "s/#authorslist#// and print '$out'" < $SOURCE_ROOT/AUTHORS.in >
$MESON_DIST_ROOT/AUTHORS
diff --git a/meson.build b/meson.build
new file mode 100644
index 000..97ad60c
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,218 @@
+project(
+'osinfo-db-tools', 'c',
+version: '1.6.0',
+license: 'GPLv2+',
+meson_version: '>= 0.49.0'
+)
+
+osinfo_db_tools_prefix = get_option('prefix')
+
+# those directories have to be known by the project
+osinfo_db_tools_datadir = join_paths(osinfo_db_tools_prefix,
get_option('datadir'))
+osinfo_db_tools_localedir = join_paths(osinfo_db_tools_prefix,
get_option('localedir'))
+osinfo_db_tools_pkgdatadir = join_paths(osinfo_db_tools_datadir,
meson.project_name())
+osinfo_db_tools_sysconfdir = join_paths(osinfo_db_tools_prefix,
get_option('sysconfdir'))
+
+# those directories will have files installed in
+osinfo_db_tools_bindir = join_paths(osinfo_db_tools_prefix,
get_option('bindir'))
+osinfo_db_tools_docdir = join_paths(osinfo_db_tools_datadir, 'doc',
meson.project_name())
+osinfo_db_tools_licensedir = join_paths(osinfo_db_tools_datadir, 'license',
meson.project_name())
+osinfo_db_tools_mandir = join_paths(osinfo_db_tools_prefix,
get_option('mandir'))
+
+# spec files
+osinfo_db_tools_spec_data = configuration_data()
+osinfo_db_tools_spec_data.set('VERSION', meson.project_version())
+
+specs = ['osinfo-db-tools.spec', 'mingw-osinfo-db-tools.spec']
+foreach spec: specs
+configure_file(
+input: spec + '.in',
+output: spec,
+configuration: osinfo_db_tools_spec_data
+)
+endforeach
+
+# ninja dist helper
+meson.add_dist_script('build-aux/dist.sh', meson.source_root(),
meson.build_root())
+
+# dependencies
+# glib stuff
+glib_version = '2.36'
+glib_version_info = '>= @0@'.format(glib_version)
+glib_dep = dependency('glib-2.0', version: glib_version_info)
+gio_dep = dependency('gio-2.0', version: glib_version_info)
+gobject_dep = dependency('gobject-2.0', version: glib_version_info)
+
+# everything else
+libarchive_dep = dependency('libarchive', version: '>= 3.0.0')
+libxml_dep = dependency('libxml-2.0', version: '>= 2.6.0')
+json_glib_dep = dependency('json-glib-1.0')
+
+# common dependencies
+osinfo_db_tools_common_dependencies = [gobject_dep, gio_dep, glib_dep]
+
+# arguments
+osinfo_db_tools_cflags = []
+
+# glib stuff
+osinfo_db_tools_cflags += [
+'-DGLIB_MIN_REQUIRED_VERSION="0"'.format(glib_version),
+'-DGLIB_MAX_ALLOWED_VERSION="0"'.format(glib_version)
+]
+
+# directories used
+osinfo_db_tools_cflags += [
+'-DPKGDATADIR="@0@"'.format(osinfo_db_tools_pkgdatadir),
+'-DDATA_DIR="@0@"'.format(osinfo_db_tools_datadir),
+'-DSYSCONFDIR="@0@"'.format(osinfo_db_tools_sysconfdir),
+'-DLOCALEDIR="@0@"'.format(osinfo_db_tools_localedir),
+]
+
+# gettext package name
+osinfo_db_tools_cflags +=
['-DGETTEXT_PACKAGE="0"'.format(meson.project_name())]
+
+# cflags to check whether the compiler supports them or not
+osinfo_db_tools_check_cflags = [
+ '-W',
+ '-Waddress',
+ '-Waggressive-loop-optimizations',
+ '-Wall',
+ '-Warray-bounds',
+ '-Wattributes',
+ '-Wbuiltin-macro-redefined',
+ '-Wcast-align',
+ '-Wchar-subscripts',
+ '-Wclobbered',
+ '-Wcomment',
+ '-Wcomments',
+ '-Wcoverage-mismatch',
+ '-Wcpp',
+ '-Wdate-time',
+ '-Wdeprecated-declarations',
+ '-Wdisabled-optimization',
+ '-Wdiv-by-zero',
+ '-Wdouble-promotion',
+ '-Wempty-body',
+ '-Wendif-labels',
+ '-Wenum-compare',
+ '-Wextra',
+ '-Wformat-contains-nul',
+