[tracker/wip/sam/meson: 19/19] Meson build instructions for Tracker



commit 29d4e1e3193248f1d75d8bb3ee8cc40508c07f87
Author: Sam Thursfield <ssssam gmail com>
Date:   Sun Mar 27 14:31:41 2016 +0100

    Meson build instructions for Tracker
    
    See <http://mesonbuild.com/> for information about Meson.
    
    These build instructions are close to completion.
    
    Differences from Autotools:
    
      * There's no `make dist` equivalent. We currently produce release
        tarballs containing the output files of the Vala compiler. We need
        to think through whether we can stop doing that.
      * The apps and userguides miners are not built
      * The Firefox, Thunderbird, Evolution and Nautilus plugins are not
        built
      * tracker-needle is not built
      * The stopwords are not installed
      * tracker-writeback is not built
      * Perhaps some other regressions, who knows.
    
    There are a couple of Meson bugs which make the Meson rules more
    complex than they'd otherwise need to be:
    
      * https://github.com/mesonbuild/meson/issues/671 -- means we can't
        depend on tracker_common_dep in most places and have to manually
        set link_with, include_directories and sources instead.
      * https://github.com/mesonbuild/meson/issues/892 -- means we have
        to install generated Vala headers using a script
      * https://github.com/mesonbuild/meson/issues/1229 -- means adding
        the #include guard to libtracker-sparql/tracker-generated-no-checks.h
        is a pain
    
    Here's a rough speed comparison.
    
    Meson:
            time sh -c 'meson .. --prefix=/opt/tracker-meson -D 
bash_completion=/opt/tracker-meson/share/bash-completion 
-Dsystemd_services=/opt/tracker-meson/lib/systemd/user 
-Ddbus_services=/opt/tracker-meson/share/dbus-1/services && ninja-build -j 4 && ninja-build install'
    
            real  0m59.017s
            user  2m1.208s
            sys   0m18.125s
    
    Autotools:
    
            still waiting for ./configure to finish

 .gitignore                                         |    1 +
 config.h.meson.in                                  |  139 +++++
 docs/manpages/meson.build                          |   25 +
 docs/meson.build                                   |    3 +
 docs/reference/libtracker-control/meson.build      |    8 +
 docs/reference/libtracker-miner/meson.build        |    9 +
 docs/reference/libtracker-sparql/meson.build       |    9 +
 docs/reference/meson.build                         |    5 +
 docs/reference/ontology/meson.build                |   37 ++
 docs/tools/gen-doc.sh                              |    8 +-
 docs/tools/meson.build                             |   18 +
 examples/libtracker-miner/meson.build              |    7 +
 examples/libtracker-sparql/meson.build             |    7 +
 examples/meson.build                               |    2 +
 meson.build                                        |  639 ++++++++++++++++++++
 meson_options.txt                                  |   51 ++
 po/meson.build                                     |    6 +
 src/create-miner-symlinks.sh                       |   13 +
 src/gvdb/meson.build                               |   14 +
 src/install-generated-header.sh                    |   11 +
 src/libtracker-bus/meson.build                     |   28 +
 src/libtracker-common/meson.build                  |   66 ++
 src/libtracker-control/meson.build                 |   27 +
 src/libtracker-data/meson.build                    |   71 +++
 src/libtracker-direct/meson.build                  |   25 +
 src/libtracker-extract/meson.build                 |   50 ++
 src/libtracker-fts/meson.build                     |   23 +
 src/libtracker-miner/meson.build                   |   96 +++
 src/libtracker-remote/meson.build                  |   28 +
 src/libtracker-sparql-backend/meson.build          |   10 +
 src/libtracker-sparql/meson.build                  |   91 +++
 .../tracker-sparql-add-include-guards.sh           |   17 +
 src/meson.build                                    |   47 ++
 src/miners/fs/meson.build                          |   71 +++
 src/miners/meson.build                             |    4 +
 src/miners/rss/meson.build                         |   44 ++
 src/tracker-extract/meson.build                    |  199 ++++++
 src/tracker-needle/meson.build                     |   20 +
 src/tracker-preferences/meson.build                |   37 ++
 src/tracker-store/meson.build                      |   83 +++
 src/tracker/meson.build                            |   38 ++
 tests/common/meson.build                           |   15 +
 tests/functional-tests/ipc/meson.build             |   53 ++
 tests/functional-tests/meson.build                 |   41 ++
 tests/gvdb/meson.build                             |    7 +
 tests/libtracker-common/meson.build                |   61 ++
 tests/libtracker-data/meson.build                  |   51 ++
 tests/libtracker-extract/meson.build               |   60 ++
 tests/libtracker-fts/meson.build                   |   13 +
 tests/libtracker-miner/meson.build                 |   69 +++
 tests/libtracker-sparql/meson.build                |   19 +
 tests/meson.build                                  |   26 +
 tests/tracker-steroids/meson.build                 |    7 +
 utils/meson.build                                  |    3 +
 utils/mtp/meson.build                              |    2 +
 utils/ontology/meson.build                         |    7 +
 utils/tracker-resdump/meson.build                  |    2 +
 57 files changed, 2521 insertions(+), 2 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index a3b31cb..f7c26f2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,6 +14,7 @@
 .deps
 .libs
 config.*
+!config.h.meson.in
 ABOUT-NLS
 aclocal.m4
 autom4te.cache
diff --git a/config.h.meson.in b/config.h.meson.in
new file mode 100644
index 0000000..4294d84
--- /dev/null
+++ b/config.h.meson.in
@@ -0,0 +1,139 @@
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Extras added manually */
+#mesondefine LOCALEDIR
+#mesondefine SHAREDIR
+#mesondefine TRACKER_MINERS_DIR
+#mesondefine TRACKER_UI_DIR
+
+/* Define if we disable the journal */
+#mesondefine DISABLE_JOURNAL
+
+/* Include functional tests in the installation */
+#mesondefine DIST_FUNCTIONAL_TESTS
+
+/* Use new evolution-shell API */
+#mesondefine EVOLUTION_SHELL_2_91
+
+/* Use new evolution-shell API */
+#mesondefine EVOLUTION_SHELL_3_2
+
+/* Use new evolution-shell API */
+#mesondefine EVOLUTION_SHELL_3_3_5
+
+/* Define the gettext package to be used */
+#mesondefine GETTEXT_PACKAGE
+
+/* Define that GStreamer Discoverer should be used */
+#mesondefine GSTREAMER_BACKEND_DISCOVERER
+
+/* Define that GUPnP-DLNA should be used */
+#mesondefine GSTREAMER_BACKEND_GUPNP_DLNA
+
+/* Guarantee existence of some metadata */
+#mesondefine GUARANTEE_METADATA
+
+/* Defined if Sqlite has FTS5 compiled in */
+#mesondefine HAVE_BUILTIN_FTS
+
+/* Enca language detection aid */
+#mesondefine HAVE_ENCA
+
+/* Define if we have exempi */
+#mesondefine HAVE_EXEMPI
+
+/* Define to 1 if you have the `getline' function. */
+#mesondefine HAVE_GETLINE
+
+/* Define if we have GStreamer */
+#mesondefine HAVE_GSTREAMER
+
+/* Define if we have HAL */
+#mesondefine HAVE_HAL
+
+/* Define if we have libcue */
+#mesondefine HAVE_LIBCUE
+
+/* Define if we have libcue 2 or up */
+#mesondefine HAVE_LIBCUE2
+
+/* Define if we have libexif */
+#mesondefine HAVE_LIBEXIF
+
+/* libicu Unicode support library */
+#mesondefine HAVE_LIBICU
+
+/* ICU language detection aid */
+#mesondefine HAVE_LIBICU_CHARSET_DETECTION
+
+/* Define if we have libiptcdata */
+#mesondefine HAVE_LIBIPTCDATA
+
+/* Define if we have libmediaart */
+#mesondefine HAVE_LIBMEDIAART
+
+/* Define if we have libstemmer */
+#mesondefine HAVE_LIBSTEMMER
+
+/* libunistring Unicode support library */
+#mesondefine HAVE_LIBUNISTRING
+
+/* Define if we have meegotouch */
+#mesondefine HAVE_MEEGOTOUCH
+
+/* Define if we have NetworkManager for network status detection */
+#mesondefine HAVE_NETWORK_MANAGER
+
+/* Define to 1 if you have the `posix_fadvise' function. */
+#mesondefine HAVE_POSIX_FADVISE
+
+/* Define to 1 if you have the `statvfs64' function. */
+#mesondefine HAVE_STATVFS64
+
+/* Define to 1 if you have the `strnlen' function. */
+#mesondefine HAVE_STRNLEN
+
+/* Define to 0 if tracker FTS is not compiled */
+#mesondefine HAVE_TRACKER_FTS
+
+/* Define if we have UPOWER */
+#mesondefine HAVE_UPOWER
+
+/* Define to 1 if you have the `up_client_get_on_low_battery' function. */
+#mesondefine HAVE_UP_CLIENT_GET_ON_LOW_BATTERY
+
+/* Define to the address where bug reports for this package should be sent. */
+#mesondefine PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#mesondefine PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#mesondefine PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#mesondefine PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#mesondefine PACKAGE_URL
+
+/* Define to the version of this package. */
+#mesondefine PACKAGE_VERSION
+
+/* Define to the Tracker binary age */
+#mesondefine TRACKER_BINARY_AGE
+
+/* Define to the Tracker interface age */
+#mesondefine TRACKER_INTERFACE_AGE
+
+/* Define to the Tracker major version */
+#mesondefine TRACKER_MAJOR_VERSION
+
+/* Define to the Tracker micro version */
+#mesondefine TRACKER_MICRO_VERSION
+
+/* Define to the Tracker minor version */
+#mesondefine TRACKER_MINOR_VERSION
+
+/* Unzip ps.gz files */
+#mesondefine USING_UNZIPPSFILES
diff --git a/docs/manpages/meson.build b/docs/manpages/meson.build
new file mode 100644
index 0000000..50317f7
--- /dev/null
+++ b/docs/manpages/meson.build
@@ -0,0 +1,25 @@
+install_man('tracker-extract.1')
+install_man('tracker-info.1')
+install_man('tracker-miner-fs.1')
+install_man('tracker-daemon.1')
+install_man('tracker-search.1')
+install_man('tracker-sparql.1')
+install_man('tracker-sql.1')
+install_man('tracker-status.1')
+install_man('tracker-store.1')
+install_man('tracker-tag.1')
+install_man('tracker-reset.1')
+install_man('tracker-index.1')
+install_man('tracker-writeback.1')
+
+if have_tracker_miner_rss
+  install_man('tracker-miner-rss.1')
+endif
+
+if have_tracker_needle
+  install_man('tracker-needle.1')
+endif
+
+if have_tracker_preferences
+  install_man('tracker-preferences.1')
+endif
diff --git a/docs/meson.build b/docs/meson.build
new file mode 100644
index 0000000..76e5979
--- /dev/null
+++ b/docs/meson.build
@@ -0,0 +1,3 @@
+subdir('tools')
+subdir('manpages')
+subdir('reference')
diff --git a/docs/reference/libtracker-control/meson.build b/docs/reference/libtracker-control/meson.build
new file mode 100644
index 0000000..b7cca19
--- /dev/null
+++ b/docs/reference/libtracker-control/meson.build
@@ -0,0 +1,8 @@
+version_xml = configure_file(input: 'version.xml.in',
+    output: 'version.xml',
+    configuration: conf)
+
+gnome.gtkdoc('libtracker-control',
+    src_dir: 'src/libtracker-control',
+    main_sgml: 'libtracker-control-docs.sgml',
+    install: true)
diff --git a/docs/reference/libtracker-miner/meson.build b/docs/reference/libtracker-miner/meson.build
new file mode 100644
index 0000000..7af9972
--- /dev/null
+++ b/docs/reference/libtracker-miner/meson.build
@@ -0,0 +1,9 @@
+version_xml = configure_file(input: 'version.xml.in',
+    output: 'version.xml',
+    configuration: conf)
+
+gnome.gtkdoc('libtracker-miner',
+    src_dir: 'src/libtracker-miner',
+    main_sgml: 'libtracker-miner-docs.sgml',
+    content_files: 'overview.sgml',
+    install: true)
diff --git a/docs/reference/libtracker-sparql/meson.build b/docs/reference/libtracker-sparql/meson.build
new file mode 100644
index 0000000..b22df85
--- /dev/null
+++ b/docs/reference/libtracker-sparql/meson.build
@@ -0,0 +1,9 @@
+version_xml = configure_file(input: 'version.xml.in',
+    output: 'version.xml',
+    configuration: conf)
+
+gnome.gtkdoc('libtracker-sparql',
+    src_dir: 'src/libtracker-sparql',
+    main_sgml: 'libtracker-sparql-docs.sgml',
+    content_files: ['overview.sgml', 'examples.sgml'],
+    install: true)
diff --git a/docs/reference/meson.build b/docs/reference/meson.build
new file mode 100644
index 0000000..b87eb61
--- /dev/null
+++ b/docs/reference/meson.build
@@ -0,0 +1,5 @@
+subdir('libtracker-control')
+subdir('libtracker-miner')
+subdir('libtracker-sparql')
+
+subdir('ontology')
diff --git a/docs/reference/ontology/meson.build b/docs/reference/ontology/meson.build
new file mode 100644
index 0000000..6c1b9d3
--- /dev/null
+++ b/docs/reference/ontology/meson.build
@@ -0,0 +1,37 @@
+version_xml = configure_file(input: 'version.xml.in',
+    output: 'version.xml',
+    configuration: conf)
+
+
+#for f in `find $ONTOLOGIES_DATA_DIR -name "*.description"` ; do
+#    # ../../src/ontologies/XX-aaa.description -> PREFIX=aaa
+#    TMPNAME=${f%.description}
+#    PREFIX=${TMPNAME#*-}
+#    echo "- Generating $PREFIX documentation"
+#
+#    $TTL2SGML -d $f -o $BUILD_DIR/$PREFIX-ontology.xml \
+#        -e $ONTOLOGIES_INFO_DIR/$PREFIX/explanation.xml
+
+
+gen_doc = meson.source_root() + '/docs/tools/gen-doc.sh'
+generated = custom_target('ontology-doc-generated',
+    output: 'gen-doc.stamp',
+    command: [gen_doc, ttl2sgml, ttlresource2sgml,
+              meson.source_root() + '/src/ontologies',
+              meson.source_root() + '/docs/ontologies',
+              join_paths(meson.current_build_dir(), 'xml/')],
+    depends: [ttl2sgml, ttlresource2sgml],
+    # FIXME: this shouldn't be necessary, but currently the 'dependencies'
+    # parameter to gnome.gtkdoc() doesn't actually trigger building of custom
+    # targets.
+    build_always: true
+)
+
+gnome.gtkdoc('ontology',
+    src_dir: include_directories('.'),
+    main_sgml: 'ontology-docs.sgml',
+    # FIXME: passing 'generated' here has no effect; the gtkdoc support in
+    # Meson actually only uses this parameter for building and linking the
+    # GObject Introspection scanner right now.
+    dependencies: generated,
+    install: true)
diff --git a/docs/tools/gen-doc.sh b/docs/tools/gen-doc.sh
index 3405988..10e0634 100755
--- a/docs/tools/gen-doc.sh
+++ b/docs/tools/gen-doc.sh
@@ -19,6 +19,8 @@
 # 02110-1301, USA.
 #
 
+set -e
+
 if [ $# -lt 5 ]; then
        echo "Insufficient arguments provided"
        echo "Usage: $0 <ttl2sgml> <ttlres2sgml> <ontology-data-dir> <ontology-info-dir> <build-dir>"
@@ -31,14 +33,16 @@ ONTOLOGIES_DATA_DIR=$3
 ONTOLOGIES_INFO_DIR=$4
 BUILD_DIR=$5
 
-echo "Building class documentation..."
+if [ ! -e $BUILD_DIR ]; then
+    mkdir -p $BUILD_DIR
+fi
+
 $TTLRES2SGML -d $ONTOLOGIES_DATA_DIR -o $BUILD_DIR
 
 for f in `find $ONTOLOGIES_DATA_DIR -name "*.description"` ; do
     # ../../src/ontologies/XX-aaa.description -> PREFIX=aaa
     TMPNAME=${f%.description}
     PREFIX=${TMPNAME#*-}
-    echo "- Generating $PREFIX documentation"
 
     $TTL2SGML -d $f -o $BUILD_DIR/$PREFIX-ontology.xml \
        -e $ONTOLOGIES_INFO_DIR/$PREFIX/explanation.xml
diff --git a/docs/tools/meson.build b/docs/tools/meson.build
new file mode 100644
index 0000000..cf24f0e
--- /dev/null
+++ b/docs/tools/meson.build
@@ -0,0 +1,18 @@
+# These tools are used for generating the ontologies documentation.
+
+ttl_loader_files = [
+    'ttl_loader.c',
+    'ttl_model.c',
+    'ttl_sgml.c',
+    'qname.c',
+]
+
+ttl2sgml = executable('ttl2sgml',
+    ttl_loader_files, 'ttl2sgml.c',
+    dependencies: [tracker_data_dep, tracker_sparql_dep],
+    c_args: ['-DTRACKER_COMPILATION'])
+
+ttlresource2sgml = executable('ttlresource2sgml',
+    ttl_loader_files, 'ttlresource2sgml.c',
+    dependencies: [tracker_data_dep, tracker_sparql_dep],
+    c_args: ['-DTRACKER_COMPILATION'])
diff --git a/examples/libtracker-miner/meson.build b/examples/libtracker-miner/meson.build
new file mode 100644
index 0000000..460b9c7
--- /dev/null
+++ b/examples/libtracker-miner/meson.build
@@ -0,0 +1,7 @@
+sources = [
+    'tracker-miner-test.c',
+    'tracker-main.c']
+
+executable('tracker-miner-test', sources,
+    dependencies: [tracker_common_dep, tracker_miner_dep, tracker_sparql_dep]
+)
diff --git a/examples/libtracker-sparql/meson.build b/examples/libtracker-sparql/meson.build
new file mode 100644
index 0000000..6e48179
--- /dev/null
+++ b/examples/libtracker-sparql/meson.build
@@ -0,0 +1,7 @@
+executable('async-connection', 'async-connection.c',
+    dependencies: [tracker_common_dep, tracker_sparql_dep]
+)
+
+executable('class-signal', 'class-signal.c',
+    dependencies: [tracker_common_dep, tracker_sparql_dep]
+)
diff --git a/examples/meson.build b/examples/meson.build
new file mode 100644
index 0000000..6ab29f9
--- /dev/null
+++ b/examples/meson.build
@@ -0,0 +1,2 @@
+subdir('libtracker-miner')
+subdir('libtracker-sparql')
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..b1bccb2
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,639 @@
+# Experimental, incomplete build instructions for Tracker using
+# Meson: http://www.mesonbuild.com/
+#
+# Requires Meson 0.36.0 or newer.
+#
+# Open questions:
+#   - is the installed version identical to an installed
+#     autotools build?
+#   - does crossbuilding (e.g. in Buildroot) work correctly?
+
+project('tracker', 'c', 'vala', 'cpp', version: '1.11.3')
+
+gnome = import('gnome')
+i18n = import('i18n')
+cc = meson.get_compiler('c')
+
+# This is the X.Y used in -llibtracker-FOO-X.Y
+tracker_api_version = '1.0'
+
+glib_required = '2.40.0'
+
+# 3.6.11 for sqlite_backup API
+# 3.6.16 to fix test failures
+# 3.6.17 for shared cache mode with virtual tables
+# 3.7.0 for WAL
+# 3.7.9 for FTS4 content= support
+sqlite_required = '3.7.9'
+
+avcodec = dependency('libavcodec', version: '>= 0.8.4', required: false)
+avformat = dependency('libavformat', version: '>= 0.8.4', required: false)
+avutil = dependency('libavutil', version: '>= 0.8.4', required: false)
+cairo = dependency('cairo', version: '> 1.0')
+camel = dependency('camel-1.2', version: '> 2.32.0', required: false)
+dbus = dependency('dbus-1', version: '> 1.3.1')
+eds = dependency('evolution-data-server-1.2', version: '> 2.32.0', required: false)
+evo_plugin = dependency('evolution-plugin-3.0', required: false)
+evo_shell = dependency('evolution-shell-3.0', version: '> 3.1', required: false)
+exempi = dependency('exempi-2.0', version: '> 2.1.0', required: false)
+flac = dependency('flac', version: '> 1.2.1', required: false)
+gee = dependency('gee-0.8', version: '> 0.3')
+gio = dependency('gio-2.0', version: '>' + glib_required)
+gio_unix = dependency('gio-unix-2.0', version: '>' + glib_required)
+glib = dependency('glib-2.0', version: '>' + glib_required)
+gmodule = dependency('gmodule-2.0', version: '>' + glib_required)
+gobject = dependency('gobject-2.0', version: '>' + glib_required)
+gstreamer = dependency('gstreamer-1.0', required: false)
+gstreamer_pbutils = dependency('gstreamer-pbutils-1.0', required: false)
+gstreamer_tag = dependency('gstreamer-tag-1.0', required: false)
+gtk3 = dependency('gtk+-3.0', version: '> 3.0.0', required: false)
+gupnp_dlna = dependency('gupnp-dlna-2.0', version: '> 0.9.4', required: false)
+gupnp_dlna_gst = dependency('gupnp-dlna-gst-2.0', version: '> 0.9.4', required: false)
+icu_i18n = dependency('icu-i18n', version: '> 4.8.1.1', required: false)
+icu_uc = dependency('icu-uc', version: '> 4.8.1.1', required: false)
+json_glib = dependency('json-glib-1.0', version: '>= 1.0', required: true)
+libcue = dependency('libcue', required: false)
+libemail_utils = dependency('libemail-utils', required: false)
+libemail_engine = dependency('libemail-engine', required: false)
+libexif = dependency('libexif', version: '> 0.6', required: false)
+libgrss = dependency('libgrss', version: '> 0.7', required: false)
+libgsf = dependency('libgsf-1', version: '> 1.14.24', required: false)
+libgxps = dependency('libgxps', required: false)
+libiptcdata = dependency('libiptcdata', required: false)
+libmediaart = dependency('libmediaart', version: '> 1.9.0', required: false)
+libosinfo = dependency('libosinfo', version: '> 0.2.9', required: false)
+libpng = dependency('libpng', version: '> 0.89', required: false)
+libsoup = dependency('libsoup-2.4', version: '> 2.40', required: true)
+libtiff = dependency('libtiff-4', required: false)
+libxml2 = dependency('libxml-2.0', version: '> 2.6')
+libvorbis = dependency('vorbisfile', version: '> 0.22')
+meegotouch = dependency('meegotouch', version: '> 0.20', required: false)
+nautilus_extension = dependency('libnautilus-extension', required: false)
+network_manager = dependency('libnm-glib', version: '> 0.8', required: false)
+poppler = dependency('poppler-glib', version: '> 0.16.0', required: false)
+sqlite = dependency('sqlite3', version: '>' + sqlite_required)
+taglib = dependency('taglib_c', version: '> 1.6', required: false)
+totem_plparser = dependency('totem-plparser', required: false)
+upower = dependency('libupower-glib', version: '> 0.9.0', required: false)
+zlib = dependency('zlib')
+
+libgif = cc.find_library('libgif', required: false)
+libjpeg = cc.find_library('libjpeg', required: false)
+libmath = cc.find_library('m')
+
+# FIXME: here we work around a quirk todo with Meson and Vala: the 'uuid'
+# pkg-config component corresponds to 'libuuid.vapi', but Meson assumes that
+# .vapi name always matches pkg-config name, and will add `--pkg uuid` to the
+# Vala commandline. By finding 'uuid' using find_library() instead, we get
+# a dependency object back that won't cause any `--pkg` arguments to be added
+# to the Vala commandline, but still works as expected for C code.
+uuid = cc.find_library('uuid')
+
+# There are various gchar vs. unsigned char warnings that occur in extract
+# modules, it's not worth adding casts everywhere so we disable the warning.
+add_project_arguments('-Wno-pointer-sign', language: 'c')
+
+enable_fts = get_option('fts')
+enable_extract = get_option('extract')
+enable_writeback = get_option('writeback')
+
+##################################################################
+# Check for libtracker-common, make sure libstemmer exists
+##################################################################
+
+have_libstemmer = false
+if get_option('stemmer') != 'no'
+    stemmer = cc.find_library('stemmer')
+    if stemmer.found()
+        have_libstemmer = true
+    elif get_option('stemmer') == 'yes'
+        error('stemmer support explicitly requested, but stemmer library couldn\'t be found')
+    endif
+endif
+
+##################################################################
+# Check for tracker-fts, allow disabling FTS support
+##################################################################
+
+if enable_fts
+  sqlite3_builtin_fts5_test = '''
+    #include <sqlite3.h>
+    sqlite3 *db;
+    int rc;
+    rc = sqlite3_open(":memory:", &db);
+    if (rc!=SQLITE_OK) return -1;
+    rc = sqlite3_exec(db, "create table a(text)", 0, 0, 0);
+    if (rc!=SQLITE_OK) return -1;
+    rc = sqlite3_exec(db, "create virtual table t using fts5(content='a',text)", 0, 0, 0);
+    if (rc!=SQLITE_OK) return -1;
+  '''
+
+  sqlite3_has_builtin_fts5 = cc.compiles(sqlite3_builtin_fts5_test,
+    name: 'sqlite3 has builtin FTS5 module')
+endif
+
+##################################################################
+# Check for libtracker-common: battery/mains power detection
+#
+# By default, AUTO with this order of preference:
+#  1)  upower
+#  2)  hal
+##################################################################
+
+have_hal = false
+battery_detection_library_name = ''
+
+if upower.found()
+  if get_option('battery_detection') == 'auto' or get_option('battery_detection') == 'upower'
+    battery_detection_library = upower
+    battery_detection_library_name = 'upower'
+  endif
+elif get_option('battery_detection') == 'upower'
+  error('upower explicitly requested, but upower library was not found')
+endif
+
+if battery_detection_library_name == ''
+  hal = dependency('hal', version: '> 0.5', required: false)
+
+  if hal.found()
+    battery_detection_library = hal
+    battery_detection_library_name = 'hal'
+  elif get_option('battery_detection') == 'hal'
+    error('HAL explicitly requested, but not found')
+  else
+    battery_detection_library_name = '(none)'
+  endif
+endif
+
+##################################################################
+# Check for libtracker-data and libtracker-fts: Unicode support
+#
+# By default, AUTO with this order of preference:
+#  1)  libunistring
+#  2)  libicu
+##################################################################
+
+have_libicu = false
+unicode_library_name = ''
+
+if icu_i18n.found() and icu_uc.found()
+  have_libicu = true
+endif
+
+if have_libicu
+  if get_option('unicode_support') == 'auto' or get_option('unicode_support') == 'icu'
+    unicode_library = declare_dependency(
+        dependencies: [icu_uc, icu_i18n]
+    )
+    unicode_library_name = 'icu'
+  endif
+elif get_option('unicode_support') == 'icu'
+  error('libicu explicitly requested, but icu-i18n and icu-uc libraries were not found')
+endif
+
+if unicode_library_name == ''
+  libunistring = cc.find_library('libunistring', required: false)
+
+  if libunistring.found()
+    unicode_library = libunistring
+    unicode_library_name = 'unistring'
+  elif get_option('unicode_support') == 'unistring'
+    error('libunistring explicitly requested, but not found')
+  else
+    error('Neither libicu or libunistring were found for Unicode support.')
+  endif
+endif
+
+####################################################################
+# Check for tracker-miner-fs: meegotouch, for MeeGo desktop files
+####################################################################
+
+have_meegotouch = false
+if get_option('meegotouch') != 'no'
+  meegotouch = dependency('meegotouch', version: '>= 0.20', required: false)
+
+  if meegotouch.found()
+    have_meegotouch = true
+  elif get_option('meegotouch') == 'yes'
+    error('meegotouch support explicitly requested, but meegotouch library couldn\'t be found')
+  endif
+endif
+
+####################################################################
+# Check for tracker-miner-evolution
+####################################################################
+
+if camel.found() and eds.found() and evo_plugin.found() and evo_shell.found() and libemail_utils.found() and 
libemail_engine.found()
+  have_tracker_miner_evolution = true
+  tracker_miner_evolution_install_dir = evo_plugin.get_variable('plugindir')
+else
+  have_tracker_miner_evolution = false
+  tracker_miner_evolution_install_dir = ''
+endif
+
+####################################################################
+# Check for tracker-miner-thunderbird
+####################################################################
+
+thunderbird = find_program('thunderbird', required: false)
+if thunderbird.found()
+  thunderbird_version = run_command(thunderbird, '--version').stdout().strip().split()[1]
+
+  message('Found Mozilla Thunderbird email client version ' + thunderbird_version)
+
+  have_tracker_miner_thunderbird = true
+  tracker_miner_thunderbird_install_dir = join_paths(get_option('prefix'), 'lib', 'thunderbird-' + 
thunderbird_version, 'extensions')
+else
+  have_tracker_miner_thunderbird = false
+  tracker_miner_thunderbird_install_dir = ''
+endif
+
+####################################################################
+# Check for tracker-miner-firefox
+####################################################################
+
+firefox = find_program('firefox', required: false)
+if firefox.found()
+  firefox_version = run_command(firefox, '--version').stdout().strip().split()[2]
+
+  message('Found Mozilla Firefox web browser version ' + firefox_version)
+
+  have_tracker_miner_firefox = true
+  tracker_miner_firefox_install_dir = join_paths(get_option('prefix'), 'lib', 'firefox-' + firefox_version, 
'extensions')
+else
+  have_tracker_miner_firefox = false
+  tracker_miner_firefox_install_dir = ''
+endif
+
+####################################################################
+# Check for nautilus extension
+####################################################################
+
+if nautilus_extension.found()
+  nautilus_extension = dependency('libnautilus-extension', required: true)
+  tracker_nautilus_extension_install_dir = nautilus_extension.get_pkgconfig_variable('extensiondir')
+else
+  tracker_nautilus_extension_install_dir = ''
+endif
+
+####################################################################
+# This section is for tracker-extract dependencies
+####################################################################
+
+##########################################################################
+# Check for tracker-extract: icu or enca for detecting Cyrillic in MP3s
+#
+# By default, AUTO with this order of preference:
+#  1)  icu
+#  2)  enca
+##########################################################################
+
+charset_library_name = 'none'
+
+if have_libicu
+  if get_option('charset_detection') == 'auto' or get_option('charset_detection') == 'icu'
+    charset_library = declare_dependency(
+       dependencies: [icu_uc, icu_i18n]
+    )
+    charset_library_name = 'icu'
+  endif
+else
+  if get_option('charset_detection') == 'icu'
+    error('libicu requested for character set detection, but it was not found')
+  endif
+endif
+
+if charset_library_name == 'none' and get_option('charset_library') != 'none'
+  enca = dependency('enca', version: '>= 1.9', required: false)
+
+  if enca.found()
+    charset_library = enca
+    charset_library_name = 'enca'
+  elif get_option('enca') == 'yes'
+    error('enca support explicitly requested, but enca couldn\'t be found')
+  endif
+endif
+
+####################################################################
+# Check for tracker-extract: gstreamer/etc
+####################################################################
+
+generic_media_handler = []
+generic_media_handler_name = 'none'
+
+if get_option('generic_media_extractor') == 'auto'
+  if gstreamer.found() and gstreamer_tag.found()
+    generic_media_handler = [gstreamer, gstreamer_tag]
+    generic_media_handler_name = 'gstreamer'
+  elif avcodec.found() and avformat.found() and avutil.found()
+    generic_media_handler = [avcodec, avformat, avutil]
+    generic_media_handler_name = 'libav'
+  else
+    generic_media_handler_name = 'none'
+    generic_media_handler = []
+  endif
+elif get_option('generic_media_extractor') == 'gstreamer'
+  if gstreamer.found() and gstreamer_tag.found()
+    generic_media_handler = [gstreamer, gstreamer_tag]
+    generic_media_handler_name = 'gstreamer'
+  else
+    error('GStreamer media handler was enabled but required GStreamer libraries were not found')
+  endif
+elif get_option('generic_media_extractor') == 'libav'
+  if avcodec.found() and avformat.found() and avutil.found()
+    generic_media_handler = [avcodec, avformat, avutil]
+    generic_media_handler_name = 'libav'
+  else
+    error('libav media handler was enabled but required libav libraries were not found')
+  endif
+endif
+
+###########################################################################
+# Check for gstreamer backend: tagreadbin/decodebin2/discoverer/gupnp-dlna
+###########################################################################
+
+gstreamer_backend_name = ''
+
+if generic_media_handler_name == 'gstreamer'
+  if get_option('gstreamer_backend') == 'discoverer'
+    if gstreamer_pbutils.found()
+      gstreamer_backend_name = 'Discoverer'
+    else
+      error('GStreamer Discoverer backend requires GStreamer pbutils library')
+    endif
+  elif get_option('gstreamer_backend') == 'gupnp'
+    if gupnp_dlna.found() and gupnp_dlna_gst.found()
+      gstreamer_backend_name = 'GUPnP-DNLA'
+    else
+      error('GStreamer GUPnP-DNLA backend requires the gupNp and gupnp-gst libraries')
+    endif
+  endif
+endif
+
+####################################################################
+# D-Bus service files
+####################################################################
+
+if get_option('dbus_services') == ''
+    dbus_services_dir = dbus.get_pkgconfig_variable('session_bus_services_dir')
+else
+    dbus_services_dir = get_option('dbus_services')
+endif
+
+####################################################################
+# systemd user services
+####################################################################
+
+install_systemd_user_services = false
+if get_option('systemd_user_services') == 'yes' or get_option('systemd_user_services') == 'auto'
+    systemd = dependency('systemd', required: false)
+    if systemd.found()
+        systemd_user_services_dir = systemd.get_pkgconfig_variable('systemduserunitdir')
+    else
+        systemd_user_services_dir = join_paths(get_option('libdir'), 'systemd', 'user')
+    endif
+    install_systemd_user_services = true
+elif get_option('systemd_user_services') == 'no' or get_option('systemd_user_services') == ''
+    install_systemd_user_services = false
+    systemd_user_services_dir = '(disabled)'
+else
+    install_systemd_user_services = true
+    systemd_user_services_dir = get_option('systemd_user_services')
+endif
+
+####################################################################
+# bash-completion
+####################################################################
+
+install_bash_completion = false
+if get_option('bash_completion') == 'yes' or get_option('bash_completion') == 'auto'
+    bash_completion_package = dependency('bash-completion', required: false)
+    if bash_completion_package.found()
+        bash_completion_dir = bash_completion_package.get_variable('completionsdir')
+    else
+        bash_completion_dir = join_paths(get_option('prefix'), get_option('datadir'), 'bash-completion', 
'completions')
+    endif
+    install_bash_completion = true
+elif get_option('bash_completion') == 'no' or get_option('bash_completion') == ''
+    install_bash_completion = false
+    bash_completion_dir = '(disabled)'
+else
+    install_bash_completion = true
+    bash_completion_dir = get_option('bash_completion')
+endif
+
+tracker_major_version = meson.project_version().split('.')[0].to_int()
+tracker_minor_version = meson.project_version().split('.')[1].to_int()
+tracker_micro_version = meson.project_version().split('.')[2].to_int()
+
+conf = configuration_data()
+
+# Config that goes in config.h
+conf.set('DISABLE_JOURNAL', get_option('journal') == false)
+conf.set('USING_UNZIPPSFILES', get_option('unzip_ps_gz_files') == false)
+
+conf.set('HAVE_TRACKER_EXTRACT', enable_extract)
+conf.set10('HAVE_TRACKER_FTS', enable_fts)
+conf.set('HAVE_TRACKER_WRITEBACK', enable_writeback)
+
+conf.set('HAVE_BUILTIN_FTS', sqlite3_has_builtin_fts5)
+conf.set('HAVE_ENCA', charset_library_name == 'enca')
+conf.set('HAVE_EXEMPI', exempi.found())
+conf.set('HAVE_GSTREAMER', generic_media_handler_name == 'gstreamer')
+conf.set('GSTREAMER_BACKEND_DISCOVERER', gstreamer_backend_name == 'Discoverer')
+conf.set('GSTREAMER_BACKEND_GUPNP_DLNA', gstreamer_backend_name == 'GUPnP-DNLA')
+conf.set('HAVE_HAL', battery_detection_library_name == 'hal')
+conf.set('HAVE_LIBCUE', libcue.found())
+conf.set('HAVE_LIBCUE2', libcue.version() >= '2.0.0')
+conf.set10('HAVE_LIBICU', unicode_library_name == 'icu')
+conf.set('HAVE_LIBICU_CHARSET_DETECTION', charset_library_name == 'icu')
+conf.set('HAVE_LIBEXIF', libexif.found())
+conf.set('HAVE_LIBIPTCDATA', libiptcdata.found())
+conf.set('HAVE_LIBMEDIAART', libmediaart.found())
+conf.set('HAVE_LIBSTEMMER', have_libstemmer)
+conf.set('HAVE_LIBUNISTRING', unicode_library_name == 'unistring')
+conf.set('HAVE_MEEGOTOUCH', have_meegotouch)
+conf.set('HAVE_NETWORK_MANAGER', network_manager.found())
+conf.set('HAVE_UPOWER', battery_detection_library_name == 'upower')
+
+conf.set('HAVE_GETLINE', cc.has_function('getline', prefix : '#include <stdio.h>'))
+conf.set('HAVE_POSIX_FADVISE', cc.has_function('posix_fadvise', prefix : '#include <fcntl.h>'))
+conf.set('HAVE_STATVFS64', cc.has_header_symbol('sys/statvfs.h', 'statvfs64', args: '-D_LARGEFILE64_SOURCE'))
+conf.set('HAVE_STRNLEN', cc.has_function('strnlen', prefix : '#include <string.h>'))
+
+conf.set('LOCALEDIR', '"@0@/@1@"'.format(get_option('prefix'), get_option('localedir')))
+conf.set('SHAREDIR', '"@0@/@1@"'.format(get_option('prefix'), get_option('datadir')))
+conf.set('TRACKER_MINERS_DIR', '"@0@/@1@/tracker/miners"'.format(get_option('prefix'), 
get_option('datadir')))
+conf.set('TRACKER_UI_DIR', '"@0@/@1@/tracker/"'.format(get_option('prefix'), get_option('datadir')))
+
+conf.set('GETTEXT_PACKAGE', '"tracker"')
+conf.set('PACKAGE_VERSION', '"@0@"'.format(meson.project_version()))
+conf.set('TRACKER_VERSION', '"@0@"'.format(meson.project_version()))
+conf.set('TRACKER_MAJOR_VERSION', tracker_major_version)
+conf.set('TRACKER_MINOR_VERSION', tracker_minor_version)
+conf.set('TRACKER_MICRO_VERSION', tracker_micro_version)
+conf.set('TRACKER_INTERFACE_AGE', 0)
+conf.set('TRACKER_BINARY_AGE', 100 * tracker_minor_version + tracker_micro_version)
+
+# Config that goes in some other generated files (.desktop, .pc, etc)
+conf.set('exec_prefix', get_option('prefix'))
+conf.set('includedir', join_paths(get_option('prefix'), get_option('includedir')))
+conf.set('libdir', join_paths(get_option('prefix'), get_option('libdir')))
+conf.set('libexecdir', join_paths(get_option('prefix'), get_option('libexecdir')))
+conf.set('prefix', get_option('prefix'))
+conf.set('TRACKER_API_VERSION', '1.0')
+conf.set('VERSION', meson.project_version())
+
+configure_file(input: 'config.h.meson.in',
+               output: 'config.h',
+               configuration: conf)
+
+# Needed for O_NOATIME, and probably other stuff.
+add_global_arguments('-D_GNU_SOURCE', language: 'c')
+# Needed for statvfs64, and probably other stuff
+add_global_arguments('-D_LARGEFILE64_SOURCE', language: 'c')
+
+have_tracker_miner_fs = true
+have_tracker_miner_apps = true
+have_tracker_miner_user_guides = true
+have_tracker_miner_rss = true
+have_tracker_miner_firefox = true
+have_tracker_extract = true
+have_tracker_writeback = true
+have_tracker_needle = true
+have_tracker_preferences = true
+
+configinc = include_directories('./')
+srcinc = include_directories('src/')
+
+tracker_extract_modules_dir = join_paths(get_option('prefix'), get_option('libdir'), 
'tracker-@1@/extract-modules'.format(tracker_api_version))
+# NOTE: We don't use ${TRACKER_API_VERSION} because other content like
+# the ontology is installed to the same location.
+tracker_extract_rules_dir = join_paths(get_option('prefix'), get_option('datadir'), 'tracker/extract-rules')
+tracker_miner_services_dir = join_paths(get_option('prefix'), get_option('datadir'), 'tracker/miners')
+
+subdir('src')
+
+if get_option('docs')
+  subdir('docs')
+endif
+
+subdir('examples')
+subdir('utils')
+
+subdir('tests')
+
+subdir('po')
+
+# Make sure we're not using versions of SQLite which cause problems.
+#
+# Avoid versions:
+sqlite_safe = true
+if sqlite.version().version_compare('>= 3.7.10') and sqlite.version().version_compare('<= 3.7.13')
+  # See https://mail.gnome.org/archives/tracker-list/2012-October/msg00028.html
+  sqlite_safe = false
+elif sqlite.version().version_compare('3.8.1')
+  # See https://mail.gnome.org/archives/tracker-list/2013-November/msg00021.html
+  sqlite_safe = false
+elif sqlite.version().version_compare('3.8.4.2')
+  # See https://mail.gnome.org/archives/tracker-list/2014-April/msg00001.html
+  sqlite_safe = false
+endif
+
+summary = [
+    '\nBuild Configuration:',
+    '    Prefix:                                 ' + get_option('prefix'),
+    '    Source code location:                   ' + meson.source_root(),
+    '    Compiler:                               ' + cc.get_id(),
+    '\nFeature Support:',
+    '    Battery/mains power detection:          ' + battery_detection_library_name,
+    '    Support for network status detection:   ' + network_manager.found().to_string(),
+    '    Unicode support library:                ' + unicode_library_name,
+    '    Build with Journal support:             ' + get_option('journal').to_string(),
+    '    Build with SQLite FTS support:          @0@ (built-in FTS: @1@)'.format(
+       get_option('fts'), sqlite3_has_builtin_fts5),
+    '    Build with Stemming support:            ' + have_libstemmer.to_string(),
+    '    Cache media art                         ' + libmediaart.found().to_string(),
+    '    Bash completion support:                ' + bash_completion_dir,
+    '\nData Miners / Writebacks:',
+    '    FS (File System):                       @0@ (MeeGo support: @1@)'.format(
+        have_tracker_miner_fs, have_meegotouch),
+    '    Applications:                           ' + have_tracker_miner_apps.to_string(),
+    '    RSS:                                    ' + have_tracker_miner_rss.to_string(),
+    '    User Guides:                            ' + have_tracker_miner_user_guides.to_string(),
+    '    Email:',
+    '        Evolution:                        @0@ (@1@)'.format(
+        have_tracker_miner_evolution, tracker_miner_evolution_install_dir),
+    '        Thunderbird:                      @0@ (@1@)'.format(
+        have_tracker_miner_thunderbird, tracker_miner_thunderbird_install_dir),
+    '   Bookmarks:',
+    '        FireFox:                          @0@ (@1@)'.format(
+        have_tracker_miner_firefox, tracker_miner_firefox_install_dir),
+    '',
+    '   Extract (secondary extraction):     ' + have_tracker_extract.to_string(),
+    '   Writeback (writing changes back):   ' + have_tracker_writeback.to_string(),
+]
+
+
+if have_tracker_extract
+  summary += [
+    '\nMetadata Extractors:',
+    '    Support PNG:                            ' + libpng.found().to_string(),
+    '    Support PDF:                            ' + poppler.found().to_string(),
+    '    Support XPS:                            ' + libgxps.found().to_string(),
+    '    Support GIF:                            @0@ (xmp: @1@)'.format(libgif.found().to_string(), 
exempi.found().to_string()),
+    '    Support JPEG:                           @0@ (xmp: @1@, exif: @2@, iptc: @3@)'.format(
+        libjpeg.found().to_string(), exempi.found().to_string(), libexif.found().to_string(), 
libiptcdata.found().to_string()),
+    '    Support TIFF:                           @0@ (xmp: @1@, exif: @2@, iptc: @3@)'.format(
+        libtiff.found().to_string(), exempi.found().to_string(), libexif.found().to_string(), 
libiptcdata.found().to_string()),
+    '    Support Vorbis (ogg/etc):               ' + libvorbis.found().to_string(),
+    '    Support Flac:                           ' + flac.found().to_string(),
+    '    Support MS & Open Office:               ' + libgsf.found().to_string(),
+    '    Support XML / HTML:                     ' + libxml2.found().to_string(),
+    '    Support embedded / sidecar XMP:         ' + exempi.found().to_string(),
+    '    Support generic media formats:          @0@ (backend: @1@)'.format(
+        generic_media_handler_name, gstreamer_backend_name),
+    '    Support cue sheet parsing:              ' + libcue.found().to_string(),
+    '    Support playlists (w/ Totem):           ' + totem_plparser.found().to_string(),
+    '    Support ISO image parsing:              ' + libosinfo.found().to_string(),
+    '    Support AbiWord document parsing:       true',
+    '    Support DVI parsing:                    true',
+    '    Support MP3 parsing:                    true',
+    '    Support MP3 tag charset detection:      ' + charset_library_name,
+    '    Support PS parsing:                     true',
+    '    Support text parsing:                   true',
+    '    Support icon parsing:                   true'
+  ]
+endif
+
+
+if have_tracker_writeback
+  summary += [
+    '\nWriteback Formats:',
+    '    Audio files using Taglib:               ' + taglib.found().to_string(),
+    '    XMP:                                    ' + exempi.found().to_string(),
+  ]
+endif
+
+summary += [
+    '\nApplications:',
+    '    Build tracker-preferences:              ' + have_tracker_preferences.to_string(),
+    '    Build tracker-needle:                   ' + have_tracker_needle.to_string(),
+    '\nFrameworks / Options:',
+    '    Support Nautilus file manager           @0@ (@1@)'.format(
+        nautilus_extension.found().to_string(), tracker_nautilus_extension_install_dir),
+    '    Support Maemo                           false',
+    '    Support libmeegotouch                   ' + meegotouch.found().to_string(),
+    '    Support Guaranteed Metadata             ' + get_option('guarantee_metadata').to_string(),
+]
+
+message('\n'.join(summary))
+
+if not sqlite_safe
+  message('''WARNING:
+        SQLite3 version @0@ is not safe. For detail
+        3.7.10 - 3.7.13: https://mail.gnome.org/archives/tracker-list/2012-October/msg00028.html
+        3.8.1:           https://mail.gnome.org/archives/tracker-list/2013-November/msg00021.html
+        3.8.4.2:         https://mail.gnome.org/archives/tracker-list/2014-April/msg00001.html
+  ''').format(sqlite.version())
+endif
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..943b48a
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,51 @@
+option('docs', type: 'boolean', value: true,
+       description: 'Enable the documentation')
+option('extract', type: 'boolean', value: true,
+       description: 'Enable the Tracker metadata extractor')
+option('fts', type: 'boolean', value: true,
+       description: 'Enable the Tracker full-text search feature')
+option('functional_tests', type: 'boolean', value: true,
+       description: 'Enable the Tracker functional test suite')
+option('guarantee_metadata', type: 'boolean', value: true,
+       description: 'Set nie:title and nie:contentCreated from filename and mtime if no metadata available')
+option('journal', type: 'boolean', value: true,
+       description: 'Enable database journal backup mechanism')
+option('writeback', type: 'boolean', value: true,
+       description: 'Enable Tracker writeback feature')
+
+option('abiword', type: 'boolean', value: 'true',
+       description: 'Enable extractor for AbiWord files')
+option('dvi', type: 'boolean', value: 'true',
+       description: 'Enable extractor for DVI metadata')
+option('icon', type: 'boolean', value: 'true',
+       description: 'Enable extractor for ICO metadata')
+option('mp3', type: 'boolean', value: 'true',
+       description: 'Enable extractor for MP3 metadata')
+option('ps', type: 'boolean', value: 'true',
+       description: 'Enable extractor for PS metadata')
+option('text', type: 'boolean', value: 'true',
+       description: 'Enable extractor for TXT metadata')
+option('unzip_ps_gz_files', type: 'boolean', value: 'true',
+       description: 'Enable extractor for PS.GZ metadata')
+
+option('battery_detection', type: 'combo', choices: ['auto', 'hal', 'upower', 'none'], value: 'auto',
+       description: 'Enable upower or HAL for battery/mains power detection')
+option('charset_detection', type: 'combo', choices: ['auto', 'enca', 'icu', 'none'], value: 'auto',
+       description: 'Enable enca or libicu for charset detection in MP3s')
+option('generic_media_extractor', type: 'combo', choices: ['auto', 'gstreamer', 'libav', 'none'], value: 
'auto',
+       description: 'Enables one of the (gstreamer, libav, auto) generic media extractor backends')
+option('gstreamer_backend', type: 'combo', choices: ['discoverer', 'gupnp'], value: 'discoverer',
+       description: 'When GStreamer is used, this enables one of the (discoverer, gupnp) GStreamer backends')
+option('meegotouch', type: 'combo', choices: ['auto', 'no', 'yes'], value: 'no',
+       description: 'Enable libmeegotouch application extraction')
+option('stemmer', type: 'combo', choices: ['auto', 'no', 'yes'], value: 'no',
+       description: 'Enable stemming words while indexing')
+option('unicode_support', type: 'combo', choices: ['icu', 'unistring', 'auto'], value: 'auto',
+       description: 'Unicode support library to use')
+
+option('bash_completion', type: 'string', default: 'yes',
+       description: 'Directory to install Bash completion files (or "yes" for default directory, "no" to 
disable installation')
+option('dbus_services', type: 'string', default: '',
+       description: 'Directory to install D-Bus .service files (leave blank to use the value from 
dbus-1.pc)')
+option('systemd_user_services', type: 'string', default: 'yes',
+       description: 'Directory to install systemd user .service files (or "yes" for default directory, "no" 
to disable installation)')
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..adb5176
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,6 @@
+i18n.gettext('tracker', languages:
+    ['ar', 'as', 'be@latin', 'bg', 'bs', 'ca', 'ca@valencia', 'cs', 'da', 'de',
+     'dz', 'el', 'en_GB', 'eo', 'es', 'et', 'eu', 'fi', 'fr', 'gl', 'he', 'hu',
+     'id', 'it', 'ja', 'ko', 'lt', 'lv', 'mk', 'ml', 'nb', 'nds', 'nl', 'oc',
+     'pa', 'pl', 'pt', 'pt_BR', 'ro', 'ru', 'sk', 'sl', 'sr', 'sr@latin', 'sv',
+     'te', 'tg', 'th', 'tr', 'uk', 'zh_CN', 'zh_HK', 'zh_TW'])
diff --git a/src/create-miner-symlinks.sh b/src/create-miner-symlinks.sh
new file mode 100644
index 0000000..7233a02
--- /dev/null
+++ b/src/create-miner-symlinks.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+# Post-install script for install stuff that Meson doesn't support directly.
+#
+# We can't pass the necessary variables directly to the script, so we
+# substitute them using configure_file(). It's a bit of a Heath Robinson hack.
+
+set -e
+
+dbus_services_dir="$1"
+tracker_miner_services_dir="$2"
+
+mkdir -p ${DESTDIR}/${tracker_miner_services_dir}
+ln -sf "${dbus_services_dir}/tracker-extract.service" 
"${DESTDIR}/${tracker_miner_services_dir}/tracker-extract.service"
diff --git a/src/gvdb/meson.build b/src/gvdb/meson.build
new file mode 100644
index 0000000..82177dd
--- /dev/null
+++ b/src/gvdb/meson.build
@@ -0,0 +1,14 @@
+gvdb_dependencies = [glib]
+
+libgvdb = static_library('gvdb',
+    'gvdb-builder.c',
+    'gvdb-reader.c',
+    dependencies: gvdb_dependencies,
+    pic: true,
+)
+
+gvdb_dep = declare_dependency(
+    link_with: libgvdb,
+    dependencies: gvdb_dependencies,
+    include_directories: include_directories('..'),
+)
diff --git a/src/install-generated-header.sh b/src/install-generated-header.sh
new file mode 100644
index 0000000..b505b90
--- /dev/null
+++ b/src/install-generated-header.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+# Script to install generated .h files. This only exists to workaround
+# a Meson bug: https://github.com/mesonbuild/meson/issues/705
+
+set -e
+
+HEADER="$1"
+TARGET_DIR="$2"
+
+cp $1 "$DESTDIR$2"
diff --git a/src/libtracker-bus/meson.build b/src/libtracker-bus/meson.build
new file mode 100644
index 0000000..695611a
--- /dev/null
+++ b/src/libtracker-bus/meson.build
@@ -0,0 +1,28 @@
+libtracker_bus = static_library('tracker-bus',
+    'tracker-bus.vala',
+    'tracker-namespace.vala',
+    'tracker-array-cursor.vala',
+    'tracker-bus-fd-cursor.vala',
+    '../libtracker-common/libtracker-common.vapi',
+    c_args: [
+        '-DTRACKER_COMPILATION',
+    ],
+    vala_args: [
+        '--debug',
+        '--pkg', 'posix',
+        # FIXME: Meson has code to add --target-glib automatically, but it
+        # doesn't seem to work here.
+        '--target-glib', glib_required,
+    ],
+    # This doesn't depend on tracker_common_dep because of
+    # https://github.com/mesonbuild/meson/issues/671
+    dependencies: [glib, gio, gio_unix, tracker_sparql_intermediate_dep],
+    include_directories: [commoninc, configinc, srcinc],
+    link_with: libtracker_common,
+    sources: tracker_common_enum_header,
+)
+
+tracker_sparql_bus_dep = declare_dependency(
+    link_with: libtracker_bus,
+    include_directories: include_directories('.')
+)
diff --git a/src/libtracker-common/meson.build b/src/libtracker-common/meson.build
new file mode 100644
index 0000000..3483a61
--- /dev/null
+++ b/src/libtracker-common/meson.build
@@ -0,0 +1,66 @@
+enums = gnome.mkenums('tracker-enum-types',
+    sources: 'tracker-enums.h',
+    c_template: 'tracker-enum-types.c.template',
+    h_template: 'tracker-enum-types.h.template',
+)
+
+tracker_common_enum_header = enums[1]
+
+parser_sha1_header = configure_file(
+    input: 'tracker-parser-sha1.h.in',
+    output: 'tracker-parser-sha1.h',
+    command: ['generate-tracker-parser-sha1-header.sh'])
+
+tracker_common_sources = [
+    'tracker-date-time.c',
+    'tracker-dbus.c',
+    'tracker-file-utils.c',
+    'tracker-ioprio.c',
+    'tracker-log.c',
+    'tracker-sched.c',
+    'tracker-type-utils.c',
+    'tracker-utils.c',
+    'tracker-locale.c',
+    'tracker-parser-utils.c',
+    'tracker-language.c',
+    'tracker-seccomp.c',
+    enums[0], enums[1],
+    parser_sha1_header,
+]
+
+if unicode_library_name == 'icu'
+    tracker_common_sources += 'tracker-parser-libicu.c'
+else
+    tracker_common_sources += 'tracker-parser-libunistring.c'
+endif
+
+# FIXME: need to link against -lkvm on OpenBSD, see configure.ac
+tracker_common_dependencies = [glib, gio, gio_unix, libmath]
+
+libtracker_common = library('tracker-common',
+    tracker_common_sources,
+    dependencies: tracker_common_dependencies + [unicode_library],
+    c_args: [
+        '-DTRACKER_COMPILATION',
+    ],
+    include_directories: [configinc, srcinc],
+    install_dir: get_option('libdir') + '/tracker-' + tracker_api_version,
+)
+
+commoninc = include_directories('.')
+
+# This dependency can't be used everywhere right now. The issue is that if
+# every other library depends on this one, we end up with a combinatorial
+# explosion that results in the link line for src/tracker/tracker being
+# nearly 200,000 characters long which causes this kind of error:
+#
+#     Linking target src/tracker/tracker
+#     ninja: fatal: posix_spawn: Argument list too long
+#
+# Upstream issue: https://github.com/mesonbuild/meson/issues/671
+tracker_common_dep = declare_dependency(
+    sources: enums[1],
+    link_with: libtracker_common,
+    dependencies: tracker_common_dependencies,
+    include_directories: [configinc, srcinc, commoninc],
+)
diff --git a/src/libtracker-control/meson.build b/src/libtracker-control/meson.build
new file mode 100644
index 0000000..3104e52
--- /dev/null
+++ b/src/libtracker-control/meson.build
@@ -0,0 +1,27 @@
+sources = ['tracker-miner-manager.c']
+
+libtracker_control = library('tracker-control', sources,
+    c_args: '-DTRACKER_COMPILATION',
+    install: true,
+    # This doesn't depend on tracker_common_dep because of
+    # https://github.com/mesonbuild/meson/issues/671
+    dependencies: [gio, tracker_miner_dep],
+    include_directories: [commoninc, configinc, srcinc],
+    link_with: libtracker_common,
+    sources: tracker_common_enum_header,
+)
+
+tracker_control_dep = declare_dependency(
+    link_with: libtracker_control,
+    dependencies: tracker_miner_dep
+)
+
+configure_file(
+    input: 'tracker-control.pc.in',
+    output: 'tracker-control-1.0.pc',
+    configuration: conf,
+    install: true,
+    install_dir: join_paths(get_option('prefix'), get_option('libdir'), 'pkgconfig'))
+
+install_headers ('tracker-control.h', 'tracker-miner-manager.h',
+    subdir: 'tracker-1.0/libtracker-control')
diff --git a/src/libtracker-data/meson.build b/src/libtracker-data/meson.build
new file mode 100644
index 0000000..ad0337d
--- /dev/null
+++ b/src/libtracker-data/meson.build
@@ -0,0 +1,71 @@
+# Vala parts of libtracker-data are split out separately, because we can't link
+# the Vala code to libicu. In the Makefile.am this library is called
+# libtracker-sparql-query.
+libtracker_data_vala = static_library('tracker-sparql-query',
+    'tracker-vala-namespace.vala',
+    'tracker-sparql-query.vala',
+    'tracker-sparql-expression.vala',
+    'tracker-sparql-pattern.vala',
+    'tracker-sparql-scanner.vala',
+    'tracker-turtle-reader.vala',
+    '../libtracker-common/libtracker-common.vapi',
+    '../libtracker-data/libtracker-data.vapi',
+    c_args: [
+        '-DTRACKER_COMPILATION',
+    ],
+    vala_args: [
+        '--debug',
+        '--pkg', 'posix',
+        # FIXME: Meson has code to add --target-glib automatically, but it
+        # doesn't seem to work here.
+        '--target-glib', glib_required,
+    ],
+    # This doesn't depend on tracker_common_dep because of
+    # https://github.com/mesonbuild/meson/issues/671
+    dependencies: [glib, gio, tracker_sparql_intermediate_dep],
+    include_directories: [commoninc, configinc, srcinc],
+    sources: tracker_common_enum_header,
+)
+
+tracker_data_dependencies = [
+    tracker_sparql_intermediate_dep, gvdb_dep, sqlite, uuid,
+]
+
+if get_option('fts')
+    tracker_data_dependencies += tracker_fts_dep
+endif
+
+ #[gio_unix, glib, libmath, sqlite, uuid]
+libtracker_data = library('tracker-data',
+    'tracker-class.c',
+    'tracker-collation.c',
+    'tracker-crc32.c',
+    'tracker-data-backup.c',
+    'tracker-data-manager.c',
+    'tracker-data-query.c',
+    'tracker-data-update.c',
+    'tracker-db-config.c',
+    'tracker-db-interface.c',
+    'tracker-db-interface-sqlite.c',
+    'tracker-db-manager.c',
+    'tracker-db-journal.c',
+    'tracker-db-backup.c',
+    'tracker-namespace.c',
+    'tracker-ontology.c',
+    'tracker-ontologies.c',
+    'tracker-property.c',
+    c_args: [
+        '-DTRACKER_COMPILATION',
+    ],
+    # This doesn't depend on tracker_common_dep because of
+    # https://github.com/mesonbuild/meson/issues/671
+    link_with: [libtracker_data_vala],
+    dependencies: tracker_data_dependencies + [unicode_library],
+    include_directories: [commoninc, configinc, srcinc],
+)
+
+tracker_data_dep = declare_dependency(
+    link_with: [libtracker_data, libtracker_data_vala],
+    dependencies: tracker_data_dependencies,
+    include_directories: include_directories('.')
+)
diff --git a/src/libtracker-direct/meson.build b/src/libtracker-direct/meson.build
new file mode 100644
index 0000000..50c9f3c
--- /dev/null
+++ b/src/libtracker-direct/meson.build
@@ -0,0 +1,25 @@
+libtracker_direct = static_library('tracker-direct',
+    'tracker-direct.vala',
+    'tracker-namespace.vala',
+    '../libtracker-common/libtracker-common.vapi',
+    '../libtracker-data/libtracker-data.vapi',
+    c_args: [
+        '-DTRACKER_COMPILATION',
+    ],
+    vala_args: [
+        '--debug',
+        '--pkg', 'posix',
+        # FIXME: Meson has code to add --target-glib automatically, but it
+        # doesn't seem to work here.
+        '--target-glib', glib_required,
+    ],
+    # This doesn't depend on tracker_common_dep because of
+    # https://github.com/mesonbuild/meson/issues/671
+    dependencies: [ glib, gio, tracker_data_dep ],
+    include_directories: [commoninc, configinc, srcinc],
+)
+
+tracker_sparql_direct_dep = declare_dependency(
+    link_with: libtracker_direct,
+    include_directories: include_directories('.')
+)
diff --git a/src/libtracker-extract/meson.build b/src/libtracker-extract/meson.build
new file mode 100644
index 0000000..1e18aa1
--- /dev/null
+++ b/src/libtracker-extract/meson.build
@@ -0,0 +1,50 @@
+libtracker_extract_sources = [
+  'tracker-encoding.c',
+  'tracker-exif.c',
+  'tracker-extract-info.c',
+  'tracker-guarantee.c',
+  'tracker-iptc.c',
+  'tracker-module-manager.c',
+  'tracker-resource-helpers.c',
+  'tracker-utils.c',
+  'tracker-xmp.c',
+]
+
+if charset_library_name == 'enca'
+  libtracker_extract_sources += 'tracker-encoding-enca.c'
+elif charset_library_name == 'icu'
+  libtracker_extract_sources += 'tracker-encoding-libicu.c'
+endif
+
+if have_meegotouch
+ libtracker_extract_sources += 'tracker-encoding-meegotouch.cpp'
+endif
+
+tracker_extract_dependencies = [charset_library, gmodule]
+
+if exempi.found()
+  tracker_extract_dependencies += exempi
+endif
+
+if libexif.found()
+  tracker_extract_dependencies += libexif
+endif
+
+if libiptcdata.found()
+  tracker_extract_dependencies += libiptcdata
+endif
+
+libtracker_extract = library('tracker-extract',
+  libtracker_extract_sources,
+  dependencies: [tracker_common_dep, tracker_sparql_dep] + tracker_extract_dependencies,
+  c_args: [
+    '-DTRACKER_COMPILATION',
+    '-DTRACKER_EXTRACTOR_RULES_DIR="@0@"'.format(tracker_extract_rules_dir),
+    '-DTRACKER_EXTRACTORS_DIR="@0@"'.format(tracker_extract_modules_dir)
+  ],
+)
+
+tracker_extract_dep = declare_dependency(
+  link_with: libtracker_extract,
+  dependencies: [tracker_sparql_dep] + tracker_extract_dependencies,
+  include_directories: srcinc)
diff --git a/src/libtracker-fts/meson.build b/src/libtracker-fts/meson.build
new file mode 100644
index 0000000..d08bc5d
--- /dev/null
+++ b/src/libtracker-fts/meson.build
@@ -0,0 +1,23 @@
+if sqlite3_has_builtin_fts5
+    libtracker_fts_fts5 = []
+else
+    libtracker_fts_fts5 = files('fts5.c')
+endif
+
+libtracker_fts_dependencies = [sqlite]
+
+libtracker_fts = static_library('libtracker-fts',
+    'tracker-fts.c',
+    'tracker-fts-config.c',
+    'tracker-fts-tokenizer.c',
+    libtracker_fts_fts5,
+    dependencies: tracker_common_dep,
+    c_args: [
+        '-DTRACKER_COMPILATION',
+    ],
+)
+
+tracker_fts_dep = declare_dependency(
+    link_with: libtracker_fts,
+    dependencies: libtracker_fts_dependencies
+)
diff --git a/src/libtracker-miner/meson.build b/src/libtracker-miner/meson.build
new file mode 100644
index 0000000..40e3903
--- /dev/null
+++ b/src/libtracker-miner/meson.build
@@ -0,0 +1,96 @@
+shared_libtracker_miner_monitor_sources = files('tracker-monitor.c')
+shared_libtracker_miner_file_system_sources = files('tracker-file-system.c')
+shared_libtracker_miner_crawler_sources = files('tracker-crawler.c')
+
+miner_enums = gnome.mkenums('tracker-miner-enum-types',
+    sources: 'tracker-miner-enums.h',
+    c_template: 'tracker-miner-enum-types.c.template',
+    h_template: 'tracker-miner-enum-types.h.template',
+)
+
+private_sources = [
+    'tracker-crawler.c',
+    'tracker-file-data-provider.c',
+    'tracker-file-enumerator.c',
+    'tracker-file-notifier.c',
+    'tracker-file-system.c',
+    'tracker-priority-queue.c',
+    'tracker-task-pool.c',
+    'tracker-sparql-buffer.c',
+    'tracker-thumbnailer.c',
+    'tracker-utils.c']
+
+if libmediaart.found()
+    private_sources.append(['tracker-media-art.c'])
+endif
+
+miner_sources = [
+    shared_libtracker_miner_monitor_sources,
+    shared_libtracker_miner_file_system_sources,
+    shared_libtracker_miner_crawler_sources,
+    'tracker-data-provider.c',
+    'tracker-decorator.c',
+    'tracker-decorator-fs.c',
+    'tracker-enumerator.c',
+    'tracker-indexing-tree.c',
+    'tracker-miner-object.c',
+    'tracker-miner-online.c',
+    'tracker-miner-fs.c']
+
+libtracker_miner_private = static_library(
+    'tracker-miner-private',
+    miner_enums[0], miner_enums[1], private_sources,
+    dependencies: [tracker_common_dep, tracker_sparql_dep],
+    c_args: [
+        '-DTRACKER_COMPILATION',
+    ],
+)
+
+tracker_miner_dependencies = []
+if network_manager.found()
+    tracker_miner_dependencies += network_manager
+endif
+
+libtracker_miner = library(
+    'tracker-miner-' + tracker_api_version,
+    miner_enums[0], miner_enums[1], miner_sources,
+    c_args: [
+        '-DTRACKER_COMPILATION',
+    ],
+    # This doesn't depend on tracker_common_dep because of
+    # https://github.com/mesonbuild/meson/issues/671
+    include_directories: [commoninc, configinc, srcinc],
+    dependencies: [tracker_sparql_dep] + tracker_miner_dependencies,
+    link_with: [libtracker_miner_private],
+)
+
+tracker_miner_dep = declare_dependency(
+    sources: miner_enums[1],
+    link_with: libtracker_miner,
+    include_directories: include_directories('.')
+)
+
+configure_file(
+    input: 'tracker-miner.pc.in',
+    output: 'tracker-miner-1.0.pc',
+    configuration: conf,
+    install: true,
+    install_dir: join_paths(get_option('prefix'), get_option('libdir'), 'pkgconfig'))
+
+install_headers(
+    'tracker-enumerator.h',
+    'tracker-miner-online.h',
+    'tracker-data-provider.h',
+    'tracker-indexing-tree.h',
+    'tracker-decorator-fs.h',
+    'tracker-miner-fs.h',
+    'tracker-miner-object.h',
+    'tracker-decorator.h',
+    'tracker-miner-enums.h',
+    'tracker-miner.h',
+    subdir: 'tracker-1.0/libtracker-miner')
+
+# Work around https://github.com/mesonbuild/meson/issues/705
+meson.add_install_script('../install-generated-header.sh',
+    join_paths(meson.current_build_dir(), 'tracker-miner-enum-types.h'),
+    join_paths(get_option('prefix'), get_option('includedir'), 'tracker-1.0', 'libtracker-sparql'))
diff --git a/src/libtracker-remote/meson.build b/src/libtracker-remote/meson.build
new file mode 100644
index 0000000..7a817c7
--- /dev/null
+++ b/src/libtracker-remote/meson.build
@@ -0,0 +1,28 @@
+tracker_remote_dependencies = [json_glib, libsoup, libxml2]
+
+sources = [
+    'tracker-json-cursor.vala',
+    'tracker-xml-cursor.vala',
+    'tracker-remote.vala',
+    '../libtracker-common/libtracker-common.vapi'
+]
+
+libtracker_remote = static_library('tracker-remote', sources,
+    dependencies: tracker_remote_dependencies + [tracker_common_dep, tracker_sparql_intermediate_dep],
+    c_args: [
+        '-DTRACKER_COMPILATION',
+    ],
+    vala_args: [
+        '--debug',
+        '--pkg', 'posix',
+        # FIXME: Meson has code to add --target-glib automatically, but it
+        # doesn't seem to work here.
+        '--target-glib', glib_required,
+    ],
+)
+
+tracker_sparql_remote_dep = declare_dependency(
+    link_with: libtracker_remote,
+    include_directories: include_directories('.'),
+    dependencies: tracker_remote_dependencies,
+)
diff --git a/src/libtracker-sparql-backend/meson.build b/src/libtracker-sparql-backend/meson.build
new file mode 100644
index 0000000..db9ea22
--- /dev/null
+++ b/src/libtracker-sparql-backend/meson.build
@@ -0,0 +1,10 @@
+libtracker_sparql = library('tracker-sparql-' + tracker_api_version,
+    'tracker-backend.vala',
+    dependencies: [tracker_sparql_intermediate_dep, tracker_sparql_remote_dep, tracker_sparql_bus_dep, 
tracker_sparql_direct_dep],
+)
+
+tracker_sparql_dep = declare_dependency(
+    link_with: [libtracker_sparql],
+    include_directories: srcinc,
+    dependencies: [tracker_sparql_intermediate_dep],
+)
diff --git a/src/libtracker-sparql/meson.build b/src/libtracker-sparql/meson.build
new file mode 100644
index 0000000..135e109
--- /dev/null
+++ b/src/libtracker-sparql/meson.build
@@ -0,0 +1,91 @@
+enums_c = gnome.mkenums('tracker-sparql-enum-types',
+    sources: 'tracker-notifier.h',
+    c_template: 'tracker-sparql-enum-types.c.template',
+)
+enums_h = gnome.mkenums('tracker-sparql-enum-types',
+    sources: 'tracker-notifier.h',
+    h_template: 'tracker-sparql-enum-types.h.template',
+)
+
+tracker_sparql_intermediate_dependencies = [uuid]
+
+libtracker_sparql_intermediate_vala = static_library('tracker-sparql-vala',
+    enums_h,
+    'tracker-namespace.vala',
+    'tracker-builder.vala',
+    'tracker-connection.vala',
+    'tracker-cursor.vala',
+    'tracker-utils.vala',
+    vala_header: 'tracker-generated-no-checks.h',
+    c_args: [ '-DTRACKER_COMPILATION', ],
+    vala_args: [
+        '--debug',
+        '--pkg', 'posix',
+        # FIXME: Meson has code to add --target-glib automatically, but it
+        # doesn't seem to work here.
+        '--target-glib', glib_required,
+    ],
+    # This doesn't depend on tracker_common_dep because of
+    # https://github.com/mesonbuild/meson/issues/671
+    dependencies: [glib, gio] + tracker_sparql_intermediate_dependencies,
+    include_directories: [commoninc, configinc, srcinc],
+    link_with: [libtracker_common],
+)
+
+libtracker_sparql_intermediate = static_library('tracker-sparql' + tracker_api_version,
+    enums_c, enums_h,
+    'tracker-namespace-manager.c',
+    'tracker-notifier.c',
+    'tracker-resource.c',
+    'tracker-uri.c',
+    'tracker-version.c',
+    c_args: [ '-DTRACKER_COMPILATION', ],
+    # This doesn't depend on tracker_common_dep because of
+    # https://github.com/mesonbuild/meson/issues/671
+    dependencies: [glib] + tracker_sparql_intermediate_dependencies,
+    include_directories: [commoninc, configinc, srcinc],
+    link_with: [libtracker_common, libtracker_sparql_intermediate_vala],
+)
+
+# We must postprocess the generated Vala header to have only-include-once guards
+tracker_sparql_generated_header = custom_target('tracker-sparql-generated-header',
+    # FIXME: can't list tracker-generated-no-checks as an input, even though it
+    # is, because you'll see this:
+    #
+    #     ninja: error:
+    #     '../src/libtracker-sparql/tracker-generated-no-checks.h', needed by
+    #     'src/libtracker-sparql/tracker-generated.h', missing and no known
+    #     rule to make it
+    #
+    output: 'tracker-generated.h',
+    command: [join_paths(meson.current_source_dir(), 'tracker-sparql-add-include-guards.sh'), 
join_paths(meson.current_build_dir(), 'tracker-generated-no-checks.h'), '@OUTPUT@'],
+    depends: libtracker_sparql_intermediate_vala)
+
+tracker_sparql_intermediate_dep = declare_dependency(
+    link_with: [libtracker_sparql_intermediate, libtracker_sparql_intermediate_vala],
+    sources: tracker_sparql_generated_header,
+    include_directories: include_directories('.'),
+    dependencies: tracker_sparql_intermediate_dependencies
+)
+
+configure_file(
+    input: 'tracker-sparql.pc.in',
+    output: 'tracker-sparql-1.0.pc',
+    configuration: conf,
+    install: true,
+    install_dir: join_paths(get_option('prefix'), get_option('libdir'), 'pkgconfig'))
+
+install_headers(
+    'tracker-notifier.h',
+    'tracker-resource.h',
+    'tracker-ontologies.h',
+    'tracker-sparql.h',
+    'tracker-namespace-manager.h',
+    'tracker-version.h',
+    subdir: 'tracker-1.0/libtracker-sparql')
+
+# FIXME: we need a custom script to install generated Vala headers; see
+# <https://github.com/mesonbuild/meson/issues/705>.
+meson.add_install_script('../install-generated-header.sh',
+    join_paths(meson.current_build_dir(), 'tracker-generated.h'),
+    join_paths(get_option('prefix'), get_option('includedir'), 'tracker-1.0', 'libtracker-sparql'))
diff --git a/src/libtracker-sparql/tracker-sparql-add-include-guards.sh 
b/src/libtracker-sparql/tracker-sparql-add-include-guards.sh
new file mode 100755
index 0000000..b0d68ea
--- /dev/null
+++ b/src/libtracker-sparql/tracker-sparql-add-include-guards.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# Wrap the generated Vala header for libtracker-sparql with a #include guard.
+#
+# It's important that this only writes the header when necessary; if it gets
+# written every time then builds will run more or less from scratch whenever
+# Meson needs to reconfigure the project.
+
+set -eu
+
+in="$1"
+out="$2"
+
+(echo "#if !defined (__LIBTRACKER_SPARQL_INSIDE__) && !defined (TRACKER_COMPILATION)";
+ echo "#error \"only <libtracker-sparql/tracker-sparql.h> must be included directly.\"";
+ echo "#endif") > $out
+cat $in >> $out
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..5590dcd
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,47 @@
+# Shared common code
+subdir('libtracker-common')
+
+# Intermediate library of RDF & SPARQL helper functions.
+# This gets used internally and also becomes part of the
+# public libtracker-sparql library.
+subdir('libtracker-sparql')
+
+# Internal database library
+subdir('gvdb')
+subdir('libtracker-fts')
+subdir('libtracker-data')
+
+# Public libtracker-sparql library
+subdir('libtracker-bus')
+subdir('libtracker-direct')
+subdir('libtracker-remote')
+subdir('libtracker-sparql-backend')
+
+# Public libtracker-miner library
+subdir('libtracker-miner')
+
+# Internal data extraction helpers
+subdir('libtracker-extract')
+
+# Public data extract tool & modules
+subdir('tracker-extract')
+
+# Public miners
+subdir('miners')
+
+# Internal control library
+subdir('libtracker-control')
+
+# Public commandline control tool
+subdir('tracker')
+
+# Public shared database
+subdir('tracker-store')
+
+# Example search application
+subdir('tracker-needle')
+
+# Example configuration application
+subdir('tracker-preferences')
+
+meson.add_install_script('create-miner-symlinks.sh', dbus_services_dir, tracker_miner_services_dir)
diff --git a/src/miners/fs/meson.build b/src/miners/fs/meson.build
new file mode 100644
index 0000000..010388e
--- /dev/null
+++ b/src/miners/fs/meson.build
@@ -0,0 +1,71 @@
+sources = [
+    'tracker-config.c',
+    'tracker-extract-watchdog.c',
+    'tracker-main.c',
+    'tracker-miner-files.c',
+    'tracker-miner-files-index.c',
+    'tracker-miner-files-peer-listener.c',
+    'tracker-storage.c',
+    'tracker-writeback-listener.c',
+    'tracker-writeback-dispatcher.c',
+    'tracker-writeback.c',
+]
+
+if battery_detection_library_name == 'upower'
+  sources += 'tracker-power-upower.c'
+elif battery_detection_library_name == 'hal'
+  sources += 'tracker-power-hal.c'
+endif
+
+executable('tracker-miner-fs', sources,
+    dependencies: [tracker_common_dep, tracker_miner_dep, tracker_extract_dep],
+    c_args: [
+        '-DTRACKER_COMPILATION',
+    ],
+    install: true,
+    install_dir: get_option('libexecdir')
+)
+
+install_data(
+    sources: 'tracker-miner-files-index.xml',
+    install_dir: join_paths(get_option('datadir'), 'tracker'))
+
+dbus_service_file_untranslated = configure_file(
+    input: 'org.freedesktop.Tracker1.Miner.Files.service.in.in',
+    output: 'org.freedesktop.Tracker1.Miner.Files.service.in',
+    configuration: conf)
+
+dbus_service_file = custom_target('tracker-miner-files-dbus-service-file',
+    input: dbus_service_file_untranslated,
+    output: 'org.freedesktop.Tracker1.Miner.Files.service',
+    command: ['intltool-merge', '--quiet', '--desktop-style', '--utf8', join_paths(meson.source_root(), 
'po'), '@INPUT@', '@OUTPUT@'],
+    install: true,
+    install_dir: dbus_services_dir)
+
+desktop_file_untranslated = configure_file(
+    input: 'tracker-miner-fs.desktop.in.in',
+    output: 'tracker-miner-fs.desktop.in',
+    configuration: conf)
+
+desktop_file = custom_target('tracker-miner-fs-desktop-file',
+    input: desktop_file_untranslated,
+    output: 'tracker-miner-fs.desktop',
+    command: ['intltool-merge', '--quiet', '--desktop-style', '--utf8', join_paths(meson.source_root(), 
'po'), '@INPUT@', '@OUTPUT@'],
+    install: true,
+    install_dir: join_paths(get_option('sysconfdir'), 'xdg/autostart'))
+
+custom_target('tracker-miner-fs-settings-schema',
+    input: 'org.freedesktop.Tracker.Miner.Files.gschema.xml.in',
+    output: 'org.freedesktop.Tracker.Miner.Files.gschema.xml',
+    command: ['intltool-merge', '--quiet', '--xml-style', '--utf8', join_paths(meson.source_root(), 'po'), 
'@INPUT@', '@OUTPUT@'],
+    install: true,
+    install_dir: join_paths(get_option('datadir'), 'glib-2.0', 'schemas'))
+
+if install_systemd_user_services
+  configure_file(
+      input: 'tracker-miner-fs.service.in',
+      output: 'tracker-miner-fs.service',
+      configuration: conf,
+      install: true,
+      install_dir: systemd_user_services_dir)
+endif
diff --git a/src/miners/meson.build b/src/miners/meson.build
new file mode 100644
index 0000000..d9236f2
--- /dev/null
+++ b/src/miners/meson.build
@@ -0,0 +1,4 @@
+# Only FS and RSS miners are built at present; the others are likely to
+# be removed soon.
+subdir('fs')
+subdir('rss')
diff --git a/src/miners/rss/meson.build b/src/miners/rss/meson.build
new file mode 100644
index 0000000..e4406ab
--- /dev/null
+++ b/src/miners/rss/meson.build
@@ -0,0 +1,44 @@
+sources = [
+    'tracker-main.c',
+    'tracker-miner-rss.c',
+]
+
+executable('tracker-miner-rss', sources,
+    dependencies: [libgrss, tracker_common_dep, tracker_miner_dep, tracker_extract_dep],
+    c_args: [
+        '-DTRACKER_COMPILATION',
+    ],
+)
+
+dbus_service_file_untranslated = configure_file(
+    input: 'org.freedesktop.Tracker1.Miner.RSS.service.in.in',
+    output: 'org.freedesktop.Tracker1.Miner.RSS.service.in',
+    configuration: conf)
+
+dbus_service_file = custom_target('tracker-miner-rss-dbus-service-file',
+    input: dbus_service_file_untranslated,
+    output: 'org.freedesktop.Tracker1.Miner.RSS.service',
+    command: ['intltool-merge', '--quiet', '--desktop-style', '--utf8', join_paths(meson.source_root(), 
'po'), '@INPUT@', '@OUTPUT@'],
+    install: true,
+    install_dir: dbus_services_dir)
+
+desktop_file_untranslated = configure_file(
+    input: 'tracker-miner-rss.desktop.in.in',
+    output: 'tracker-miner-rss.desktop.in',
+    configuration: conf)
+
+desktop_file = custom_target('tracker-miner-rss-desktop-file',
+    input: desktop_file_untranslated,
+    output: 'tracker-miner-rss.desktop',
+    command: ['intltool-merge', '--quiet', '--desktop-style', '--utf8', join_paths(meson.source_root(), 
'po'), '@INPUT@', '@OUTPUT@'],
+    install: true,
+    install_dir: join_paths(get_option('sysconfdir'), 'xdg/autostart'))
+
+if install_systemd_user_services
+  configure_file(
+      input: 'tracker-miner-rss.service.in',
+      output: 'tracker-miner-rss.service',
+      configuration: conf,
+      install: true,
+      install_dir: systemd_user_services_dir)
+endif
diff --git a/src/tracker-extract/meson.build b/src/tracker-extract/meson.build
new file mode 100644
index 0000000..8db6427
--- /dev/null
+++ b/src/tracker-extract/meson.build
@@ -0,0 +1,199 @@
+modules = [
+  ['extract-bmp', 'tracker-extract-bmp.c', '10-bmp.rule', [tracker_common_dep]],
+  ['extract-dummy', 'tracker-extract-dummy.c', ['10-comics.rule', '10-ebooks.rule'], [tracker_common_dep]]
+]
+
+if get_option('abiword')
+  modules += [['extract-abw', 'tracker-extract-abw.c', '10-abw.rule', [tracker_common_dep]]]
+endif
+
+if get_option('dvi')
+  modules += [['extract-dvi', 'tracker-extract-dvi.c', '10-dvi.rule', [tracker_common_dep]]]
+endif
+
+if libgsf.found()
+  modules += [['extract-epub', 'tracker-extract-epub.c', '10-epub.rule', [libgsf, tracker_common_dep]]]
+  modules += [['extract-msoffice', 'tracker-extract-msoffice.c', '10-msoffice.rule', [libgsf, 
tracker_common_dep]]]
+  modules += [['extract-msoffice-xml', 'tracker-extract-msoffice-xml.c', '11-msoffice-xml.rule', [libgsf, 
tracker_common_dep]]]
+  modules += [['extract-oasis', 'tracker-extract-oasis.c', '10-oasis.rule', [libgsf, tracker_common_dep]]]
+endif
+
+if flac.found()
+  modules += [['extract-flac', 'tracker-extract-flac.c', '10-flac.rule', [flac, tracker_common_dep]]]
+endif
+
+if libgif.found()
+  modules += [['extract-gif', 'tracker-extract-gif.c', '10-gif.rule', [libgif, tracker_common_dep]]]
+endif
+
+if generic_media_handler_name == 'gstreamer'
+  sources = ['tracker-extract-gstreamer.c', 'tracker-cue-sheet.c']
+  rules = ['10-svg.rule', '15-gstreamer-guess.rule', '90-gstreamer-image-generic.rule', 
'90-gstreamer-audio-generic.rule', '90-gstreamer-video-generic.rule']
+  dependencies = [gstreamer, libcue, tracker_common_dep]
+
+  if gstreamer_backend_name == 'GUPnP-DNLA'
+    rules += '91-gstreamer-generic-dnla.rule'
+    dependencies += gupnp_dnla
+  elif gstreamer_backend_name == 'discoverer'
+    dependencies += gstreamer_pbutils
+  endif
+
+  modules += [['extract-gstreamer', sources, rules, dependencies]]
+endif
+
+if libxml2.found()
+  modules += [['extract-html', 'tracker-extract-html.c', '10-html.rule', [libxml2]]]
+endif
+
+if libjpeg.found()
+  modules += [['extract-jpeg', 'tracker-extract-jpeg.c', '10-jpeg.rule', [libjpeg, tracker_common_dep]]]
+endif
+
+if generic_media_handler_name == 'libav'
+  rules = ['90-libav-audio-generic.rule', '90-libav-video-generic.rule']
+  dependencies = [avcodec, avformat, avutil, tracker_common_dep]
+  modules += [['extract-libav', 'tracker-extract-libav.c', rules, dependencies]]
+endif
+
+if get_option('icon')
+  modules += [['extract-icon', 'tracker-extract-icon.c', '10-ico.rule', []]]
+endif
+
+if libosinfo.found()
+  modules += [['extract-iso', 'tracker-extract-iso.c', '11-iso.rule', [libosinfo]]]
+endif
+
+if get_option('mp3')
+  modules += [['extract-mp3', 'tracker-extract-mp3.c', '10-mp3.rule', [tracker_common_dep]]]
+endif
+
+if poppler.found()
+  modules += [['extract-pdf', 'tracker-extract-pdf.c', '10-pdf.rule', [poppler, tracker_common_dep]]]
+endif
+
+if totem_plparser.found()
+  modules += [['extract-playlist', 'tracker-extract-playlist.c', '15-playlist.rule', [totem_plparser]]]
+endif
+
+if libpng.found()
+  modules += [['extract-png', 'tracker-extract-png.c', '10-png.rule', [libpng, tracker_common_dep]]]
+endif
+
+if get_option('ps')
+  modules += [['extract-ps', 'tracker-extract-ps.c', '10-ps.rule', [tracker_common_dep]]]
+endif
+
+if get_option('text')
+  modules += [['extract-text', 'tracker-extract-text.c', ['15-source-code.rule', '90-text-generic.rule'], 
[]]]
+endif
+
+if libtiff.found()
+  modules += [['extract-tiff', 'tracker-extract-tiff.c', '10-tiff.rule', [libtiff, tracker_common_dep]]]
+endif
+
+if libvorbis.found()
+  modules += [['extract-vorbis', 'tracker-extract-vorbis.c', '10-vorbis.rule', [libvorbis, 
tracker_common_dep]]]
+endif
+
+if exempi.found()
+  modules += [['extract-xmp', 'tracker-extract-xmp.c', '10-xmp.rule', []]]
+endif
+
+if libgxps.found()
+  modules += [['extract-xps', 'tracker-extract-xps.c', '10-xps.rule', [libgxps, tracker_common_dep]]]
+endif
+
+
+foreach module : modules
+  name = module[0]
+  sources = module[1]
+  rule = module[2]
+  dependencies = module[3]
+
+  shared_module(name, sources,
+    c_args: [ '-DTRACKER_COMPILATION' ],
+    dependencies: [tracker_extract_dep] + dependencies,
+    include_directories: configinc,
+    install: true,
+    install_dir: tracker_extract_modules_dir)
+
+  install_data(rule, install_dir: tracker_extract_rules_dir)
+endforeach
+
+tracker_extract_priority_dbus = gnome.gdbus_codegen(
+    'tracker-extract-priority-dbus',
+    'tracker-extract-priority.xml',
+    interface_prefix: 'org.freedesktop.Tracker1.Extract.',
+    namespace: 'TrackerExtractDBus')
+
+tracker_extract_sources = [
+    'tracker-config.c',
+    'tracker-extract.c',
+    'tracker-extract-controller.c',
+    'tracker-extract-decorator.c',
+    'tracker-extract-persistence.c',
+    'tracker-read.c',
+    'tracker-main.c',
+    tracker_extract_priority_dbus
+]
+
+tracker_extract_dependencies = [
+    tracker_common_dep, tracker_data_dep, tracker_extract_dep,
+    tracker_miner_dep, tracker_sparql_dep
+]
+
+if libgsf.found()
+    tracker_extract_sources += 'tracker-gsf.c'
+    tracker_extract_dependencies += libgsf
+endif
+
+executable('tracker-extract',
+    tracker_extract_sources,
+    c_args: [ '-DTRACKER_COMPILATION' ],
+    dependencies: tracker_extract_dependencies,
+    install: true,
+    install_dir: join_paths(get_option('prefix'), get_option('libexecdir')))
+
+install_data(
+    'tracker-extract-priority.xml',
+    install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'tracker'))
+
+dbus_service_file_untranslated = configure_file(
+    input: 'org.freedesktop.Tracker1.Miner.Extract.service.in.in',
+    output: 'org.freedesktop.Tracker1.Miner.Extract.service.in',
+    configuration: conf)
+
+dbus_service_file = custom_target('tracker-extract-dbus-service-file',
+    input: dbus_service_file_untranslated,
+    output: 'org.freedesktop.Tracker1.Miner.Extract.service',
+    command: ['intltool-merge', '--quiet', '--desktop-style', '--utf8', join_paths(meson.source_root(), 
'po'), '@INPUT@', '@OUTPUT@'],
+    install: true,
+    install_dir: dbus_services_dir)
+
+desktop_file_untranslated = configure_file(
+    input: 'tracker-extract.desktop.in.in',
+    output: 'tracker-extract.desktop.in',
+    configuration: conf)
+
+desktop_file = custom_target('tracker-extract-desktop-file',
+    input: desktop_file_untranslated,
+    output: 'tracker-extract.desktop',
+    command: ['intltool-merge', '--quiet', '--desktop-style', '--utf8', join_paths(meson.source_root(), 
'po'), '@INPUT@', '@OUTPUT@'],
+    install: true,
+    install_dir: join_paths(get_option('sysconfdir'), 'xdg/autostart'))
+
+custom_target('tracker-extract-settings-schema',
+    input: 'org.freedesktop.Tracker.Extract.gschema.xml.in',
+    output: 'org.freedesktop.Tracker.Extract.gschema.xml',
+    command: ['intltool-merge', '--quiet', '--xml-style', '--utf8', join_paths(meson.source_root(), 'po'), 
'@INPUT@', '@OUTPUT@'],
+    install: true,
+    install_dir: join_paths(get_option('datadir'), 'glib-2.0', 'schemas'))
+
+if install_systemd_user_services
+  configure_file(
+      input: 'tracker-extract.service.in',
+      output: 'tracker-extract.service',
+      configuration: conf,
+      install: true,
+      install_dir: systemd_user_services_dir)
+endif
diff --git a/src/tracker-needle/meson.build b/src/tracker-needle/meson.build
new file mode 100644
index 0000000..b5479b9
--- /dev/null
+++ b/src/tracker-needle/meson.build
@@ -0,0 +1,20 @@
+executable(
+    'tracker-needle',
+    'config.vapi',
+    'tracker-needle.vala',
+    'tracker-history.vala',
+    'tracker-needle.vala',
+    'tracker-query.vala',
+    'tracker-result-store.vala',
+    'tracker-stats.vala',
+    'tracker-tags-view.vala',
+    'tracker-utils.vala',
+    'tracker-view.vala',
+    dependencies: [tracker_common_dep, tracker_sparql_dep, gtk3],
+    c_args: [
+        '-D_XOPEN_SOURCE',
+        '-D_XOPEN_SOURCE_EXTENDED',
+        '-include', 'config.h'
+    ],
+    install: true
+)
diff --git a/src/tracker-preferences/meson.build b/src/tracker-preferences/meson.build
new file mode 100644
index 0000000..902085d
--- /dev/null
+++ b/src/tracker-preferences/meson.build
@@ -0,0 +1,37 @@
+executable(
+    'tracker-preferences',
+    'config.vapi',
+    'tracker-preferences.vala',
+    '../miners/fs/tracker-config.c',
+    dependencies: [tracker_common_dep, tracker_sparql_dep, gmodule, gtk3],
+    c_args: [
+        '-D_XOPEN_SOURCE',
+        '-D_XOPEN_SOURCE_EXTENDED',
+        '-DTRACKER_COMPILATION',
+        '-include', 'config.h'
+    ],
+    vala_args: [
+        '--pkg', 'posix'
+    ],
+    install: true
+)
+
+desktop_file_untranslated = configure_file(
+    input: 'tracker-preferences.desktop.in.in',
+    output: 'tracker-preferences.desktop.in',
+    configuration: conf)
+
+desktop_file = custom_target('tracker-preferences-desktop-file',
+    input: desktop_file_untranslated,
+    output: 'tracker-preferences.desktop',
+    command: ['intltool-merge', '--quiet', '--desktop-style', '--utf8', join_paths(meson.source_root(), 
'po'), '@INPUT@', '@OUTPUT@'],
+    install: true,
+    install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'applications'))
+
+install_data(
+    'tracker-preferences.appdata.xml',
+    install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'appdata'))
+
+install_data(
+    'tracker-preferences.ui',
+    install_dir: join_paths(get_option('prefix'), get_option('datadir')))
diff --git a/src/tracker-store/meson.build b/src/tracker-store/meson.build
new file mode 100644
index 0000000..b941e9e
--- /dev/null
+++ b/src/tracker-store/meson.build
@@ -0,0 +1,83 @@
+tracker_store_sources = [
+    'tracker-backup.vala',
+    'tracker-config.c',
+    'tracker-dbus.vala',
+    'tracker-events.c',
+    'tracker-main.vala',
+    'tracker-resources.vala',
+    'tracker-statistics.vala',
+    'tracker-status.vala',
+    'tracker-steroids.vala',
+    'tracker-store.vala',
+    'tracker-writeback.c',
+    'tracker-config.vapi',
+    'tracker-events.vapi',
+    'tracker-locale-change.vapi',
+    'tracker-writeback.vapi',
+    '../libtracker-common/libtracker-common.vapi',
+    '../libtracker-data/libtracker-data.vapi',
+]
+
+executable('tracker-store',
+    tracker_store_sources,
+    c_args: [
+        '-DTRACKER_COMPILATION',
+        '-include', 'config.h'
+    ],
+    vala_args: [ '--pkg', 'posix' ],
+    dependencies: [
+        tracker_common_dep, tracker_data_dep,
+        gio_unix
+    ],
+    install: true,
+    install_dir: join_paths(get_option('prefix'), get_option('libexecdir')))
+
+install_data(
+    'tracker-backup.xml',
+    'tracker-resources.xml',
+    'tracker-statistics.xml',
+    'tracker-status.xml',
+    install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'tracker'))
+
+dbus_service_file = custom_target('tracker-store-dbus-service-file',
+    input: 'org.freedesktop.Tracker1.service.in',
+    output: 'org.freedesktop.Tracker1.service',
+    command: ['intltool-merge', '--quiet', '--desktop-style', '--utf8', join_paths(meson.source_root(), 
'po'), '@INPUT@', '@OUTPUT@'],
+    install: true,
+    install_dir: dbus_services_dir)
+
+desktop_file_untranslated = configure_file(
+    input: 'tracker-store.desktop.in.in',
+    output: 'tracker-store.desktop.in',
+    configuration: conf)
+
+desktop_file = custom_target('tracker-store-desktop-file',
+    input: desktop_file_untranslated,
+    output: 'tracker-store.desktop',
+    command: ['intltool-merge', '--quiet', '--desktop-style', '--utf8', join_paths(meson.source_root(), 
'po'), '@INPUT@', '@OUTPUT@'],
+    install: true,
+    install_dir: join_paths(get_option('sysconfdir'), 'xdg/autostart'))
+
+if install_systemd_user_services
+  configure_file(
+      input: 'tracker-store.service.in',
+      output: 'tracker-store.service',
+      configuration: conf,
+      install: true,
+      install_dir: systemd_user_services_dir)
+endif
+
+custom_target('tracker-store-settings-schema',
+    input: 'org.freedesktop.Tracker.Store.gschema.xml.in',
+    output: 'org.freedesktop.Tracker.Store.gschema.xml',
+    command: ['intltool-merge', '--quiet', '--xml-style', '--utf8', join_paths(meson.source_root(), 'po'), 
'@INPUT@', '@OUTPUT@'],
+    install: true,
+    install_dir: join_paths(get_option('datadir'), 'glib-2.0', 'schemas'))
+
+custom_target('tracker-store-settings-schemalist',
+    input: 'org.freedesktop.Tracker.gschema.xml.in',
+    output: 'org.freedesktop.Tracker.gschema.xml',
+    command: ['intltool-merge', '--quiet', '--xml-style', '--utf8', join_paths(meson.source_root(), 'po'), 
'@INPUT@', '@OUTPUT@'],
+    install: true,
+    install_dir: join_paths(get_option('datadir'), 'glib-2.0', 'schemas'))
+
diff --git a/src/tracker/meson.build b/src/tracker/meson.build
new file mode 100644
index 0000000..a71af94
--- /dev/null
+++ b/src/tracker/meson.build
@@ -0,0 +1,38 @@
+sources = [
+    'tracker-main.c',
+    'tracker-config.c',
+    'tracker-daemon.c',
+    'tracker-dbus.c',
+    'tracker-extract.c',
+    'tracker-help.c',
+    'tracker-index.c',
+    'tracker-info.c',
+    'tracker-process.c',
+    'tracker-reset.c',
+    'tracker-search.c',
+    'tracker-sparql.c',
+    'tracker-sql.c',
+    'tracker-status.c',
+    'tracker-tag.c',
+]
+
+executable('tracker', sources,
+    c_args: [
+        '-DLIBEXECDIR="@0@"'.format(join_paths(get_option('prefix'), get_option('libexecdir'))),
+        '-DMANDIR="@0@"'.format(join_paths(get_option('prefix'), get_option('datadir'), 'man')),
+        '-DTRACKER_EXTRACTOR_RULES_DIR="@0@"'.format(tracker_extract_rules_dir),
+        '-DTRACKER_COMPILATION',
+    ],
+    install: true,
+    # This doesn't depend on tracker_common_dep because of
+    # https://github.com/mesonbuild/meson/issues/671
+    dependencies: [tracker_control_dep, tracker_sparql_dep, tracker_data_dep],
+    include_directories: [commoninc, configinc, srcinc],
+)
+
+
+if install_bash_completion
+    install_data(
+        sources: 'bash-completion/tracker',
+        install_dir: bash_completion_dir)
+endif
diff --git a/tests/common/meson.build b/tests/common/meson.build
new file mode 100644
index 0000000..2598745
--- /dev/null
+++ b/tests/common/meson.build
@@ -0,0 +1,15 @@
+tracker_testcommon_dependencies = [glib]
+
+libtracker_testcommon = library('tracker-testcommon',
+    'tracker-test-helpers.c',
+    dependencies: tracker_testcommon_dependencies,
+    c_args: [
+        '-DTEST_TEXT="@0@/tests/libtracker-common/non-utf8.txt"'.format(meson.source_root()),
+    ]
+)
+
+tracker_testcommon_dep = declare_dependency(
+    link_with: libtracker_testcommon,
+    dependencies: tracker_testcommon_dependencies,
+    include_directories: include_directories('.'),
+)
diff --git a/tests/functional-tests/ipc/meson.build b/tests/functional-tests/ipc/meson.build
new file mode 100644
index 0000000..c458ac8
--- /dev/null
+++ b/tests/functional-tests/ipc/meson.build
@@ -0,0 +1,53 @@
+insert_or_replace_test = executable('test-insert-or-replace',
+  'test-insert-or-replace.vala',
+  dependencies: [tracker_common_dep, tracker_sparql_dep])
+test('functional-ipc-insert-or-replace', insert_or_replace_test)
+
+busy_handling_test = executable('test-busy-handling',
+  'test-busy-handling.vala',
+  dependencies: [tracker_common_dep, tracker_sparql_dep])
+test('functional-ipc-busy-handling', busy_handling_test)
+
+direct_query_test = executable('test-direct-query',
+  'test-direct-query.vala',
+  'test-shared-query.vala',
+  dependencies: [tracker_common_dep, tracker_sparql_dep])
+test('functional-ipc-direct-query', direct_query_test)
+
+bus_query_test = executable('test-bus-query',
+  'test-bus-query.vala',
+  'test-shared-query.vala',
+  dependencies: [tracker_common_dep, tracker_sparql_dep, tracker_sparql_bus_dep])
+test('functional-ipc-bus-query', bus_query_test)
+
+default_update_test = executable('test-default-update',
+  'test-default-update.vala',
+  'test-shared-update.vala',
+  dependencies: [tracker_common_dep, tracker_sparql_dep])
+test('functional-ipc-default-update', default_update_test)
+
+bus_update_test = executable('test-bus-update',
+  'test-bus-update.vala',
+  'test-shared-update.vala',
+  dependencies: [tracker_common_dep, tracker_sparql_dep, tracker_sparql_bus_dep])
+test('functional-ipc-bus-update', bus_update_test)
+
+class_signal_test = executable('test-class-signal',
+  'test-class-signal.vala',
+  dependencies: [tracker_common_dep, tracker_sparql_dep])
+test('functional-ipc-class-signal', class_signal_test)
+
+class_signal_performance_test = executable('test-class-signal-performance',
+  'test-class-signal-performance.vala',
+  dependencies: [tracker_common_dep, tracker_sparql_dep])
+test('functional-ipc-class-signal-performance', class_signal_performance_test)
+
+class_signal_performance_batch_test = executable('test-class-signal-performance-batch',
+  'test-class-signal-performance-batch.vala',
+  dependencies: [tracker_common_dep, tracker_sparql_dep])
+test('functional-ipc-class-signal-performance-batch', class_signal_performance_batch_test)
+
+update_array_performance_test = executable('test-update-array-performance',
+  'test-update-array-performance.c',
+  dependencies: [tracker_common_dep, tracker_sparql_dep])
+test('functional-ipc-update-array-performance', update_array_performance_test)
diff --git a/tests/functional-tests/meson.build b/tests/functional-tests/meson.build
new file mode 100644
index 0000000..af80853
--- /dev/null
+++ b/tests/functional-tests/meson.build
@@ -0,0 +1,41 @@
+subdir('ipc')
+
+test_runner = find_program('test-runner.sh')
+
+functional_tests = [
+  '01-insertion',
+  '02-sparql-bugs',
+  '03-fts-functions',
+  '04-group-concat',
+  '05-coalesce',
+  '06-distance',
+  '07-graph',
+  '08-unique-insertions',
+  '09-concurrent-query',
+  '10-sqlite-misused',
+  '11-sqlite-batch-misused',
+  '12-transactions',
+  '13-threaded-store',
+  '14-signals',
+  '15-statistics',
+  '16-collation',
+  '17-ontology-changes',
+  '200-backup-restore',
+  '300-miner-basic-ops',
+  '301-miner-resource-removal',
+  '310-fts-indexing',
+  '400-extractor-metadata',
+  '410-extractor-decorator',
+  '500-writeback',
+  '501-writeback-details',
+  '600-applications-camera',
+  '601-applications-sync',
+]
+
+foreach t: functional_tests
+  test('functional-' + t, test_runner,
+    args: './' + t + '.py',
+    workdir: meson.current_source_dir(),
+    # FIXME: these tests are all too slow
+    timeout: 180)
+endforeach
diff --git a/tests/gvdb/meson.build b/tests/gvdb/meson.build
new file mode 100644
index 0000000..89ab725
--- /dev/null
+++ b/tests/gvdb/meson.build
@@ -0,0 +1,7 @@
+gvdb_test = executable('gvdb-test',
+    'gvdb-test.c',
+    dependencies: gvdb_dep,
+    include_directories: configinc,
+)
+
+test('gvdb', gvdb_test)
diff --git a/tests/libtracker-common/meson.build b/tests/libtracker-common/meson.build
new file mode 100644
index 0000000..03c9953
--- /dev/null
+++ b/tests/libtracker-common/meson.build
@@ -0,0 +1,61 @@
+test_c_args = [
+    '-DTRACKER_COMPILATION',
+    '-DTOP_BUILDDIR="@0@"'.format(meson.build_root()),
+    '-DTOP_SRCDIR="@0@"'.format(meson.source_root()),
+]
+
+date_time_test = executable('tracker-date-time-test',
+    'tracker-date-time-test.c',
+    dependencies: tracker_common_dep,
+    c_args: test_c_args,
+)
+test('common-date-time', date_time_test)
+
+dbus_test = executable('tracker-dbus-test',
+    'tracker-dbus-test.c',
+    dependencies: [tracker_common_dep, tracker_testcommon_dep],
+    c_args: test_c_args,
+)
+test('common-dbus', dbus_test)
+
+file_utils_test = executable('tracker-file-utils-test',
+    'tracker-file-utils-test.c',
+    dependencies: [tracker_common_dep, tracker_testcommon_dep],
+    c_args: test_c_args,
+)
+test('common-file-utils', file_utils_test)
+
+parser_test = executable('tracker-parser-test',
+    'tracker-parser-test.c',
+    dependencies: [tracker_common_dep, tracker_testcommon_dep],
+    c_args: test_c_args,
+)
+test('common-parser', parser_test)
+
+sched_test = executable('tracker-sched-test',
+    'tracker-sched-test.c',
+    dependencies: [tracker_common_dep, tracker_testcommon_dep],
+    c_args: test_c_args,
+)
+test('common-sched', sched_test)
+
+type_utils_test = executable('tracker-type-utils-test',
+    'tracker-type-utils-test.c',
+    dependencies: tracker_common_dep,
+    c_args: test_c_args,
+)
+test('common-type-utils', type_utils_test)
+
+utils_test = executable('tracker-utils-test',
+    'tracker-utils-test.c',
+    dependencies: tracker_common_dep,
+    c_args: test_c_args,
+)
+test('common-utils', utils_test)
+
+# This is a manual test case
+parser_testcase = executable('tracker-parser',
+    'tracker-parser.c',
+    dependencies: tracker_common_dep,
+    c_args: test_c_args,
+)
diff --git a/tests/libtracker-data/meson.build b/tests/libtracker-data/meson.build
new file mode 100644
index 0000000..84a9e5b
--- /dev/null
+++ b/tests/libtracker-data/meson.build
@@ -0,0 +1,51 @@
+test_c_args = [
+    '-DTRACKER_COMPILATION',
+    '-DTOP_BUILDDIR="@0@"'.format(meson.build_root()),
+    '-DTOP_SRCDIR="@0@"'.format(meson.source_root()),
+]
+
+backup_test = executable('tracker-backup-test',
+    'tracker-backup-test.c',
+    dependencies: [tracker_common_dep, tracker_data_dep],
+    c_args: test_c_args)
+test('data-backup', backup_test)
+
+crc32_test = executable('tracker-crc32-test',
+    'tracker-crc32-test.c',
+    dependencies: [tracker_common_dep, tracker_data_dep],
+    c_args: test_c_args)
+test('data-crc32', crc32_test)
+
+db_journal_test = executable('tracker-db-journal-test',
+    'tracker-db-journal.c',
+    dependencies: [tracker_common_dep, tracker_data_dep],
+    c_args: test_c_args)
+test('data-db-journal', db_journal_test)
+
+ontology_test = executable('tracker-ontology-test',
+    'tracker-ontology-test.c',
+    dependencies: [tracker_common_dep, tracker_data_dep],
+    c_args: test_c_args)
+test('data-ontology', ontology_test,
+    # FIXME: why is this test so slow?
+    timeout: 180)
+
+ontology_change_test = executable('tracker-ontology-change-test',
+    'tracker-ontology-change-test.c',
+    dependencies: [tracker_common_dep, tracker_data_dep],
+    c_args: test_c_args)
+test('data-ontology-change', ontology_change_test)
+
+sparql_test = executable('tracker-data-sparql-test',
+    'tracker-sparql-test.c',
+    dependencies: [tracker_common_dep, tracker_data_dep],
+    c_args: test_c_args)
+test('data-sparql', sparql_test,
+    # FIXME: why is this test so slow?
+    timeout: 180)
+
+sparql_blank_test = executable('tracker-sparql-blank-test',
+    'tracker-sparql-blank-test.c',
+    dependencies: [tracker_common_dep, tracker_data_dep],
+    c_args: test_c_args)
+test('data-sparql-blank', sparql_blank_test)
diff --git a/tests/libtracker-extract/meson.build b/tests/libtracker-extract/meson.build
new file mode 100644
index 0000000..9c0a554
--- /dev/null
+++ b/tests/libtracker-extract/meson.build
@@ -0,0 +1,60 @@
+test_c_args = [
+  '-DTRACKER_COMPILATION',
+  '-DTOP_BUILDDIR="@0@/"'.format(meson.build_root()),
+  '-DTOP_SRCDIR="@0@/"'.format(meson.source_root()),
+]
+
+guarantee_test = executable('tracker-guarantee-test',
+  'tracker-guarantee-test.c',
+  dependencies: [tracker_common_dep, tracker_extract_dep],
+  c_args: test_c_args,
+)
+test('extract-guarantee', guarantee_test)
+
+extract_info_test = executable('tracker-extract-info-test',
+  'tracker-extract-info-test.c',
+  dependencies: [tracker_common_dep, tracker_extract_dep],
+  c_args: test_c_args,
+)
+test('extract-info-test', extract_info_test)
+
+utils_test = executable('tracker-test-utils',
+  'tracker-test-utils.c',
+  dependencies: [tracker_common_dep, tracker_extract_dep],
+  c_args: test_c_args,
+)
+test('extract-utils', utils_test)
+
+xmp_test = executable('tracker-test-xmp',
+  'tracker-test-xmp.c',
+  dependencies: [tracker_common_dep, tracker_extract_dep],
+  c_args: test_c_args,
+)
+test('extract-xmp', xmp_test)
+
+if libexif.found()
+  exif_test = executable('tracker-exif-test',
+    'tracker-exif-test.c',
+    dependencies: [tracker_common_dep, tracker_extract_dep],
+    c_args: test_c_args,
+  )
+  test('extract-exif', exif_test)
+endif
+
+if libiptcdata.found() and libjpeg.found()
+  iptc_test = executable('tracker-iptc-test',
+    'tracker-iptc-test.c',
+    dependencies: [tracker_common_dep, tracker_extract_dep, libjpeg],
+    c_args: test_c_args,
+  )
+  test('extract-iptc', iptc_test)
+endif
+
+if charset_library_name != 'none'
+  encoding_test = executable('tracker-encoding-test',
+    'tracker-encoding-test.c',
+    dependencies: [tracker_common_dep, tracker_extract_dep],
+    c_args: test_c_args,
+  )
+  test('extract-encoding', encoding_test)
+endif
diff --git a/tests/libtracker-fts/meson.build b/tests/libtracker-fts/meson.build
new file mode 100644
index 0000000..ae6c6ec
--- /dev/null
+++ b/tests/libtracker-fts/meson.build
@@ -0,0 +1,13 @@
+test_c_args = [
+  '-DTRACKER_COMPILATION',
+  '-DTOP_BUILDDIR="@0@/"'.format(meson.build_root()),
+  '-DTOP_SRCDIR="@0@/"'.format(meson.source_root()),
+]
+
+fts_test = executable('tracker-fts-test',
+  'tracker-fts-test.c',
+  dependencies: [tracker_common_dep, tracker_sparql_dep, tracker_data_dep, tracker_testcommon_dep],
+  c_args: test_c_args
+)
+
+test('fts', fts_test)
diff --git a/tests/libtracker-miner/meson.build b/tests/libtracker-miner/meson.build
new file mode 100644
index 0000000..538c85a
--- /dev/null
+++ b/tests/libtracker-miner/meson.build
@@ -0,0 +1,69 @@
+test_c_args = [
+  '-DLIBEXEC_PATH="@0@/@1@"'.format(get_option('prefix'), get_option('libexecdir')),
+  '-DTEST',
+  '-DTRACKER_COMPILATION',
+  '-DTEST_DATA_DIR="@0@/data"'.format(meson.current_source_dir()),
+  '-DTEST_MINERS_DIR="@0@/mock-miners"'.format(meson.current_source_dir()),
+]
+
+crawler_test = executable('tracker-crawler-test',
+  'tracker-crawler-test.c',
+  shared_libtracker_miner_crawler_sources,
+  dependencies: [tracker_common_dep, tracker_miner_dep],
+  c_args: test_c_args
+)
+test('miner-crawler', crawler_test)
+
+file_notifier_test = executable('tracker-file-notifier-test',
+  'tracker-file-notifier-test.c',
+  dependencies: [tracker_common_dep, tracker_miner_dep],
+  c_args: test_c_args
+)
+test('miner-file-notifier', file_notifier_test)
+
+file_system_test = executable('tracker-file-system-test',
+  'tracker-file-system-test.c',
+  dependencies: [tracker_common_dep, tracker_miner_dep],
+  c_args: test_c_args
+)
+test('miner-file-system', file_system_test)
+
+indexing_tree_test = executable('tracker-indexing-tree-test',
+  'tracker-indexing-tree-test.c',
+  dependencies: [tracker_common_dep, tracker_miner_dep],
+  c_args: test_c_args
+)
+test('miner-indexing-tree', indexing_tree_test)
+
+monitor_test = executable('tracker-monitor-test',
+  'tracker-monitor-test.c',
+  shared_libtracker_miner_monitor_sources,
+  dependencies: [tracker_common_dep, tracker_miner_dep],
+  c_args: test_c_args
+)
+test('miner-monitor', monitor_test,
+  # FIXME: why is this test so slow?
+  timeout: 180)
+
+priority_queue_test = executable('tracker-priority-queue-test',
+  'tracker-priority-queue-test.c',
+  dependencies: [tracker_common_dep, tracker_miner_dep],
+  c_args: test_c_args
+)
+test('miner-priority-queue', priority_queue_test)
+
+task_pool_test = executable('tracker-task-pool-test',
+  'tracker-task-pool-test.c',
+  dependencies: [tracker_common_dep, tracker_miner_dep],
+  c_args: test_c_args
+)
+test('miner-task-pool', task_pool_test)
+
+thumbnailer_test = executable('tracker-thumbnailer-test',
+  'empty-gobject.c',
+  'thumbnailer-mock.c',
+  'tracker-thumbnailer-test.c',
+  dependencies: [tracker_common_dep, tracker_miner_dep],
+  c_args: test_c_args
+)
+test('miner-thumbnailer', thumbnailer_test)
diff --git a/tests/libtracker-sparql/meson.build b/tests/libtracker-sparql/meson.build
new file mode 100644
index 0000000..91ab4a0
--- /dev/null
+++ b/tests/libtracker-sparql/meson.build
@@ -0,0 +1,19 @@
+test_c_args = ['-DTRACKER_COMPILATION']
+
+resource_test = executable('tracker-resource-test',
+  'tracker-resource-test.c',
+  dependencies: [tracker_common_dep, tracker_sparql_dep],
+  c_args: test_c_args)
+test('sparql-resource', resource_test)
+
+sparql_test = executable('tracker-sparql-test',
+  'tracker-sparql-test.c',
+  dependencies: [tracker_common_dep, tracker_sparql_dep],
+  c_args: test_c_args)
+test('sparql', sparql_test)
+
+gb_737023_test = executable('tracker-gb-737023-test',
+  'tracker-gb-737023.c',
+  dependencies: [tracker_common_dep, tracker_sparql_dep],
+  c_args: test_c_args)
+test('gb_737023', sparql_test)
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..0730a11
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,26 @@
+subdir('common')
+
+subdir('gvdb')
+subdir('libtracker-common')
+subdir('libtracker-data')
+
+if enable_extract
+  subdir('libtracker-extract')
+endif
+
+if enable_fts
+  subdir('libtracker-fts')
+endif
+
+subdir('libtracker-miner')
+subdir('libtracker-sparql')
+subdir('tracker-steroids')
+
+# The test case for writeback doesn't seem to work.
+#if enable_writeback
+#  subdir('tracker-writeback')
+#endif
+
+if get_option('functional_tests')
+  subdir('functional-tests')
+endif
diff --git a/tests/tracker-steroids/meson.build b/tests/tracker-steroids/meson.build
new file mode 100644
index 0000000..4cc69dc
--- /dev/null
+++ b/tests/tracker-steroids/meson.build
@@ -0,0 +1,7 @@
+test_c_args = ['-DTRACKER_COMPILATION']
+
+steroids_test = executable('tracker-steroids-test',
+  'tracker-test.c',
+  dependencies: [tracker_common_dep, tracker_sparql_dep],
+  c_args: test_c_args)
+test('steroids', steroids_test)
diff --git a/utils/meson.build b/utils/meson.build
new file mode 100644
index 0000000..c624b49
--- /dev/null
+++ b/utils/meson.build
@@ -0,0 +1,3 @@
+subdir('mtp')
+subdir('ontology')
+subdir('tracker-resdump')
diff --git a/utils/mtp/meson.build b/utils/mtp/meson.build
new file mode 100644
index 0000000..e5b180d
--- /dev/null
+++ b/utils/mtp/meson.build
@@ -0,0 +1,2 @@
+executable('mtp', 'mtp-dummy.c',
+    dependencies: [tracker_common_dep, tracker_sparql_dep])
diff --git a/utils/ontology/meson.build b/utils/ontology/meson.build
new file mode 100644
index 0000000..7ba45a1
--- /dev/null
+++ b/utils/ontology/meson.build
@@ -0,0 +1,7 @@
+executable('data-validator', 'data-validator.c',
+    dependencies: [tracker_common_dep, tracker_data_dep, tracker_sparql_dep],
+    c_args: ['-DTRACKER_COMPILATION'])
+
+executable('ontology-validator', 'ontology-validator.c',
+    dependencies: [tracker_common_dep, tracker_data_dep, tracker_sparql_dep],
+    c_args: ['-DTRACKER_COMPILATION'])
diff --git a/utils/tracker-resdump/meson.build b/utils/tracker-resdump/meson.build
new file mode 100644
index 0000000..ca1ce7a
--- /dev/null
+++ b/utils/tracker-resdump/meson.build
@@ -0,0 +1,2 @@
+executable('tracker-resdump', 'tracker-resdump.vala',
+    dependencies: [tracker_common_dep, tracker_sparql_dep, gee])


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