[dconf] build: Port to meson build system



commit f7a71bd57254912547256045b747f9181eef3529
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Wed Jul 12 16:30:51 2017 +0200

    build: Port to meson build system
    
    meson is a build system focused on speed an ease of use, which
    helps speeding up the software development. This patch adds meson
    support along autotools.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=784910

 Makefile.am                       |    2 +-
 bin/Makefile.am                   |    2 +-
 bin/meson.build                   |   26 +++++++++
 client/Makefile.am                |    2 +-
 client/meson.build                |   70 +++++++++++++++++++++++
 common/Makefile.am                |    2 +
 common/meson.build                |   54 ++++++++++++++++++
 docs/Makefile.am                  |    2 +-
 docs/meson.build                  |   51 +++++++++++++++++
 engine/Makefile.am                |    2 +
 engine/meson.build                |   30 ++++++++++
 gdbus/Makefile.am                 |    2 +
 gdbus/meson.build                 |   43 ++++++++++++++
 gsettings/Makefile.am             |    2 +-
 gsettings/meson.build             |   28 +++++++++
 gvdb/Makefile.am                  |    2 +
 gvdb/meson.build                  |   24 ++++++++
 meson.build                       |  113 +++++++++++++++++++++++++++++++++++++
 meson_options.txt                 |    5 ++
 meson_post_install.py             |    9 +++
 service/Makefile.am               |    2 +-
 service/ca.desrt.dconf.service.in |    3 +
 service/meson.build               |   53 +++++++++++++++++
 shm/Makefile.am                   |    2 +
 shm/meson.build                   |   22 +++++++
 tests/Makefile.am                 |    2 +
 tests/meson.build                 |   40 +++++++++++++
 27 files changed, 589 insertions(+), 6 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index dd3571a..81a56bb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,7 +5,7 @@ ACLOCAL_AMFLAGS = -I m4
 SUBDIRS = shm gvdb common engine service gdbus gsettings client bin docs tests
 
 DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc
-EXTRA_DIST = trim-lcov.py m4
+EXTRA_DIST = trim-lcov.py m4 meson.build meson_options.txt meson_post_install.py
 
 clean-am: lcov-clean gcno-clean
 
diff --git a/bin/Makefile.am b/bin/Makefile.am
index fddeac7..2196c75 100644
--- a/bin/Makefile.am
+++ b/bin/Makefile.am
@@ -23,4 +23,4 @@ dconf_SOURCES = \
 
 completiondir = $(datadir)/bash-completion/completions
 completion_DATA = completion/dconf
-EXTRA_DIST = $(completion_DATA)
+EXTRA_DIST = $(completion_DATA) meson.build
diff --git a/bin/meson.build b/bin/meson.build
new file mode 100644
index 0000000..5dc5035
--- /dev/null
+++ b/bin/meson.build
@@ -0,0 +1,26 @@
+sources = gvdb_builder + libdconf_vapi + files(
+  'dconf-dump.vala',
+  'dconf-update.vala',
+  'dconf.vala',
+  'gvdb.vapi'
+)
+
+deps = [
+  libdconf_dep,
+  valac.find_library('posix')
+]
+
+executable(
+  meson.project_name(),
+  sources,
+  include_directories: top_inc,
+  dependencies: deps,
+  c_args: '-w',
+  install: true,
+  install_dir: dconf_bindir
+)
+
+install_data(
+  'completion/dconf',
+  install_dir: join_paths(dconf_datadir, 'bash-completion', 'completions')
+)
diff --git a/client/Makefile.am b/client/Makefile.am
index f21c8b2..45450f7 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -35,7 +35,7 @@ libdconf_so_1_0_0_LDADD = \
 libdconf_so_1_0_0_LDFLAGS = -shared -Wl,-soname=libdconf.so.1
 libdconf_so_1_0_0_SOURCES = $(libdconf_client_a_SOURCES)
 
-EXTRA_DIST = dconf.vapi dconf.deps
+EXTRA_DIST = dconf.vapi dconf.deps meson.build
 
 vapi_DATA = dconf.vapi dconf.deps
 vapidir = $(datadir)/vala/vapi
diff --git a/client/meson.build b/client/meson.build
new file mode 100644
index 0000000..cb94deb
--- /dev/null
+++ b/client/meson.build
@@ -0,0 +1,70 @@
+client_inc = include_directories('.')
+
+install_headers(
+  'dconf.h',
+  subdir: meson.project_name()
+)
+
+install_headers(
+  'dconf-client.h',
+  subdir: join_paths(meson.project_name(), 'client')
+)
+
+sources = files('dconf-client.c')
+
+cflags = '-DG_LOG_DOMAIN="@0@"'.format(meson.project_name())
+
+libdconf_client = static_library(
+  meson.project_name() + '-client',
+  sources: sources,
+  include_directories: top_inc,
+  dependencies: gio_unix_dep,
+  c_args: cflags,
+  pic: true
+)
+
+libdconf = shared_library(
+  meson.project_name(),
+  sources: sources,
+  version: libversion,
+  soversion: soversion,
+  include_directories: top_inc,
+  dependencies: gio_unix_dep,
+  c_args: cflags,
+  link_with: [
+    libdconf_common_shared,
+    libdconf_engine_shared,
+    libdconf_gdbus_thread_shared,
+    libdconf_shm_shared,
+    libgvdb_shared
+  ],
+  install: true,
+  install_dir: dconf_libdir
+)
+
+libdconf_dep = declare_dependency(
+  link_with: libdconf,
+  include_directories: client_inc,
+  dependencies: gio_unix_dep
+)
+
+pkg.generate(
+  libraries: libdconf,
+  version: dconf_version,
+  name: meson.project_name(),
+  description: meson.project_name() + ' client library',
+  filebase: meson.project_name(),
+  subdirs: meson.project_name(),
+  requires: 'gio-unix-2.0 ' + gio_unix_req_version,
+  variables: 'exec_prefix=' + dconf_libexecdir,
+  install_dir: join_paths(dconf_libdir, 'pkgconfig')
+)
+
+libdconf_vapi = files(meson.project_name() + '.vapi')
+
+vapi_data = libdconf_vapi + files(meson.project_name() + '.deps')
+
+install_data(
+  vapi_data,
+  install_dir: join_paths(dconf_datadir, 'vala', 'vapi')
+)
diff --git a/common/Makefile.am b/common/Makefile.am
index 57f0f32..4bb6f77 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -19,3 +19,5 @@ libdconf_common_shared_a_SOURCES = $(libdconf_common_a_SOURCES)
 
 libdconf_common_hidden_a_CFLAGS = $(libdconf_common_a_CFLAGS) -fPIC -DPIC -fvisibility=hidden
 libdconf_common_hidden_a_SOURCES = $(libdconf_common_a_SOURCES)
+
+EXTRA_DIST = meson.build
diff --git a/common/meson.build b/common/meson.build
new file mode 100644
index 0000000..c431fe9
--- /dev/null
+++ b/common/meson.build
@@ -0,0 +1,54 @@
+common_inc = include_directories('.')
+
+headers = files(
+  'dconf-changeset.h',
+  'dconf-enums.h',
+  'dconf-paths.h'
+)
+
+install_headers(
+  headers,
+  subdir: join_paths(meson.project_name(), 'common')
+)
+
+name = meson.project_name() + '-common'
+
+sources = files(
+  'dconf-changeset.c',
+  'dconf-error.c',
+  'dconf-paths.c'
+)
+
+cflags = ['-DG_LOG_DOMAIN="@0@"'.format(meson.project_name())]
+
+libdconf_common = static_library(
+  name,
+  sources: sources,
+  include_directories: top_inc,
+  dependencies: glib_dep,
+  c_args: cflags
+)
+
+libdconf_common_shared = static_library(
+  name + '-shared',
+  sources: sources,
+  include_directories: top_inc,
+  dependencies: glib_dep,
+  c_args: cflags,
+  pic: true
+)
+
+test_cflag = '-fvisibility=hidden'
+
+if cc.has_argument(test_cflag)
+  cflags += [test_cflag]
+endif
+
+libdconf_common_hidden = static_library(
+  name + '-hidden',
+  sources: sources,
+  include_directories: top_inc,
+  dependencies: glib_dep,
+  c_args: cflags,
+  pic: true
+)
diff --git a/docs/Makefile.am b/docs/Makefile.am
index 5f7f491..361beee 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -46,6 +46,6 @@ man_MANS += \
        dconf.7
 endif
 
-EXTRA_DIST += dconf-service.xml dconf-tool.xml dconf-overview.xml
+EXTRA_DIST += dconf-service.xml dconf-tool.xml dconf-overview.xml meson.build
 
 DISTCLEANFILES = $(man_MANS)
diff --git a/docs/meson.build b/docs/meson.build
new file mode 100644
index 0000000..d74eedf
--- /dev/null
+++ b/docs/meson.build
@@ -0,0 +1,51 @@
+gnome.gtkdoc(
+  meson.project_name(),
+  main_xml: meson.project_name() + '-docs.xml',
+  src_dir: [
+    common_inc,
+    client_inc
+  ],
+  dependencies: libdconf_dep,
+  scan_args: '--rebuild-types',
+  gobject_typesfile: meson.project_name() + '.types',
+  install: true,
+  install_dir: join_paths(dconf_datadir, 'gtk-doc', 'html', meson.project_name())
+)
+
+if get_option('enable-man')
+  xsltproc = find_program('xsltproc', required: false)
+  assert(xsltproc.found(), 'xsltproc is required for enable-man')
+
+  xsltproc_cmd = [
+    xsltproc,
+    '--output', '@OUTPUT@',
+    '--nonet',
+    '--stringparam', 'man.output.quietly', '1',
+    '--stringparam', 'funcsynopsis.style', 'ansi',
+    '--stringparam', 'man.th.extra1.suppress', '1',
+    '--stringparam', 'man.authors.section.enabled', '0',
+    '--stringparam', 'man.copyright.section.enabled', '0',
+    'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
+    '@INPUT@'
+  ]
+
+  mans = [
+    ['dconf-service.xml', 'dconf-service', '1'],
+    ['dconf-tool.xml', 'dconf', '1'],
+    ['dconf-overview.xml', 'dconf', '7']
+  ]
+
+  foreach man: mans
+    output = '@0@.@1@'.format(man[1], man[2])
+    man_dir = 'man' + man[2]
+
+    custom_target(
+      output,
+      input: man[0],
+      output: output,
+      command: xsltproc_cmd,
+      install: true,
+      install_dir: join_paths(dconf_mandir, man_dir)
+    )
+  endforeach
+endif
diff --git a/engine/Makefile.am b/engine/Makefile.am
index 0f200d5..9f967de 100644
--- a/engine/Makefile.am
+++ b/engine/Makefile.am
@@ -18,3 +18,5 @@ libdconf_engine_a_SOURCES = \
 
 libdconf_engine_shared_a_CFLAGS = $(libdconf_engine_a_CFLAGS) -fPIC -DPIC
 libdconf_engine_shared_a_SOURCES = $(libdconf_engine_a_SOURCES)
+
+EXTRA_DIST = meson.build
diff --git a/engine/meson.build b/engine/meson.build
new file mode 100644
index 0000000..58b648f
--- /dev/null
+++ b/engine/meson.build
@@ -0,0 +1,30 @@
+name = meson.project_name() + '-engine'
+
+sources = files(
+  'dconf-engine.c',
+  'dconf-engine-profile.c',
+  'dconf-engine-source.c',
+  'dconf-engine-source-file.c',
+  'dconf-engine-source-user.c',
+  'dconf-engine-source-service.c',
+  'dconf-engine-source-system.c'
+)
+
+cflags = '-DG_LOG_DOMAIN="@0@"'.format(meson.project_name())
+
+libdconf_engine = static_library(
+  name,
+  sources: sources,
+  include_directories: top_inc,
+  dependencies: glib_dep,
+  c_args: cflags
+)
+
+libdconf_engine_shared = static_library(
+  name + '-shared',
+  sources: sources,
+  include_directories: top_inc,
+  dependencies: glib_dep,
+  c_args: cflags,
+  pic: true
+)
diff --git a/gdbus/Makefile.am b/gdbus/Makefile.am
index d3f0a6c..880bcb9 100644
--- a/gdbus/Makefile.am
+++ b/gdbus/Makefile.am
@@ -19,3 +19,5 @@ libdconf_gdbus_filter_a_SOURCES = \
 
 libdconf_gdbus_filter_shared_a_CFLAGS = $(libdconf_gdbus_filter_a_CFLAGS) -fPIC -DPIC
 libdconf_gdbus_filter_shared_a_SOURCES = $(libdconf_gdbus_filter_a_SOURCES)
+
+EXTRA_DIST = meson.build
diff --git a/gdbus/meson.build b/gdbus/meson.build
new file mode 100644
index 0000000..4dda78d
--- /dev/null
+++ b/gdbus/meson.build
@@ -0,0 +1,43 @@
+name = meson.project_name() + '-gdbus-thread'
+
+sources = files('dconf-gdbus-thread.c')
+
+cflags = '-DG_LOG_DOMAIN="@0@"'.format(meson.project_name())
+
+libdconf_gdbus_thread = static_library(
+  name,
+  sources: sources,
+  include_directories: top_inc,
+  dependencies: gio_unix_dep,
+  c_args: cflags
+)
+
+libdconf_gdbus_thread_shared = static_library(
+  name + '-shared',
+  sources: sources,
+  include_directories: top_inc,
+  dependencies: gio_unix_dep,
+  c_args: cflags,
+  pic: true
+)
+
+name = meson.project_name() + '-gdbus-filter'
+
+sources = files('dconf-gdbus-filter.c')
+
+libdconf_gdbus_filter = static_library(
+  name,
+  sources: sources,
+  include_directories: top_inc,
+  dependencies: gio_unix_dep,
+  c_args: cflags
+)
+
+libdconf_gdbus_filter_shared = static_library(
+  name + '-shared',
+  sources: sources,
+  include_directories: top_inc,
+  dependencies: gio_unix_dep,
+  c_args: cflags,
+  pic: true
+)
diff --git a/gsettings/Makefile.am b/gsettings/Makefile.am
index c1a96d6..9a2ae8c 100644
--- a/gsettings/Makefile.am
+++ b/gsettings/Makefile.am
@@ -27,4 +27,4 @@ install-data-hook:
 
 TESTS_ENVIRONMENT = export GSETTINGS_LIB=libdconfsettings.so;
 TESTS = abicheck.sh
-EXTRA_DIST = abicheck.sh
+EXTRA_DIST = abicheck.sh meson.build
diff --git a/gsettings/meson.build b/gsettings/meson.build
new file mode 100644
index 0000000..5319cce
--- /dev/null
+++ b/gsettings/meson.build
@@ -0,0 +1,28 @@
+sources = files('dconfsettingsbackend.c')
+
+cflags = '-DG_LOG_DOMAIN="@0@"'.format(meson.project_name())
+
+libdconf_settings = shared_library(
+  meson.project_name() + 'settings',
+  sources: sources,
+  include_directories: top_inc,
+  dependencies: gio_unix_dep,
+  c_args: cflags,
+  link_with: [
+    libdconf_common_hidden,
+    libdconf_engine_shared,
+    libdconf_gdbus_thread_shared,
+    libdconf_shm_shared,
+    libgvdb_shared
+  ],
+  install: true,
+  install_dir: join_paths(dconf_libdir, 'gio', 'modules')
+)
+
+unit_test = 'abicheck'
+
+test(
+  unit_test,
+  find_program(unit_test + '.sh'),
+  env: 'GSETTINGS_LIB=' + libdconf_settings.full_path()
+)
diff --git a/gvdb/Makefile.am b/gvdb/Makefile.am
index 7194b2f..6802959 100644
--- a/gvdb/Makefile.am
+++ b/gvdb/Makefile.am
@@ -12,3 +12,5 @@ libgvdb_a_SOURCES = \
 
 libgvdb_shared_a_CFLAGS = $(libgvdb_a_CFLAGS) -fPIC -DPIC
 libgvdb_shared_a_SOURCES = $(libgvdb_a_SOURCES)
+
+EXTRA_DIST = meson.build
diff --git a/gvdb/meson.build b/gvdb/meson.build
new file mode 100644
index 0000000..4543430
--- /dev/null
+++ b/gvdb/meson.build
@@ -0,0 +1,24 @@
+name = 'gvdb'
+
+gvdb_builder = files('gvdb-builder.c')
+
+sources = gvdb_builder + files('gvdb-reader.c')
+
+cflags = '-DG_LOG_DOMAIN="gvdb (via @0@)"'.format(meson.project_name())
+
+libgvdb = static_library(
+  name,
+  sources: sources,
+  include_directories: top_inc,
+  dependencies: glib_dep,
+  c_args: cflags
+)
+
+libgvdb_shared = static_library(
+  name + '-shared',
+  sources: sources,
+  include_directories: top_inc,
+  dependencies: glib_dep,
+  c_args: cflags,
+  pic: true
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..5648257
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,113 @@
+project(
+  'dconf', ['c', 'vala'],
+  version: '0.26.0',
+  license: 'LGPL2.1+',
+  default_options: [
+    'buildtype=debugoptimized',
+    'warning_level=1'
+  ],
+  meson_version: '>= 0.41.0'
+)
+
+dconf_version = meson.project_version()
+version_array = dconf_version.split('.')
+dconf_major_version = version_array[0].to_int()
+dconf_minor_version = version_array[1].to_int()
+dconf_micro_version = version_array[2].to_int()
+
+dconf_prefix = get_option('prefix')
+dconf_bindir = join_paths(dconf_prefix, get_option('bindir'))
+dconf_datadir = join_paths(dconf_prefix, get_option('datadir'))
+dconf_includedir = join_paths(dconf_prefix, get_option('includedir'))
+dconf_libdir = join_paths(dconf_prefix, get_option('libdir'))
+dconf_libexecdir = join_paths(dconf_prefix, get_option('libexecdir'))
+dconf_mandir = join_paths(dconf_prefix, get_option('mandir'))
+
+dconf_namespace = 'ca.desrt.dconf'
+
+soversion = 1
+current = 0
+revision = 0
+libversion = '@0@.@1@.@2@'.format(soversion, current, revision)
+
+cc = meson.get_compiler('c')
+valac = meson.get_compiler('vala')
+
+config_h = configuration_data()
+
+# package
+set_defines = [
+  ['PACKAGE', meson.project_name()],
+  ['PACKAGE_BUGREPORT', 'http://bugzilla.gnome.org/enter_bug.cgi?product=dconf'],
+  ['PACKAGE_NAME', meson.project_name()],
+  ['PACKAGE_STRING', '@0@ @1@'.format(meson.project_name(), dconf_version)],
+  ['PACKAGE_TARNAME', meson.project_name()],
+  ['PACKAGE_URL', 'https://wiki.gnome.org/Projects/dconf'],
+  ['PACKAGE_VERSION', dconf_version],
+  ['VERSION', dconf_version],
+  ['GETTEXT_PACKAGE', meson.project_name()]
+]
+
+foreach define: set_defines
+  config_h.set_quoted(define[0], define[1])
+endforeach
+
+# compiler flags
+common_flags = ['-DHAVE_CONFIG_H']
+
+if get_option('buildtype').contains('debug')
+  test_cflags = [
+    '-fno-common',
+    '-Wmissing-prototypes',
+    '-Wwrite-strings'
+  ]
+
+  foreach cflag: test_cflags
+    if cc.has_argument(cflag)
+      common_flags += [cflag]
+    endif
+  endforeach
+endif
+
+add_project_arguments(common_flags, language: 'c')
+
+gio_unix_req_version = '>= 2.25.7'
+
+glib_dep = dependency('glib-2.0', version: '>= 2.44.0')
+gio_unix_dep = dependency('gio-unix-2.0', version: gio_unix_req_version)
+
+gio_querymodules = find_program('gio-querymodules', required: false)
+if gio_querymodules.found()
+  gio_modules_dir = get_option('with-gio-modules-dir').strip()
+  if gio_modules_dir == ''
+    gio_modules_dir = join_paths(dconf_libdir, 'gio', 'modules')
+  endif
+
+  meson.add_install_script('meson_post_install.py', gio_querymodules.path(), gio_modules_dir)
+endif
+
+configure_file(
+  output: 'config.h',
+  configuration: config_h
+)
+
+gnome = import('gnome')
+pkg = import('pkgconfig')
+
+top_inc = include_directories('.')
+
+subdir('shm')
+subdir('gvdb')
+subdir('common')
+subdir('engine')
+subdir('service')
+subdir('gdbus')
+subdir('gsettings')
+subdir('client')
+subdir('bin')
+
+if get_option('enable-gtk-doc')
+  subdir('docs')
+endif
+
+subdir('tests')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..fb01218
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,5 @@
+option('enable-man', type: 'boolean', value: true, description: 'generate man pages')
+option('with-gio-modules-dir', type: 'string', value: '', description: 'choose directory for the GIO module 
[default=LIBDIR/gio/modules]')
+option('with-dbus-service-dir', type: 'string', value: '', description: 'choose directory for dbus service 
files [default=PREFIX/share/dbus-1/services]')
+option('with-dbus-system-service-dir', type: 'string', value: '', description: 'choose directory for dbus 
system service files [default=PREFIX/share/dbus-1/system-services]')
+option('enable-gtk-doc', type: 'boolean', value: false, description: 'use gtk-doc to build documentation')
diff --git a/meson_post_install.py b/meson_post_install.py
new file mode 100644
index 0000000..8960540
--- /dev/null
+++ b/meson_post_install.py
@@ -0,0 +1,9 @@
+#!/usr/bin/env python3
+
+import os
+import subprocess
+import sys
+
+if not os.environ.get('DESTDIR'):
+  print('GIO module cache creation...')
+  subprocess.call([sys.argv[1], sys.argv[2]])
diff --git a/service/Makefile.am b/service/Makefile.am
index 8d32517..0199c01 100644
--- a/service/Makefile.am
+++ b/service/Makefile.am
@@ -35,7 +35,7 @@ DISTCLEANFILES = ca.desrt.dconf.service
 BUILT_SOURCES = dconf-generated.c dconf-generated.h
 CLEANFILES = $(BUILT_SOURCES)
 
-EXTRA_DIST = ca.desrt.dconf.xml
+EXTRA_DIST = ca.desrt.dconf.xml meson.build
 
 ca.desrt.dconf.service: Makefile
        $(AM_V_GEN) (echo '[D-BUS Service]'; \
diff --git a/service/ca.desrt.dconf.service.in b/service/ca.desrt.dconf.service.in
new file mode 100644
index 0000000..369948a
--- /dev/null
+++ b/service/ca.desrt.dconf.service.in
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=ca.desrt.dconf
+Exec=@libexecdir@/dconf-service
diff --git a/service/meson.build b/service/meson.build
new file mode 100644
index 0000000..f651e25
--- /dev/null
+++ b/service/meson.build
@@ -0,0 +1,53 @@
+dbus_service_dir = get_option('with-dbus-service-dir').strip()
+if dbus_service_dir == ''
+  dbus_service_dir = join_paths(dconf_datadir, 'dbus-1', 'services')
+endif
+
+dbus_system_service_dir = get_option('with-dbus-system-service-dir').strip()
+if dbus_system_service_dir == ''
+  dbus_system_service_dir = join_paths(dconf_datadir, 'dbus-1', 'system-services')
+endif
+
+service_conf = configuration_data()
+service_conf.set('libexecdir', dconf_libexecdir)
+
+service = dconf_namespace + '.service'
+
+configure_file(
+  input: service + '.in',
+  output: service,
+  install: true,
+  install_dir: dbus_service_dir,
+  configuration: service_conf
+)
+
+sources = [
+  'dconf-blame.c',
+  'dconf-gvdb-utils.c',
+  'dconf-keyfile-writer.c',
+  'dconf-service.c',
+  'dconf-shm-writer.c',
+  'dconf-writer.c',
+  'main.c'
+]
+
+sources += gnome.gdbus_codegen(
+  'dconf-generated',
+  dconf_namespace + '.xml',
+  interface_prefix: dconf_namespace + '.',
+  namespace: 'DConfDBus'
+)
+
+executable(
+  'dconf-service',
+  sources,
+  include_directories: top_inc,
+  dependencies: gio_unix_dep,
+  link_with: [
+    libdconf_common,
+    libdconf_shm,
+    libgvdb
+  ],
+  install: true,
+  install_dir: dconf_libexecdir
+)
diff --git a/shm/Makefile.am b/shm/Makefile.am
index 936f88e..e7d8bc9 100644
--- a/shm/Makefile.am
+++ b/shm/Makefile.am
@@ -9,3 +9,5 @@ libdconf_shm_a_SOURCES = \
 
 libdconf_shm_shared_a_CFLAGS = $(libdconf_shm_a_CFLAGS) -fPIC -DPIC
 libdconf_shm_shared_a_SOURCES = $(libdconf_shm_a_SOURCES)
+
+EXTRA_DIST = meson.build
diff --git a/shm/meson.build b/shm/meson.build
new file mode 100644
index 0000000..01ced55
--- /dev/null
+++ b/shm/meson.build
@@ -0,0 +1,22 @@
+name = meson.project_name() + '-shm'
+
+sources = files('dconf-shm.c')
+
+cflags = '-DG_LOG_DOMAIN="@0@"'.format(meson.project_name())
+
+libdconf_shm = static_library(
+  name,
+  sources: sources,
+  include_directories: top_inc,
+  dependencies: glib_dep,
+  c_args: cflags
+)
+
+libdconf_shm_shared = static_library(
+  name + '-shared',
+  sources: sources,
+  include_directories: top_inc,
+  dependencies: glib_dep,
+  c_args: cflags,
+  pic: true
+)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 0a53ee6..136160a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -94,3 +94,5 @@ client_LDADD = \
        libdconf-mock.a                         \
        $(gio_LIBS)
 client_SOURCES = client.c
+
+EXTRA_DIST += meson.build
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..6737a97
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,40 @@
+sources = files(
+  'dconf-mock-dbus.c',
+  'dconf-mock-gvdb.c',
+  'dconf-mock-shm.c'
+)
+
+libdconf_mock = static_library(
+  meson.project_name() + '-mock',
+  sources: sources,
+  dependencies: glib_dep
+)
+
+test_dir = meson.current_source_dir()
+
+dl_dep = cc.find_library('dl', required: false)
+m_dep = cc.find_library('m')
+
+unit_tests = [
+  # [name, sources, c_args, dependencies, link_with]
+  ['paths', 'paths.c', [], glib_dep, libdconf_common],
+  ['changeset', 'changeset.c', [], glib_dep, libdconf_common],
+  ['shm', ['shm.c', 'tmpdir.c'], [], [glib_dep, dl_dep], libdconf_shm],
+  ['gvdb', 'gvdb.c', '-DSRCDIR="@0@"'.format(test_dir), glib_dep, libgvdb],
+  ['gdbus-thread', 'dbus.c', '-DDBUS_BACKEND="/gdbus/thread"', gio_unix_dep, libdconf_gdbus_thread],
+  ['gdbus-filter', 'dbus.c', '-DDBUS_BACKEND="/gdbus/filter"', gio_unix_dep, libdconf_gdbus_filter],
+  ['engine', 'engine.c', '-DSRCDIR="@0@"'.format(test_dir), [glib_dep, dl_dep, m_dep], [libdconf_engine, 
libdconf_common, libdconf_mock]],
+  ['client', 'client.c', '-DSRCDIR="@0@"'.format(test_dir), gio_unix_dep, [libdconf_client, libdconf_engine, 
libdconf_common, libdconf_mock]]
+]
+
+foreach unit_test: unit_tests
+  exe = executable(
+    unit_test[0],
+    unit_test[1],
+    c_args: unit_test[2],
+    dependencies: unit_test[3],
+    link_with: unit_test[4]
+  )
+
+  test(unit_test[0], exe, is_parallel: false)
+endforeach


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