[folks/wip/nielsdg/meson] Add support for the Meson build system



commit 4df8e1bbd1eb325ad0fa147cd94270f701df7b8b
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Fri Aug 25 15:41:05 2017 +0200

    Add support for the Meson build system

 .gitlab-ci.yml                              |  16 +--
 backends/bluez/meson.build                  |  45 ++++++
 backends/dummy/lib/meson.build              |  48 +++++++
 backends/dummy/meson.build                  |  38 +++++
 backends/eds/lib/meson.build                |  48 +++++++
 backends/eds/meson.build                    |  41 ++++++
 backends/key-file/meson.build               |  36 +++++
 backends/libsocialweb/lib/meson.build       |  42 ++++++
 backends/libsocialweb/meson.build           |  36 +++++
 backends/meson.build                        |  39 ++++++
 backends/ofono/meson.build                  |  39 ++++++
 backends/telepathy/lib/meson.build          |  90 ++++++++++++
 backends/telepathy/meson.build              |  41 ++++++
 backends/tracker/lib/meson.build            |  46 +++++++
 backends/tracker/meson.build                |  40 ++++++
 docs/meson.build                            |  32 +++++
 folks/meson.build                           | 116 ++++++++++++++++
 meson.build                                 | 207 ++++++++++++++++++++++++++++
 meson_options.txt                           |  16 +++
 meson_post_install.py                       |  15 ++
 po/meson.build                              |   3 +
 tests/bluez/meson.build                     |  39 ++++++
 tests/dummy/meson.build                     |  27 ++++
 tests/eds/meson.build                       |  78 +++++++++++
 tests/folks/meson.build                     |  41 ++++++
 tests/key-file/meson.build                  |  33 +++++
 tests/lib/bluez/meson.build                 |  15 ++
 tests/lib/dummy/meson.build                 |  20 +++
 tests/lib/eds/meson.build                   |  21 +++
 tests/lib/key-file/meson.build              |  15 ++
 tests/lib/libsocialweb/meson.build          |  15 ++
 tests/lib/meson.build                       |  74 ++++++++++
 tests/lib/telepathy/contactlist/meson.build |  76 ++++++++++
 tests/lib/telepathy/meson.build             |  27 ++++
 tests/lib/test-case.vala                    |   6 +-
 tests/lib/tracker/meson.build               |  26 ++++
 tests/libsocialweb/meson.build              |  22 +++
 tests/meson.build                           |  50 +++++++
 tests/tools/meson.build                     |   2 +
 tests/tracker/meson.build                   |  81 +++++++++++
 tools/inspect/meson.build                   |  42 ++++++
 tools/meson.build                           |  33 +++++
 42 files changed, 1764 insertions(+), 13 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b2399336..fb075e9d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -6,28 +6,22 @@ fedora-latest:
   stage: build
   except:
     - tags
-  variables:
-    V: "1"
-    MAKEFLAGS: "-j8"
   before_script:
     - dnf update -y && dnf -y install dnf-plugins-core redhat-rpm-config
     - dnf -y builddep folks
+    - dnf -y install meson ninja-build
   script:
     # Configure
-    - ./autogen.sh
+    - meson _build
     # Build
-    - make
+    - ninja -C _build
     # Run tests
     # FIXME: Tests temporarily disabled because they don’t pass on CI
     # See https://gitlab.gnome.org/GNOME/folks/issues/3
-    - make check || true
+    - ninja -C _build test || true
   artifacts:
     name: "folks-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
     when: always
     paths:
       - "_build/config.h"
-      - "_build/*.log"
-      - "_build/*/*.log"
-      - "_build/*/*/*.log"
-      - "_build/*/*/*/*.log"
-      - "_build/*/*/*/*/*.log"
+      - "_build/meson-logs"
diff --git a/backends/bluez/meson.build b/backends/bluez/meson.build
new file mode 100644
index 00000000..44b42682
--- /dev/null
+++ b/backends/bluez/meson.build
@@ -0,0 +1,45 @@
+folks_bluez_backend_name = 'bluez'
+
+folks_bluez_backend_sources = [
+  'bluez-backend-factory.vala',
+  'bluez-backend.vala',
+  'bluez-persona-store.vala',
+  'bluez-persona.vala',
+  'org-bluez-obex-client.vala',
+  'org-bluez.vala',
+]
+
+folks_bluez_backend_deps = [
+  backend_deps,
+  libebook,
+  libm,
+]
+
+folks_bluez_backend_vala_flags = [
+  '--pkg', 'folks-generics',
+  '--pkg', 'build-conf',
+]
+
+folks_bluez_backend_c_flags = [
+  '-include', 'config.h',
+  '-DBACKEND_NAME="@0@"'.format(folks_bluez_backend_name),
+  '-DG_LOG_DOMAIN="@0@"'.format(folks_bluez_backend_name),
+]
+
+folks_bluez_backend = library(folks_bluez_backend_name,
+  folks_bluez_backend_sources,
+  dependencies: folks_bluez_backend_deps,
+  vala_args: folks_bluez_backend_vala_flags,
+  c_args: folks_bluez_backend_c_flags,
+  link_with: libfolks_internal,
+  name_prefix: '',
+  install_dir: join_paths(folks_backend_dir, folks_bluez_backend_name),
+  install: true,
+)
+
+folks_bluez_backend_dep = declare_dependency(
+  link_with: folks_bluez_backend,
+  include_directories: include_directories('.'),
+)
+
+folks_backends += folks_bluez_backend
diff --git a/backends/dummy/lib/meson.build b/backends/dummy/lib/meson.build
new file mode 100644
index 00000000..de62d5bb
--- /dev/null
+++ b/backends/dummy/lib/meson.build
@@ -0,0 +1,48 @@
+folks_dummy_backend_sources = [
+  'dummy-backend.vala',
+  'dummy-full-persona.vala',
+  'dummy-persona-store.vala',
+  'dummy-persona.vala',
+]
+
+folks_dummy_backend_deps = [
+  backend_deps,
+]
+
+folks_dummy_backend_vala_flags = [
+  '--pkg', 'folks-generics',
+  '--pkg', 'build-conf',
+]
+
+folks_dummy_backend_c_flags = [
+  '-include', 'config.h',
+  '-DBACKEND_NAME="@0@"'.format(folks_dummy_backend_name),
+  '-DG_LOG_DOMAIN="@0@"'.format(folks_dummy_backend_name),
+]
+
+folks_dummy_backend = shared_library('folks-@0@'.format(folks_dummy_backend_name),
+  folks_dummy_backend_sources,
+  dependencies: folks_dummy_backend_deps,
+  vala_args: folks_dummy_backend_vala_flags,
+  c_args: folks_dummy_backend_c_flags,
+  link_with: libfolks_internal,
+  version: folks_dummy_lib_version,
+  vala_gir: 'FolksDummy-@0@.gir'.format(folks_api_version),
+  install: true,
+  install_dir: [ true, folks_headers_install_dir, true, true ],
+)
+
+folks_dummy_backend_dep = declare_dependency(
+  link_with: folks_dummy_backend,
+  include_directories: include_directories('.'),
+)
+
+# XXX install generated folks-dummy.h header
+
+# Pkg-config file
+configure_file(
+  input: 'folks-dummy.pc.in',
+  output: 'folks-dummy.pc',
+  configuration: pkg_conf,
+  install_dir: pkg_install_dir,
+)
diff --git a/backends/dummy/meson.build b/backends/dummy/meson.build
new file mode 100644
index 00000000..ae8cdc89
--- /dev/null
+++ b/backends/dummy/meson.build
@@ -0,0 +1,38 @@
+# The dummy backend
+folks_dummy_backend_name = 'dummy'
+
+# Backend library
+subdir('lib')
+
+dummy_backend_sources = [
+  'dummy-backend-factory.vala',
+]
+
+dummy_backend_deps = [
+  backend_deps,
+  folks_dummy_backend_dep,
+]
+
+dummy_backend_vala_flags = [
+  '--pkg', 'folks-generics',
+  '--pkg', 'build-conf',
+]
+
+dummy_backend_c_flags = [
+  '-include', 'config.h',
+  '-DBACKEND_NAME="@0@"'.format(folks_dummy_backend_name),
+  '-DG_LOG_DOMAIN="@0@"'.format(folks_dummy_backend_name),
+]
+
+dummy_backend = shared_library(folks_dummy_backend_name,
+  dummy_backend_sources,
+  dependencies: dummy_backend_deps,
+  vala_args: dummy_backend_vala_flags,
+  c_args: dummy_backend_c_flags,
+  link_with: libfolks_internal,
+  name_prefix: '',
+  install_dir: join_paths(folks_backend_dir, folks_dummy_backend_name),
+  install: true,
+)
+
+folks_backends += dummy_backend
diff --git a/backends/eds/lib/meson.build b/backends/eds/lib/meson.build
new file mode 100644
index 00000000..60063b08
--- /dev/null
+++ b/backends/eds/lib/meson.build
@@ -0,0 +1,48 @@
+folks_eds_backend_sources = [
+  'edsf-persona-store.vala',
+  'edsf-persona.vala',
+]
+
+folks_eds_backend_deps = [
+  backend_deps,
+  libebook,
+  libebook_contacts,
+  libedataserver,
+  libxml,
+]
+
+folks_eds_backend_vala_flags = [
+  '--pkg', 'folks-generics',
+  '--pkg', 'build-conf',
+]
+
+folks_eds_backend_c_flags = [
+  '-include', 'config.h',
+  '-DBACKEND_NAME="@0@"'.format(folks_eds_backend_name),
+  '-DG_LOG_DOMAIN="@0@"'.format(folks_eds_backend_name),
+]
+
+folks_eds_backend = library('folks-@0@'.format(folks_eds_backend_name),
+  folks_eds_backend_sources,
+  dependencies: folks_eds_backend_deps,
+  vala_args: folks_eds_backend_vala_flags,
+  c_args: folks_eds_backend_c_flags,
+  link_with: libfolks_internal,
+  version: folks_eds_lib_version,
+  vala_gir: 'FolksEds-@0@.gir'.format(folks_api_version),
+  install: true,
+  install_dir: [ true, folks_headers_install_dir, true, true ],
+)
+
+folks_eds_backend_dep = declare_dependency(
+  link_with: folks_eds_backend,
+  include_directories: include_directories('.'),
+)
+
+# Pkg-config file
+configure_file(
+  input: 'folks-eds.pc.in',
+  output: 'folks-eds.pc',
+  configuration: pkg_conf,
+  install_dir: pkg_install_dir,
+)
diff --git a/backends/eds/meson.build b/backends/eds/meson.build
new file mode 100644
index 00000000..c08b2f7d
--- /dev/null
+++ b/backends/eds/meson.build
@@ -0,0 +1,41 @@
+# Evolution-Data-Server (E-D-S) backend
+folks_eds_backend_name = 'eds'
+
+# Backend library
+subdir('lib')
+
+folks_eds_backend_sources = [
+  'eds-backend-factory.vala',
+  'eds-backend.vala',
+]
+
+folks_eds_backend_deps = [
+  backend_deps,
+  libebook,
+  libedataserver,
+  folks_eds_backend_dep,
+]
+
+folks_eds_backend_vala_flags = [
+  '--pkg', 'folks-generics',
+  '--pkg', 'build-conf',
+]
+
+folks_eds_backend_c_flags = [
+  '-include', 'config.h',
+  '-DBACKEND_NAME="@0@"'.format(folks_eds_backend_name),
+  '-DG_LOG_DOMAIN="@0@"'.format(folks_eds_backend_name),
+]
+
+folks_eds_backend = library('eds',
+  folks_eds_backend_sources,
+  dependencies: folks_eds_backend_deps,
+  vala_args: folks_eds_backend_vala_flags,
+  c_args: folks_eds_backend_c_flags,
+  link_with: libfolks_internal,
+  name_prefix: '',
+  install_dir: join_paths(folks_backend_dir, folks_eds_backend_name),
+  install: true,
+)
+
+folks_backends += folks_eds_backend
diff --git a/backends/key-file/meson.build b/backends/key-file/meson.build
new file mode 100644
index 00000000..db98e0a0
--- /dev/null
+++ b/backends/key-file/meson.build
@@ -0,0 +1,36 @@
+folks_keyfile_backend_name = 'key-file'
+
+folks_keyfile_backend_sources = [
+  'kf-backend-factory.vala',
+  'kf-backend.vala',
+  'kf-persona-store.vala',
+  'kf-persona.vala',
+]
+
+folks_keyfile_backend_deps = [
+  backend_deps,
+]
+
+folks_keyfile_backend_vala_flags = [
+  '--pkg', 'folks-generics',
+  '--pkg', 'build-conf',
+]
+
+folks_keyfile_backend_c_flags = [
+  '-include', 'config.h',
+  '-DBACKEND_NAME="@0@"'.format(folks_keyfile_backend_name),
+  '-DG_LOG_DOMAIN="@0@"'.format(folks_keyfile_backend_name),
+]
+
+folks_keyfile_backend = library(folks_keyfile_backend_name,
+  folks_keyfile_backend_sources,
+  dependencies: folks_keyfile_backend_deps,
+  vala_args: folks_keyfile_backend_vala_flags,
+  c_args: folks_keyfile_backend_c_flags,
+  link_with: libfolks_internal,
+  name_prefix: '',
+  install_dir: join_paths(folks_backend_dir, folks_keyfile_backend_name),
+  install: true,
+)
+
+folks_backends += folks_keyfile_backend
diff --git a/backends/libsocialweb/lib/meson.build b/backends/libsocialweb/lib/meson.build
new file mode 100644
index 00000000..a0cb216e
--- /dev/null
+++ b/backends/libsocialweb/lib/meson.build
@@ -0,0 +1,42 @@
+folks_libsocialweb_backend_name = 'folks-libsocialweb'
+
+folks_libsocialweb_backend_sources = [
+  'swf-persona-store.vala',
+  'swf-persona.vala',
+]
+
+folks_libsocialweb_backend_deps = [
+  backend_deps,
+]
+
+folks_libsocialweb_backend_vala_flags = [
+  '--pkg', 'folks-generics',
+  '--pkg', 'build-conf',
+]
+
+folks_libsocialweb_backend_c_flags = [
+  '-include', 'config.h',
+  '-DBACKEND_NAME="@0@"'.format(folks_libsocialweb_backend_name),
+  '-DG_LOG_DOMAIN="@0@"'.format(folks_libsocialweb_backend_name),
+]
+
+folks_libsocialweb_backend = library(folks_libsocialweb_backend_name,
+  folks_libsocialweb_backend_sources,
+  dependencies: folks_libsocialweb_backend_deps,
+  vala_args: folks_libsocialweb_backend_vala_flags,
+  c_args: folks_libsocialweb_backend_c_flags,
+  link_with: libfolks_internal,
+)
+
+folks_libsocialweb_backend_dep = declare_dependency(
+  link_with: folks_libsocialweb_backend,
+  include_directories: include_directories('.'),
+)
+
+# Pkg-config file
+configure_file(
+  input: 'folks-libsocialweb.pc.in',
+  output: 'folks-libsocialweb.pc',
+  configuration: pkg_conf,
+  install_dir: pkg_install_dir,
+)
diff --git a/backends/libsocialweb/meson.build b/backends/libsocialweb/meson.build
new file mode 100644
index 00000000..455bc4be
--- /dev/null
+++ b/backends/libsocialweb/meson.build
@@ -0,0 +1,36 @@
+# Backend library
+subdir('lib')
+
+# Backend itself
+libsocialweb_backend_name = 'libsocialweb'
+
+libsocialweb_backend_sources = [
+  'sw-backend-factory.vala',
+  'sw-backend.vala',
+]
+
+libsocialweb_backend_deps = [
+  backend_deps,
+  folks_libsocialweb_backend_dep,
+]
+
+libsocialweb_backend_vala_flags = [
+  '--pkg', 'folks-generics',
+  '--pkg', 'build-conf',
+]
+
+libsocialweb_backend_c_flags = [
+  '-include', 'config.h',
+  '-DBACKEND_NAME="@0@"'.format(libsocialweb_backend_name),
+  '-DG_LOG_DOMAIN="@0@"'.format(libsocialweb_backend_name),
+]
+
+libsocialweb_backend = library(libsocialweb_backend_name,
+  libsocialweb_backend_sources,
+  dependencies: libsocialweb_backend_deps,
+  vala_args: libsocialweb_backend_vala_flags,
+  c_args: libsocialweb_backend_c_flags,
+  link_with: libfolks_internal,
+)
+
+folks_backends += libsocialweb_backend
diff --git a/backends/meson.build b/backends/meson.build
new file mode 100644
index 00000000..889324a5
--- /dev/null
+++ b/backends/meson.build
@@ -0,0 +1,39 @@
+# Common dependencies
+backend_deps = [
+  libfolks_dep,
+  gobject,
+  gee,
+  gio
+]
+
+# Common flags
+backend_vala_flags = [
+]
+
+# A subdirectory for each type of backend
+subdir('dummy')
+subdir('key-file')
+
+if telepathy_backend_enabled
+  subdir('telepathy')
+endif
+
+if libsocialweb_backend_enabled
+  subdir('libsocialweb')
+endif
+
+if tracker_backend_enabled
+  subdir('tracker')
+endif
+
+if eds_backend_enabled
+  subdir('eds')
+endif
+
+if ofono_backend_enabled
+  subdir('ofono')
+endif
+
+if bluez_backend_enabled
+  subdir('bluez')
+endif
diff --git a/backends/ofono/meson.build b/backends/ofono/meson.build
new file mode 100644
index 00000000..8a920951
--- /dev/null
+++ b/backends/ofono/meson.build
@@ -0,0 +1,39 @@
+folks_ofono_backend_name = 'ofono'
+
+folks_ofono_backend_sources = [
+  'ofono-backend-factory.vala',
+  'ofono-backend.vala',
+  'ofono-persona-store.vala',
+  'ofono-persona.vala',
+  'org-ofono.vala',
+]
+
+folks_ofono_backend_deps = [
+  backend_deps,
+  libebook,
+  libedataserver,
+]
+
+folks_ofono_backend_vala_flags = [
+  '--pkg', 'folks-generics',
+  '--pkg', 'build-conf',
+]
+
+folks_ofono_backend_c_flags = [
+  '-include', 'config.h',
+  '-DBACKEND_NAME="@0@"'.format(folks_ofono_backend_name),
+  '-DG_LOG_DOMAIN="@0@"'.format(folks_ofono_backend_name),
+]
+
+folks_ofono_backend = library(folks_ofono_backend_name,
+  folks_ofono_backend_sources,
+  dependencies: folks_ofono_backend_deps,
+  vala_args: folks_ofono_backend_vala_flags,
+  c_args: folks_ofono_backend_c_flags,
+  link_with: libfolks_internal,
+  name_prefix: '',
+  install_dir: join_paths(folks_backend_dir, folks_ofono_backend_name),
+  install: true,
+)
+
+folks_backends += folks_ofono_backend
diff --git a/backends/telepathy/lib/meson.build b/backends/telepathy/lib/meson.build
new file mode 100644
index 00000000..cc05d652
--- /dev/null
+++ b/backends/telepathy/lib/meson.build
@@ -0,0 +1,90 @@
+# Low-level library
+tp_lowlevel_sources = [
+  'tp-lowlevel.c',
+]
+
+tp_lowlevel_deps = [
+  gio,
+  gobject,
+  telepathy_glib,
+]
+
+tp_lowlevel = library('tp-lowlevel',
+  sources: tp_lowlevel_sources,
+  dependencies: tp_lowlevel_deps,
+)
+
+tp_lowlevel_gir = gnome.generate_gir(tp_lowlevel,
+  sources: [ 'tp-lowlevel.h' ],
+  includes: [ 'GObject-2.0', 'TelepathyGLib-0.12' ],
+  nsversion: folks_api_version, # XXX check this
+  namespace: 'TpLowlevel',
+  identifier_prefix: 'FolksTpLowlevel',
+  extra_args: [
+    '--c-include=tp-lowlevel.h',
+  ],
+)
+
+tp_lowlevel_vapi = gnome.generate_vapi('tp-lowlevel',
+  sources: tp_lowlevel_gir.get(0),
+  packages: [ 'gio-2.0', 'telepathy-glib' ],
+)
+
+# Actual backend library
+folks_telepathy_backend_name = 'folks-telepathy'
+
+folks_telepathy_backend_sources = [
+  'tpf-logger.vala',
+  'tpf-persona-store-cache.vala',
+  'tpf-persona-store.vala',
+  'tpf-persona.vala',
+]
+
+if zeitgeist_enabled
+  folks_telepathy_backend_sources += 'tp-zeitgeist.vala'
+else
+  folks_telepathy_backend_sources += 'tp-zeitgeist-dummy.vala'
+endif
+
+folks_telepathy_backend_deps = [
+  backend_deps,
+  telepathy_glib,
+  tp_lowlevel_vapi,
+]
+
+folks_telepathy_backend_vala_flags = [
+  '--pkg', 'folks-generics',
+  '--pkg', 'build-conf',
+]
+
+folks_telepathy_backend_c_flags = [
+  '-include', 'config.h',
+  '-DBACKEND_NAME="@0@"'.format(folks_telepathy_backend_name),
+  '-DG_LOG_DOMAIN="@0@"'.format(folks_telepathy_backend_name),
+]
+
+folks_telepathy_backend = library(folks_telepathy_backend_name,
+  folks_telepathy_backend_sources,
+  dependencies: folks_telepathy_backend_deps,
+  vala_args: folks_telepathy_backend_vala_flags,
+  c_args: folks_telepathy_backend_c_flags,
+  link_with: libfolks_internal,
+  version: folks_telepathy_lib_version,
+  vala_gir: 'FolksTelepathy-@0@.gir'.format(folks_api_version),
+  install: true,
+  install_dir: [ true, folks_headers_install_dir, true, true ],
+)
+
+folks_telepathy_backend_dep = declare_dependency(
+  link_with: folks_telepathy_backend,
+  include_directories: include_directories('.'),
+  dependencies: folks_telepathy_backend_deps,
+)
+
+# Pkg-config file
+configure_file(
+  input: 'folks-telepathy.pc.in',
+  output: 'folks-telepathy.pc',
+  configuration: pkg_conf,
+  install_dir: pkg_install_dir,
+)
diff --git a/backends/telepathy/meson.build b/backends/telepathy/meson.build
new file mode 100644
index 00000000..80deb4b8
--- /dev/null
+++ b/backends/telepathy/meson.build
@@ -0,0 +1,41 @@
+# Backend library
+subdir('lib')
+
+# Backend itself
+telepathy_backend_name = 'telepathy'
+
+telepathy_backend_sources = [
+  'tp-backend-factory.vala',
+  'tp-backend.vala',
+]
+
+telepathy_backend_deps = [
+  backend_deps,
+  telepathy_glib,
+  tp_lowlevel_vapi,
+  folks_telepathy_backend_dep,
+]
+
+telepathy_backend_vala_flags = [
+  '--pkg', 'folks-generics',
+  '--pkg', 'build-conf',
+]
+
+telepathy_backend_c_flags = [
+  '-include', 'config.h',
+  '-DBACKEND_NAME="@0@"'.format(telepathy_backend_name),
+  '-DG_LOG_DOMAIN="@0@"'.format(telepathy_backend_name),
+]
+
+telepathy_backend = library(telepathy_backend_name,
+  telepathy_backend_sources,
+  dependencies: telepathy_backend_deps,
+  vala_args: telepathy_backend_vala_flags,
+  c_args: telepathy_backend_c_flags,
+  link_with: libfolks_internal,
+  name_prefix: '',
+  install_dir: join_paths(folks_backend_dir, telepathy_backend_name),
+  install: true,
+)
+
+folks_backends += telepathy_backend
diff --git a/backends/tracker/lib/meson.build b/backends/tracker/lib/meson.build
new file mode 100644
index 00000000..fa5729cf
--- /dev/null
+++ b/backends/tracker/lib/meson.build
@@ -0,0 +1,46 @@
+folks_tracker_backend_sources = [
+  'trf-persona-store.vala',
+  'trf-persona.vala',
+  'trf-util.vala',
+]
+
+folks_tracker_backend_deps = [
+  backend_deps,
+  tracker_sparql_dep,
+]
+
+folks_tracker_backend_vala_flags = [
+  '--pkg', 'folks-generics',
+  '--pkg', 'build-conf',
+]
+
+folks_tracker_backend_c_flags = [
+  '-include', 'config.h',
+  '-DBACKEND_NAME="@0@"'.format(folks_tracker_backend_name),
+  '-DG_LOG_DOMAIN="@0@"'.format(folks_tracker_backend_name),
+]
+
+folks_tracker_backend = library('folks-@0@'.format(folks_tracker_backend_name),
+  folks_tracker_backend_sources,
+  dependencies: folks_tracker_backend_deps,
+  vala_args: folks_tracker_backend_vala_flags,
+  c_args: folks_tracker_backend_c_flags,
+  link_with: libfolks_internal,
+  version: folks_tracker_lib_version,
+  install: true,
+  install_dir: [ true, folks_headers_install_dir, true ],
+)
+
+folks_tracker_backend_dep = declare_dependency(
+  link_with: folks_tracker_backend,
+  include_directories: include_directories('.'),
+  dependencies: tracker_sparql_dep,
+)
+
+# Pkg-config file
+configure_file(
+  input: 'folks-tracker.pc.in',
+  output: 'folks-tracker.pc',
+  configuration: pkg_conf,
+  install_dir: pkg_install_dir,
+)
diff --git a/backends/tracker/meson.build b/backends/tracker/meson.build
new file mode 100644
index 00000000..e45037a5
--- /dev/null
+++ b/backends/tracker/meson.build
@@ -0,0 +1,40 @@
+# The tracker backend
+folks_tracker_backend_name = 'tracker'
+
+# Backend library
+subdir('lib')
+
+tracker_backend_sources = [
+  'tr-backend-factory.vala',
+  'tr-backend.vala',
+]
+
+tracker_backend_deps = [
+  backend_deps,
+  tracker_sparql_dep,
+  folks_tracker_backend_dep,
+]
+
+tracker_backend_vala_flags = [
+  '--pkg', 'folks-generics',
+  '--pkg', 'build-conf',
+]
+
+tracker_backend_c_flags = [
+  '-include', 'config.h',
+  '-DBACKEND_NAME="@0@"'.format(folks_tracker_backend_name),
+  '-DG_LOG_DOMAIN="@0@"'.format(folks_tracker_backend_name),
+]
+
+tracker_backend = library(folks_tracker_backend_name,
+  tracker_backend_sources,
+  dependencies: tracker_backend_deps,
+  vala_args: tracker_backend_vala_flags,
+  c_args: tracker_backend_c_flags,
+  link_with: libfolks_internal,
+  name_prefix: '',
+  install_dir: join_paths(folks_backend_dir, folks_keyfile_backend_name),
+  install: true,
+)
+
+folks_backends += tracker_backend
diff --git a/docs/meson.build b/docs/meson.build
new file mode 100644
index 00000000..2e5c23e5
--- /dev/null
+++ b/docs/meson.build
@@ -0,0 +1,32 @@
+# Specify some common flags
+docs_common_valadoc_flags = [
+  '--force',
+  '--package-version', # XXX
+  '--no-protected',
+  '--driver', # XXX
+]
+
+
+# Now build the documentation for each library
+custom_target ('valadocs',
+  input : libfolks_sources,
+  # output : outdir, XXX
+  command : [ valadoc,
+    docs_common_valadoc_flags,
+    '-o', 'folks',
+    '--doclet=devhelp',
+    '--pkg=gmodule-2.0',
+    '--pkg=gio-2.0',
+    '--pkg=gee-0.8',
+    '--pkg=folks-internal',
+    '--pkg=folks-generics',
+    '--pkg=build-conf',
+    '--wiki=@0@'.format(join_paths(meson.current_source_dir(), 'wiki')),
+    '@INPUT@',
+  ],
+  install : true,
+  install_dir : join_paths(get_option('datadir'), 'devhelp', 'books')
+)
+
+# TODO also a gtk-doc doclet
+# TODO the other libraries
diff --git a/folks/meson.build b/folks/meson.build
new file mode 100644
index 00000000..8889c2c6
--- /dev/null
+++ b/folks/meson.build
@@ -0,0 +1,116 @@
+# Internal library
+libfolks_internal_sources = [
+  'internal.vala',
+  'small-set.c',
+]
+
+libfolks_internal_deps = [
+  gobject,
+  gio,
+  gee,
+  posix,
+]
+
+libfolks_internal = static_library('folks-internal',
+  libfolks_internal_sources,
+  include_directories: include_directories('..'),
+  dependencies: libfolks_internal_deps,
+)
+
+# Core library
+libfolks_sources = [
+  'abstract-field-details.vala',
+  'alias-details.vala',
+  'anti-linkable.vala',
+  'avatar-cache.vala',
+  'avatar-details.vala',
+  'backend-store.vala',
+  'backend.vala',
+  'birthday-details.vala',
+  'debug.vala',
+  'email-details.vala',
+  'extended-info.vala',
+  'favourite-details.vala',
+  'folks-namespace.vala',
+  'gender-details.vala',
+  'group-details.vala',
+  'im-details.vala',
+  'individual-aggregator.vala',
+  'individual.vala',
+  'interaction-details.vala',
+  'local-id-details.vala',
+  'location-details.vala',
+  'name-details.vala',
+  'note-details.vala',
+  'object-cache.vala',
+  'persona-store.vala',
+  'persona.vala',
+  'phone-details.vala',
+  'postal-address-details.vala',
+  'potential-match.vala',
+  'presence-details.vala',
+  'query.vala',
+  'role-details.vala',
+  'search-view.vala',
+  'simple-query.vala',
+  'types.vala',
+  'url-details.vala',
+  'utils.vala',
+  'web-service-details.vala',
+]
+
+libfolks_deps = [
+  gobject,
+  gmodule,
+  gio,
+  gee,
+]
+
+libfolks_vala_flags = [
+  '--pkg', 'folks-generics',
+  '--pkg', 'build-conf',
+]
+
+libfolks_c_flags = [
+  '-include', 'config.h',
+  '-DG_LOG_DOMAIN="folks"',
+]
+
+libfolks_lib = shared_library('folks',
+  libfolks_sources,
+  dependencies: libfolks_deps,
+  include_directories: config_h_dir,
+  link_with: libfolks_internal,
+  vala_args: libfolks_vala_flags,
+  c_args: libfolks_c_flags,
+  vala_gir: 'Folks-@0@.gir'.format(folks_api_version),
+  version: folks_lib_version,
+  install: true,
+  install_dir: [ true, folks_headers_install_dir, true, true ],
+)
+
+libfolks_dep = declare_dependency(
+  link_with: libfolks_lib,
+  dependencies: libfolks_deps,
+  include_directories: include_directories('.', '..')
+)
+
+# GSettings
+gsettings_conf = configuration_data()
+gsettings_conf.set('GETTEXT_PACKAGE', meson.project_name())
+gschema_file = configure_file(
+  input: 'org.freedesktop.folks.gschema.xml.in',
+  output: 'org.freedesktop.folks.gschema.xml',
+  configuration: gsettings_conf,
+)
+install_data(gschema_file,
+  install_dir: join_paths(get_option('datadir'), 'glib-2.0', 'schemas'),
+)
+
+# Pkg-config file
+configure_file(
+  input: 'folks.pc.in',
+  output: 'folks.pc',
+  configuration: pkg_conf,
+  install_dir: pkg_install_dir,
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 00000000..271189d5
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,207 @@
+project('folks', [ 'vala', 'c' ],
+  version: '0.11.5.0',
+  license: 'LGPL2.1+', # XXX is this ok?
+  meson_version: '>= 0.49',
+)
+
+gnome = import('gnome')
+i18n = import('i18n')
+
+# Add our custom VAPI dir
+add_project_arguments([
+    '--vapidir', join_paths(meson.source_root(), 'folks'),
+    '-D', 'FOLKS_COMPILATION',
+  ],
+  language: 'vala'
+)
+
+# Versions
+folks_api_version = '0.6'
+# Core library version. When updating this, don't forget to bump the backend
+# library versions too, below.
+# XXX what about folks_base_version / folks_full_version / folks_maybe_datestamp ?
+folks_lib_version = '25.18.4'
+
+_version_split = folks_lib_version.split('.')
+folks_module_version = '@0@'.format(_version_split[0].to_int() + _version_split[1].to_int())
+
+folks_eds_lib_version = '25.18.4'
+folks_libsocialweb_lib_version = '25.18.4'
+folks_telepathy_lib_version = '25.18.4'
+folks_tracker_lib_version = '25.18.4'
+folks_dummy_lib_version = '25.18.4'
+
+# Some variables
+folks_prefix = get_option('prefix')
+folks_libdir = join_paths(folks_prefix, get_option('libdir'))
+locale_dir = join_paths(folks_prefix, get_option('localedir'))
+pkg_install_dir = join_paths(get_option('libdir'), 'pkgconfig')
+folks_headers_install_dir = join_paths(get_option('includedir'), meson.project_name())
+installed_tests_dir = join_paths(get_option('libexecdir'), 'installed-tests', 'folks') # XXX check that 
final folder (see InstalledTests on the wiki)
+installed_tests_meta_dir = join_paths(get_option('datadir'), 'installed-tests', 'folks') # XXX check that 
final folder (see InstalledTests on the wiki)
+
+folks_backend_dir = join_paths(folks_libdir, 'folks', '@0@'.format(folks_module_version), 'backends')
+
+# Options (see meson_options.txt for more info)
+bluez_backend_enabled = get_option('bluez-backend')
+docs_enabled = get_option('docs')
+eds_backend_enabled = get_option('eds-backend')
+installed_tests_enabled = get_option('installed-tests')
+libsocialweb_backend_enabled = get_option('libsocialweb-backend')
+modular_tests_enabled = get_option('modular-tests')
+ofono_backend_enabled = get_option('ofono-backend')
+telepathy_backend_enabled = get_option('telepathy-backend')
+tracker_backend_enabled = get_option('tracker-backend')
+zeitgeist_enabled = get_option('zeitgeist')
+import_tool_enabled = get_option('import-tool')
+inspect_tool_enabled = get_option('inspect-tool')
+
+# Dependencies
+min_glib_version = '2.40.0'
+min_eds_version = '3.13.90'
+
+valac = meson.get_compiler('vala')
+cc = meson.get_compiler('c')
+
+# FIXME: get rid of the next 2 when our dependencies stop using dbus-1 (GNOME#696177)
+dbus_1 = dependency('dbus-1')
+dbus_glib = dependency('dbus-glib-1')
+gee = dependency('gee-0.8')
+gio = dependency('gio-2.0')
+glib = dependency('glib-2.0', version: '>=' + min_glib_version)
+gmodule = dependency('gmodule-2.0')
+gobject = dependency('gobject-2.0', version: '>=' + min_glib_version)
+libm = cc.find_library('m')
+posix = valac.find_library('posix')
+readline = declare_dependency(
+  dependencies: [
+    cc.find_library('readline'),
+    valac.find_library('readline'),
+  ]
+)
+
+if docs_enabled
+  valadoc = find_program('valadoc')
+endif
+
+if zeitgeist_enabled
+  zeitgeist = dependency('zeitgeist-2.0', version: '>= 0.9.14')
+endif
+
+if telepathy_backend_enabled
+  telepathy_glib = dependency('telepathy-glib', version: '>= 0.19.9')
+  #XXX check for zeitgeist
+endif
+
+if tracker_backend_enabled
+  tracker_sparql_accepted_versions = [ '0.16', '0.18', '1.0', '2.0' ]
+  foreach version : tracker_sparql_accepted_versions
+    tracker_sparql_dep = dependency('tracker-sparql-@0@'.format(version),
+      version: '>= 0.15.2',
+      required: false,
+    )
+    if tracker_sparql_dep.found()
+      tracker_sparql_version = version
+      break
+    endif
+  endforeach
+
+  if not tracker_sparql_dep.found()
+    error('Tracker backend enabld, but couldn\'t find tracker-sparql package')
+  endif
+endif
+
+if eds_backend_enabled
+  libebook = dependency('libebook-1.2', version: '>=' + min_eds_version)
+  libebook_contacts = dependency('libebook-contacts-1.2', version: '>=' + min_eds_version)
+  libedataserver = dependency('libedataserver-1.2', version: '>=' + min_eds_version)
+  libxml = dependency('libxml-2.0')
+endif
+
+if ofono_backend_enabled
+  libebook = dependency('libebook-1.2', version: '>=' + min_eds_version)
+endif
+
+if bluez_backend_enabled
+  libebook = dependency('libebook-1.2', version: '>=' + min_eds_version)
+  # Needed for the BlueZ tests
+  python3 = find_program('python3')
+  #XXX
+endif
+
+if libsocialweb_backend_enabled
+endif
+
+if import_tool_enabled
+  libxml = dependency('libxml-2.0')
+endif
+
+
+# Configuration
+conf = configuration_data()
+conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
+conf.set_quoted('LOCALE_DIR', locale_dir)
+conf.set_quoted('PACKAGE_NAME', meson.project_name())
+conf.set_quoted('PACKAGE_STRING', meson.project_name())
+conf.set_quoted('PACKAGE_VERSION', meson.project_version())
+conf.set_quoted('ABS_TOP_SRCDIR', meson.source_root())
+conf.set_quoted('ABS_TOP_BUILDDIR', meson.build_root())
+conf.set_quoted('INSTALLED_TESTS_DIR', installed_tests_dir)
+conf.set_quoted('INSTALLED_TESTS_META_DIR', installed_tests_meta_dir)
+conf.set_quoted('BACKEND_DIR', folks_backend_dir)
+conf.set10('HAVE_BLUEZ', bluez_backend_enabled)
+conf.set10('HAVE_EDS', eds_backend_enabled)
+conf.set10('HAVE_LIBSOCIALWEB', libsocialweb_backend_enabled)
+conf.set10('HAVE_OFONO', ofono_backend_enabled)
+conf.set10('HAVE_TELEPATHY', telepathy_backend_enabled)
+conf.set10('HAVE_TRACKER', tracker_backend_enabled)
+if tracker_backend_enabled
+  conf.set_quoted('TRACKER_SPARQL_MAJOR', tracker_sparql_version)
+endif
+configure_file(output: 'config.h', configuration: conf)
+config_h_dir = include_directories('.')
+
+# Configuration for pc.in files
+pkg_conf = configuration_data()
+pkg_conf.set('prefix', get_option('prefix'))
+pkg_conf.set('exec_prefix', '${prefix}')
+pkg_conf.set('libdir', '${prefix}/@0@'.format(get_option('libdir')))
+pkg_conf.set('bindir', '${prefix}/@0@'.format(get_option('bindir')))
+pkg_conf.set('includedir', '${prefix}/@0@'.format(get_option('includedir')))
+pkg_conf.set('datarootdir', '${prefix}/@0@'.format(get_option('datadir')))
+pkg_conf.set('datadir', '${datarootdir}')
+pkg_conf.set('VERSION', meson.project_version())
+if tracker_backend_enabled
+  pkg_conf.set('TRACKER_SPARQL_MAJOR', tracker_sparql_version)
+endif
+
+# Post-install scripts
+meson.add_install_script('meson_post_install.py')
+
+# The core library
+subdir('folks')
+
+# The backends
+folks_backends = [] # This will be filed with the backends' build targets
+subdir('backends')
+
+folks_backend_paths = [] # Add the backend's paths
+foreach backend : folks_backends
+  folks_backend_paths += backend.full_path()
+endforeach
+# Use this variable for FOLKS_BACKEND_PATH in an uninstalled environment
+folks_backend_path_uninstalled = ':'.join(folks_backend_paths)
+
+# Helper executables
+subdir('tools')
+
+# Translations
+subdir('po')
+
+# if modular_tests_enabled
+  subdir('tests')
+# endif
+
+if docs_enabled
+  subdir('docs')
+endif
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 00000000..8c0859cf
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,16 @@
+# Backends
+option('bluez-backend', type: 'boolean', value: true, description: 'build the Bluez backend')
+option('eds-backend', type: 'boolean', value: true, description: 'build the EDS backend')
+option('libsocialweb-backend', type: 'boolean', value: false, description: 'build the libsocialweb backend')
+option('ofono-backend', type: 'boolean', value: true, description: 'build the oFono backend')
+option('telepathy-backend', type: 'boolean', value: true, description: 'build the Telepathy backend')
+option('tracker-backend', type: 'boolean', value: false, description: 'build the Tracker backend')
+option('zeitgeist', type: 'boolean', value: false, description: 'build Zeitgeist support in the Telepathy 
backend')
+# Tools
+option('import-tool', type: 'boolean', value: true, description: 'Enable building the meta-contact import 
tool')
+option('inspect-tool', type: 'boolean', value: true, description: 'Enable building the data inspection tool')
+# Test options
+option('modular-tests', type: 'boolean', value: true, description: 'Enable build of test programs')
+option('installed-tests', type: 'boolean', value: false, description: 'Install test programs')
+# Docs
+option('docs', type: 'boolean', value: false, description: 'Enable documentation generation')
diff --git a/meson_post_install.py b/meson_post_install.py
new file mode 100644
index 00000000..bf320a9d
--- /dev/null
+++ b/meson_post_install.py
@@ -0,0 +1,15 @@
+#!/usr/bin/env python3
+
+import os
+import subprocess
+
+install_prefix = os.environ['MESON_INSTALL_PREFIX']
+icondir = os.path.join(install_prefix, 'share', 'icons', 'hicolor')
+schemadir = os.path.join(install_prefix, 'share', 'glib-2.0', 'schemas')
+
+if not os.environ.get('DESTDIR'):
+  print('Update icon cache...')
+  subprocess.call(['gtk-update-icon-cache', '-f', '-t', icondir])
+
+  print('Compiling gsettings schemas...')
+  subprocess.call(['glib-compile-schemas', schemadir])
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 00000000..f904cde4
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,3 @@
+i18n.gettext(meson.project_name(),
+  preset: 'glib'
+)
diff --git a/tests/bluez/meson.build b/tests/bluez/meson.build
new file mode 100644
index 00000000..05a2c97e
--- /dev/null
+++ b/tests/bluez/meson.build
@@ -0,0 +1,39 @@
+# in order from least to most complex
+bluez_tests = [
+  'device-properties',
+  'individual-retrieval',
+  'vcard-parsing',
+]
+
+bluez_tests_deps = [
+  gobject,
+  gio,
+  gee,
+  libebook,
+  libedataserver,
+  libfolks_dep,
+  libfolks_test_dep,
+  libbluez_test_dep,
+  folks_test_dbus,
+  folks_bluez_backend_dep,
+]
+
+bluez_tests_vala_flags = [
+  '--pkg', 'folks-generics',
+  '--debug',
+]
+
+foreach _test: bluez_tests
+
+  test_executable = executable('bluez-'+_test,
+    '@0@.vala'.format(_test),
+    dependencies: bluez_tests_deps,
+    vala_args: bluez_tests_vala_flags,
+    link_with: libfolks_internal,
+  )
+
+  test('[Bluez backend] @0@'.format(_test),
+    test_executable,
+    env: common_test_environment,
+  )
+endforeach
diff --git a/tests/dummy/meson.build b/tests/dummy/meson.build
new file mode 100644
index 00000000..67b84f76
--- /dev/null
+++ b/tests/dummy/meson.build
@@ -0,0 +1,27 @@
+# in order from least to most complex
+dummy_tests = [
+  'individual-retrieval',
+  'add-persona',
+  'linkable-properties',
+  'search-view',
+]
+
+dummy_tests_deps = [
+  common_test_deps,
+  dummy_test_lib_dep,
+  folks_dummy_backend_dep,
+]
+
+
+foreach _test: dummy_tests
+  test_executable = executable('dummy-'+_test,
+    '@0@.vala'.format(_test),
+    dependencies: dummy_tests_deps,
+    vala_args: common_test_vala_flags,
+  )
+
+  test('[Dummy backend] @0@'.format(_test),
+    test_executable,
+    env: common_test_environment,
+  )
+endforeach
diff --git a/tests/eds/meson.build b/tests/eds/meson.build
new file mode 100644
index 00000000..79fbec3e
--- /dev/null
+++ b/tests/eds/meson.build
@@ -0,0 +1,78 @@
+eds_tests_deps = [
+  gobject,
+  posix,
+  libebook,
+  libedataserver,
+  libxml,
+  libfolks_dep,
+  libfolks_test_dep,
+  libeds_test_dep,
+  folks_test_dbus,
+  folks_eds_backend_dep,
+]
+
+eds_tests_vala_flags = [
+  '--debug',
+]
+
+
+# First we make the test helpers
+helpers = [
+  'helper-create-many-contacts',
+  'helper-delete-contacts',
+  'helper-prepare-aggregator',
+]
+
+foreach helper: helpers
+  executable(helper,
+    '@0@.vala'.format(helper),
+    dependencies: eds_tests_deps,
+    vala_args: eds_tests_vala_flags,
+  )
+endforeach
+
+# in order from least to most complex
+eds_tests = [
+  'persona-store-tests',
+  'individual-retrieval',
+  'phone-details',
+  'email-details',
+  'name-details',
+  'removing-contacts',
+  'updating-phones',
+  'updating-contacts',
+  'avatar-details',
+  'add-persona',
+  'im-details',
+  'postal-address-details',
+  'remove-persona',
+  'set-emails',
+  'set-im-addresses',
+  'link-personas',
+  'add-contacts-stress-test',
+  'set-properties',
+  'set-properties-race',
+  'linkable-properties',
+  'link-personas-diff-stores',
+  'store-removed',
+  'anti-linking',
+  'enable-disable-stores',
+  'perf',
+  'extended-info',
+]
+
+foreach _test: eds_tests
+
+  test_executable = executable('eds-'+_test,
+    '@0@.vala'.format(_test),
+    dependencies: eds_tests_deps,
+    vala_args: eds_tests_vala_flags,
+  )
+
+  # XXX make a service file
+
+  test('[EDS backend] @0@'.format(_test), test_executable,
+    is_parallel: false, # FIXME: https://gitlab.gnome.org/GNOME/folks/issues/69
+    env: common_test_environment,
+  )
+endforeach
diff --git a/tests/folks/meson.build b/tests/folks/meson.build
new file mode 100644
index 00000000..7be45ec3
--- /dev/null
+++ b/tests/folks/meson.build
@@ -0,0 +1,41 @@
+# in order from least to most complex
+_folks_tests = [
+  'small-set',
+  'abstract-field-details',
+  'async-locking',
+  'utils',
+  'primary-store-changes',
+  'backend-loading',
+  'aggregation',
+  'standalone-individuals',
+  'avatar-cache',
+  'object-cache',
+  'phone-field-details',
+  'name-details',
+  'init',
+]
+
+_folks_tests_deps = [
+  common_test_deps,
+  dummy_test_lib_dep,
+  telepathy_test_lib_dep,
+]
+
+_folks_tests_vala_flags = [
+  common_test_vala_flags,
+  '--pkg', 'folks-generics',
+]
+
+
+foreach _test: _folks_tests
+  test_executable = executable('_folks-'+_test,
+    '@0@.vala'.format(_test),
+    dependencies: _folks_tests_deps,
+    vala_args: _folks_tests_vala_flags,
+  )
+
+  test('[folks] @0@'.format(_test),
+    test_executable,
+    env: common_test_environment,
+  )
+endforeach
diff --git a/tests/key-file/meson.build b/tests/key-file/meson.build
new file mode 100644
index 00000000..b2b710c8
--- /dev/null
+++ b/tests/key-file/meson.build
@@ -0,0 +1,33 @@
+# in order from least to most complex
+keyfile_tests = [
+  'individual-retrieval',
+]
+
+keyfile_tests_deps = [
+  gobject,
+  gio,
+  gee,
+  libfolks_dep,
+  libfolks_test_dep,
+  libkeyfile_test_dep,
+  folks_test_dbus,
+  #folks_keyfile_backend_dep,
+]
+
+keyfile_tests_vala_flags = [
+  '--debug',
+]
+
+foreach _test: keyfile_tests
+
+  test_executable = executable('key-file-'+_test,
+    '@0@.vala'.format(_test),
+    dependencies: keyfile_tests_deps,
+    vala_args: keyfile_tests_vala_flags,
+  )
+
+  test('[Key-file backend] @0@'.format(_test),
+    test_executable,
+    env: common_test_environment,
+  )
+endforeach
diff --git a/tests/lib/bluez/meson.build b/tests/lib/bluez/meson.build
new file mode 100644
index 00000000..3b23a185
--- /dev/null
+++ b/tests/lib/bluez/meson.build
@@ -0,0 +1,15 @@
+libbluez_test_sources = [
+  'test-case.vala',
+  'backend.vala',
+]
+
+libbluez_test = library('bluez-test',
+  libbluez_test_sources,
+  dependencies: common_test_lib_deps,
+  vala_args: common_test_lib_flags,
+)
+
+libbluez_test_dep = declare_dependency(
+  link_with: libbluez_test,
+  include_directories: include_directories('.'),
+)
diff --git a/tests/lib/dummy/meson.build b/tests/lib/dummy/meson.build
new file mode 100644
index 00000000..12606733
--- /dev/null
+++ b/tests/lib/dummy/meson.build
@@ -0,0 +1,20 @@
+dummy_test_lib_sources = [
+  'test-case.vala',
+]
+
+dummy_test_lib_deps = [
+  common_test_lib_deps,
+  folks_dummy_backend_dep,
+]
+
+dummy_test_lib = library('dummy-test',
+  dummy_test_lib_sources,
+  dependencies: dummy_test_lib_deps,
+  vala_args: common_test_lib_flags,
+)
+
+dummy_test_lib_dep = declare_dependency(
+  link_with: dummy_test_lib,
+  include_directories: include_directories('.'),
+  dependencies: folks_dummy_backend_dep,
+)
diff --git a/tests/lib/eds/meson.build b/tests/lib/eds/meson.build
new file mode 100644
index 00000000..ef356892
--- /dev/null
+++ b/tests/lib/eds/meson.build
@@ -0,0 +1,21 @@
+libeds_test_sources = [
+  'backend.vala',
+  'test-case.vala',
+]
+
+libeds_test_deps = [
+  common_test_lib_deps,
+  libebook,
+  folks_eds_backend_dep,
+]
+
+libeds_test = library('eds-test',
+  libeds_test_sources,
+  dependencies: libeds_test_deps,
+  vala_args: common_test_lib_flags,
+)
+
+libeds_test_dep = declare_dependency(
+  link_with: libeds_test,
+  include_directories: include_directories('.'),
+)
diff --git a/tests/lib/key-file/meson.build b/tests/lib/key-file/meson.build
new file mode 100644
index 00000000..740b50d8
--- /dev/null
+++ b/tests/lib/key-file/meson.build
@@ -0,0 +1,15 @@
+libkeyfile_test_sources = [
+  'backend.vala',
+  'test-case.vala',
+]
+
+libkeyfile_test = library('keyfile-test',
+  libkeyfile_test_sources,
+  dependencies: common_test_lib_deps,
+  vala_args: common_test_lib_flags,
+)
+
+libkeyfile_test_dep = declare_dependency(
+  link_with: libkeyfile_test,
+  include_directories: include_directories('.'),
+)
diff --git a/tests/lib/libsocialweb/meson.build b/tests/lib/libsocialweb/meson.build
new file mode 100644
index 00000000..796a3966
--- /dev/null
+++ b/tests/lib/libsocialweb/meson.build
@@ -0,0 +1,15 @@
+libsocialweb_test_lib_sources = [
+  'test-case.vala',
+  'backend.vala',
+]
+
+libsocialweb_test_lib = library('libsocialweb-test-lib',
+  libsocialweb_test_lib_sources,
+  dependencies: common_test_lib_deps,
+  vala_args: common_test_lib_flags,
+)
+
+libsocialweb_test_lib_dep = declare_dependency(
+  link_with: libsocialweb_test_lib,
+  include_directories: include_directories('.'),
+)
diff --git a/tests/lib/meson.build b/tests/lib/meson.build
new file mode 100644
index 00000000..30e58598
--- /dev/null
+++ b/tests/lib/meson.build
@@ -0,0 +1,74 @@
+# The library that is used by the libraries tests
+libfolks_test_sources = [
+  'disconnection-queue.vala',
+  'gtestdbus.c',
+  'haze-remove-directory.c',
+  'org-freedesktop-dbus-mock.vala',
+  'test-case-helper.c',
+  'test-case.vala',
+  'test-utils.vala',
+]
+
+libfolks_test_deps = [
+  gobject,
+  gio,
+  gee,
+  dbus_glib,
+  libfolks_dep,
+  folks_test_dbus,
+  posix,
+]
+
+libfolks_test_vala_flags = [
+  '--debug',
+  '--pkg', 'build-conf',
+  '-h', 'folks-test-internal.h',
+]
+
+libfolks_test = library('folks-test',
+  libfolks_test_sources,
+  dependencies: libfolks_test_deps,
+  vala_args: libfolks_test_vala_flags,
+)
+
+libfolks_test_dep = declare_dependency(
+  link_with: libfolks_test,
+  include_directories: include_directories('.'),
+)
+
+# Common variables
+common_test_lib_deps = [
+  gobject,
+  libfolks_dep,
+  libfolks_test_dep,
+  folks_test_dbus,
+]
+
+common_test_lib_flags = [
+  '--debug',
+]
+
+# Subdirs
+subdir('dummy')
+subdir('key-file')
+
+if bluez_backend_enabled
+  subdir('bluez')
+endif
+
+if telepathy_backend_enabled
+  subdir('telepathy/contactlist')
+  subdir('telepathy')
+endif
+
+if libsocialweb_backend_enabled
+  subdir('libsocialweb')
+endif
+
+if eds_backend_enabled
+  subdir('eds')
+endif
+
+if tracker_backend_enabled
+  subdir('tracker')
+endif
diff --git a/tests/lib/telepathy/contactlist/meson.build b/tests/lib/telepathy/contactlist/meson.build
new file mode 100644
index 00000000..1623090a
--- /dev/null
+++ b/tests/lib/telepathy/contactlist/meson.build
@@ -0,0 +1,76 @@
+# Taken from telepathy-glib. The only change is to remove the option to install
+# the data files.
+#
+# PLEASE DO NOT MODIFY THIS CONNECTION MANAGER. Either subclass it,
+# copy-and-modify (moving it to a better namespace), or make changes in the
+# copy in telepathy-glib first.
+
+telepathy_test_contactlist_sources = [
+  'backend.c',
+  'contact-list-manager.c',
+  'contacts-conn.c',
+  'room-list-chan.c',
+  'simple-account-manager.c',
+  'simple-account.c',
+  'simple-conn.c',
+  'textchan-null.c',
+  'util.c',
+]
+
+ telepathy_test_contactlist_headers = [ # Needed for GIR
+  'backend.h',
+  'contact-list-manager.h',
+  'contacts-conn.h',
+  'debug.h',
+  'room-list-chan.h',
+  'simple-account-manager.h',
+  'simple-account.h',
+  'simple-conn.h',
+  'textchan-null.h',
+  'util.h',
+]
+
+telepathy_test_contactlist_manager = custom_target('tp_test_contact_list.manager',
+  output: 'param-spec-struct.h',
+  input: 'manager-file.py',
+  command: [ test_tools_manager_file_script,
+    '@INPUT@',
+    meson.current_build_dir(),
+  ],
+)
+
+telepathy_test_contactlist_deps = [
+  glib,
+  gio,
+  gobject,
+  telepathy_glib,
+  dbus_glib,
+]
+
+telepathy_test_contactlist_lib = static_library('tp-test-contactlist',
+  [ telepathy_test_contactlist_sources, telepathy_test_contactlist_manager ],
+  dependencies: telepathy_test_contactlist_deps,
+  include_directories: config_h_dir,
+)
+
+telepathy_test_contactlist_gir = gnome.generate_gir(telepathy_test_contactlist_lib,
+  sources: [ telepathy_test_contactlist_sources, telepathy_test_contactlist_headers ],
+  includes: [ 'GObject-2.0', 'TelepathyGLib-0.12' ],
+  nsversion: folks_api_version, # XXX check this
+  namespace: 'TpTests',
+  header: 'tp-test-contactlist.h',
+  # identifier_prefix: 'FolksTpTests',
+  # extra_args: [
+  #   '--c-include=tp-lowlevel.h',
+  # ],
+)
+
+telepathy_test_contactlist_vapi = gnome.generate_vapi('tp-test-contactlist',
+  sources: telepathy_test_contactlist_gir.get(0),
+  packages: [ 'gio-2.0', 'telepathy-glib' ],
+)
+
+telepathy_test_contactlist_dep = declare_dependency(
+  link_with: telepathy_test_contactlist_lib,
+  dependencies: telepathy_test_contactlist_vapi,
+)
diff --git a/tests/lib/telepathy/meson.build b/tests/lib/telepathy/meson.build
new file mode 100644
index 00000000..540622b7
--- /dev/null
+++ b/tests/lib/telepathy/meson.build
@@ -0,0 +1,27 @@
+telepathy_test_lib_sources = [
+  'test-case.vala',
+]
+
+telepathy_test_lib_deps = [
+  common_test_lib_deps,
+  telepathy_test_contactlist_dep,
+  folks_telepathy_backend_dep,
+  libkeyfile_test_dep,
+]
+
+telepathy_test_lib = library('telepathy-test',
+  telepathy_test_lib_sources,
+  dependencies: telepathy_test_lib_deps,
+  vala_args: common_test_lib_flags,
+)
+
+telepathy_test_lib_dep = declare_dependency(
+  link_with: telepathy_test_lib,
+  include_directories: include_directories('.'),
+  dependencies: [
+    folks_telepathy_backend_dep,
+    # Exposed by the VAPI
+    libkeyfile_test_dep,
+    telepathy_test_contactlist_dep,
+  ],
+)
diff --git a/tests/lib/test-case.vala b/tests/lib/test-case.vala
index 3b60e988..2dc58daa 100644
--- a/tests/lib/test-case.vala
+++ b/tests/lib/test-case.vala
@@ -65,8 +65,10 @@ public abstract class Folks.TestCase : Object
       this._transient_dir = this.create_transient_dir ();
       this.private_bus_up ();
 
-      if (Environment.get_variable ("FOLKS_TESTS_INSTALLED") == null)
+      /* if (Environment.get_variable ("FOLKS_TESTS_INSTALLED") == null) */
+      if (false)
         {
+            /* XXX fix this (no .libs) */
           string[] locations = {
               Folks.BuildConf.ABS_TOP_BUILDDIR + "/backends/key-file/.libs/key-file.so",
               Folks.BuildConf.ABS_TOP_BUILDDIR + "/backends/dummy/.libs/dummy.so",
@@ -91,7 +93,7 @@ public abstract class Folks.TestCase : Object
             locations += Folks.BuildConf.ABS_TOP_BUILDDIR + "/backends/bluez/.libs/bluez.so";
 
           Environment.set_variable ("FOLKS_BACKEND_PATH",
-              string.joinv (":", locations), true);
+              string.joinv (":", locations), false);
         }
 
       /* By default, no backend is allowed. Subclasses must override. */
diff --git a/tests/lib/tracker/meson.build b/tests/lib/tracker/meson.build
new file mode 100644
index 00000000..662c2661
--- /dev/null
+++ b/tests/lib/tracker/meson.build
@@ -0,0 +1,26 @@
+tracker_test_lib_sources = [
+  'test-case.vala',
+  'backend.vala',
+]
+
+tracker_test_lib_deps = [
+  common_test_lib_deps,
+  folks_tracker_backend_dep,
+]
+
+tracker_test_lib_vala_flags = [
+  common_test_lib_flags,
+  '--pkg', 'build-conf',
+]
+
+tracker_test_lib = library('tracker-test-lib',
+  tracker_test_lib_sources,
+  dependencies: tracker_test_lib_deps,
+  vala_args: tracker_test_lib_vala_flags,
+)
+
+tracker_test_lib_dep = declare_dependency(
+  link_with: tracker_test_lib,
+  include_directories: include_directories('.'),
+  dependencies: tracker_sparql_dep,
+)
diff --git a/tests/libsocialweb/meson.build b/tests/libsocialweb/meson.build
new file mode 100644
index 00000000..4f35c3a3
--- /dev/null
+++ b/tests/libsocialweb/meson.build
@@ -0,0 +1,22 @@
+# in order from least to most complex
+libsocialweb_tests = [
+  'dummy-lsw',
+  'aggregation',
+]
+
+libsocialweb_tests_deps = [
+  common_test_deps,
+  libsocialweb_test_lib_dep,
+  folks_libsocialweb_backend_dep,
+]
+
+
+foreach _test: libsocialweb_tests
+  test_executable = executable('libsocialweb-'+_test,
+    '@0@.vala'.format(_test),
+    dependencies: libsocialweb_tests_deps,
+    vala_args: common_test_vala_flags,
+  )
+
+  test('[Libsocialweb backend] @0@'.format(_test), test_executable)
+endforeach
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 00000000..2c2f1dcb
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,50 @@
+# A VAPI for common dbus tests
+folks_test_dbus = valac.find_library('folks-test-dbus',
+  dirs: join_paths(meson.current_source_dir(), 'lib')
+)
+
+# Test data
+# subdir('data') XXX what needs to happen here?
+subdir('tools')
+
+# Libraries for the tests
+subdir('lib')
+
+# Common variables
+common_test_deps = [
+  libfolks_dep,
+  libfolks_test_dep,
+  folks_test_dbus,
+]
+
+common_test_vala_flags = [
+  '--debug',
+]
+
+common_test_environment = environment()
+common_test_environment.append('FOLKS_BACKEND_PATH', folks_backend_path_uninstalled)
+
+# The tests, grouped in a directory per backend
+subdir('dummy')
+subdir('key-file')
+
+if bluez_backend_enabled
+  subdir('bluez')
+endif
+
+if telepathy_backend_enabled
+#  subdir('telepathy')
+  subdir('folks')
+endif
+
+if libsocialweb_backend_enabled
+  subdir('libsocialweb')
+endif
+
+if eds_backend_enabled
+  subdir('eds')
+endif
+
+if tracker_backend_enabled
+  subdir('tracker')
+endif
diff --git a/tests/tools/meson.build b/tests/tools/meson.build
new file mode 100644
index 00000000..babbe5f6
--- /dev/null
+++ b/tests/tools/meson.build
@@ -0,0 +1,2 @@
+# Used for telepathy test lib (contactlist)
+test_tools_manager_file_script = find_program('manager-file.py')
diff --git a/tests/tracker/meson.build b/tests/tracker/meson.build
new file mode 100644
index 00000000..6195c630
--- /dev/null
+++ b/tests/tracker/meson.build
@@ -0,0 +1,81 @@
+# in order from least to most complex
+tracker_tests = [
+  'individual-retrieval',
+  'name-details-interface',
+  'avatar-details-interface',
+  'im-details-interface',
+  'phone-details-interface',
+  'email-details-interface',
+  'url-details-interface',
+  'favourite-details-interface',
+  'fullname-updates',
+  'add-contact',
+  'default-contact',
+  'remove-contact',
+  'nickname-updates',
+  'family-name-updates',
+  'given-name-updates',
+  'additional-names-updates',
+  'prefix-name-updates',
+  'suffix-name-updates',
+  'website-updates',
+  'favourite-updates',
+  'emails-updates',
+  'phones-updates',
+  'imaddresses-updates',
+  'role-details-interface',
+  'birthday-details-interface',
+  'birthday-updates',
+  'note-details-interface',
+  'gender-details-interface',
+  'postal-address-details-interface',
+  'avatar-updates',
+  'add-persona',
+  'remove-persona',
+  'set-nickname',
+  'set-favourite',
+  'set-phones',
+  'set-emails',
+  'set-avatar',
+  'set-structured-name',
+  'set-full-name',
+  'set-urls',
+  'set-im-addresses',
+  'set-postal-addresses',
+  'set-roles',
+  'set-notes',
+  'set-birthday',
+  'set-gender',
+  'link-personas',
+  'duplicated-emails',
+  'duplicated-phones',
+  'link-personas-via-local-ids',
+  'match-im-addresses',
+  'match-email-addresses',
+  'match-known-emails',
+  'match-phone-number',
+  'match-name',
+  'match-all',
+  'set-duplicate-email',
+  'set-null-avatar',
+]
+
+tracker_tests_deps = [
+  common_test_deps,
+  tracker_test_lib_dep,
+  folks_tracker_backend_dep,
+]
+
+
+foreach _test: tracker_tests
+  test_executable = executable('tracker-'+_test,
+    '@0@.vala'.format(_test),
+    dependencies: tracker_tests_deps,
+    vala_args: common_test_vala_flags,
+  )
+
+  test('[Tracker backend] @0@'.format(_test),
+    test_executable,
+    env: common_test_environment,
+  )
+endforeach
diff --git a/tools/inspect/meson.build b/tools/inspect/meson.build
new file mode 100644
index 00000000..e92e66a5
--- /dev/null
+++ b/tools/inspect/meson.build
@@ -0,0 +1,42 @@
+folks_inspect_sources = [
+  'command-backends.vala',
+  'command-debug.vala',
+  'command-help.vala',
+  'command-individuals.vala',
+  'command-linking.vala',
+  'command-persona-stores.vala',
+  'command-personas.vala',
+  'command-quit.vala',
+  'command-search.vala',
+  'command-set.vala',
+  'command-signals.vala',
+  'inspect.vala',
+  'signal-manager.vala',
+  'utils.vala',
+]
+
+folks_inspect_deps = [
+  gobject,
+  libfolks_dep,
+  posix,
+  readline,
+  gio,
+  gee,
+]
+
+folks_inspect_vala_flags = [
+  '--pkg', 'build-conf',
+]
+
+folks_inspect_c_flags = [
+  '-include', 'config.h',
+]
+
+folks_inspect = executable('folks-inspect',
+  folks_inspect_sources,
+  dependencies: folks_inspect_deps,
+  vala_args: folks_inspect_vala_flags,
+  c_args: folks_inspect_c_flags,
+  include_directories: config_h_dir,
+  install: true,
+)
diff --git a/tools/meson.build b/tools/meson.build
new file mode 100644
index 00000000..eb7e85d1
--- /dev/null
+++ b/tools/meson.build
@@ -0,0 +1,33 @@
+# folks-inspect
+subdir('inspect')
+
+# folks-import
+folks_import_sources = [
+  'import.vala',
+  'import-pidgin.vala',
+]
+
+folks_import_deps = [
+  gee,
+  gobject,
+  glib,
+  libfolks_dep,
+  libxml,
+]
+
+folks_import_vala_flags = [
+  '--pkg', 'build-conf',
+]
+
+folks_import_c_flags = [
+  '-include', 'config.h',
+]
+
+folks_import = executable('folks-import',
+  folks_import_sources,
+  dependencies: folks_import_deps,
+  vala_args: folks_import_vala_flags,
+  c_args: folks_import_c_flags,
+  include_directories: config_h_dir,
+  install: true,
+)


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