[tracker/wip/sam/meson: 90/92] WIP: more Meson work



commit 4bd0cc78ace9a360b9fe27ed114d2ad0b9e5011a
Author: Sam Thursfield <ssssam gmail com>
Date:   Sun Mar 27 15:28:12 2016 +0100

    WIP: more Meson work
    
    Right now I'm stuck at linking Vala code against libuuid: Meson seems
    to pass `--pkg uuid`, but Vala expects `--pkg libuuid`. Perhaps there's
    a bug here when the pkg-config name doesn't match the Vapi name.

 .gitignore        |    1 +
 config.h.meson.in |    9 +++++
 meson.build       |   90 +++++++++++++++++++++++++++++++++++++++++++---------
 3 files changed, 84 insertions(+), 16 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..b075fdd
--- /dev/null
+++ b/config.h.meson.in
@@ -0,0 +1,9 @@
+#mesondefine HAVE_LIBMEDIAART
+
+#define GETTEXT_PACKAGE "@GETTEXT_PACKAGE@"
+
+#define LOCALEDIR "@LOCALEDIR@"
+
+#define PACKAGE_VERSION "@PACKAGE_VERSION@"
+
+#define TRACKER_UI_DIR "@TRACKER_UI_DIR@"
diff --git a/meson.build b/meson.build
index 2d251e5..ceb2a15 100644
--- a/meson.build
+++ b/meson.build
@@ -1,18 +1,19 @@
 # Experimental, incomplete build instructions for Tracker using
 # Meson: http://www.mesonbuild.com/
-#
-# Note that I don't really like this Python-like DSL and would much
-# rather represent the build instructions as YAML. That's a future
-# project though which requires changes to Meson.
 
-project('tracker', 'c', version: '1.8.0')
+project('tracker', 'c', 'vala', version: '1.8.0')
+
+# 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 = dependency('sqlite3', version: '> 3.7.9')
+sqlite_required = '3.7.9'
 
 cairo = dependency('cairo', version: '> 1.0')
 camel = dependency('camel-1.2', version: '> 2.32.0', required: false)
@@ -23,8 +24,10 @@ 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_unix = dependency('gio-unix-2.0', version: '> 2.40.0')
-glib = dependency('glib-2.0', version: '> 2.40.0')
+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)
+gobject = dependency('gobject-2.0', version: '>' + glib_required)
 gstreamer = dependency('gstreamer-1.0', version: '> 0.10.31', required: false)
 gstreamer_tag = dependency('gstreamer-tag-1.0', version: '> 0.10.31', required: false)
 gtk3 = dependency('gtk+-3.0', version: '> 3.0.0', required: false)
@@ -45,25 +48,80 @@ libvorbis = dependency('vorbisfile', version: '> 0.22')
 meegotouch = dependency('meegotouch', version: '> 0.20', 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)
 uuid = dependency('uuid')
 upower = dependency('libupower-glib', version: '> 0.9.0', required: false)
-
 zlib = dependency('zlib')
 
-# FIXME: libgif doesn't have a pkg-config file, how do we deal with that?
-libgif = dependency('libgif', required: false)
-
-# FIXME: libjpeg doesn't have a pkg-config file, how do we deal with that?
-libjpeg = dependency('libjpeg', required: false)
+# These two don't have pkg-config files.
+libgif = meson.get_compiler('c').find_library('libgif', required: false)
+libjpeg = meson.get_compiler('c').find_library('libjpeg', required: false)
 
 conf = configuration_data()
+conf.set('GETTEXT_PACKAGE', 'tracker')
+conf.set('HAVE_LIBMEDIAART', libmediaart.found())
+conf.set('LOCALEDIR', get_option('localedir'))
 conf.set('PACKAGE_VERSION', meson.project_version())
+conf.set('TRACKER_UI_DIR', get_option('datadir') + '/tracker/')
 configure_file(input: 'config.h.meson.in',
                output: 'config.h',
                configuration: conf)
 
+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'])
+
+# Vala part needs linking separately because the C part depends on
+# 'uuid', but libuuid isn't available as a package for Vala.
+# FIXME: That doesn't work though because then the Vala name of the
+# package is wrong...
+libtracker_sparql_vala = static_library(
+    'libtracker-sparql-vala',
+    'src/libtracker-sparql/tracker-builder.vala',
+    'src/libtracker-sparql/tracker-connection.vala',
+    'src/libtracker-sparql/tracker-cursor.vala',
+    'src/libtracker-sparql/tracker-namespace.vala',
+    'src/libtracker-sparql/tracker-utils.vala',
+    dependencies: [gio, glib, gobject],
+    vala_args: [
+        '--debug',
+        '--library', 'tracker-sparql-' + tracker_api_version,
+        '--pkg', 'posix',
+        '--target-glib', glib_required,
+        '--vapi', 'tracker-sparql.vapi'],
+)
+
+libtracker_sparql = library(
+    'libtracker-sparql',
+    'src/libtracker-sparql/tracker-uri.c',
+    'src/libtracker-sparql/tracker-version.c',
+    c_args: ['-DTRACKER_COMPILATION'],
+    dependencies: [gio, glib, gobject, uuid],
+    link_with: libtracker_sparql_vala
+)
+
 executable(
     'tracker-needle',
-    'src/tracker-needle/tracker-needle.c',
-    dependencies: gtk3)
+    'src/tracker-needle/config.vapi',
+    'src/tracker-needle/tracker-needle.vala',
+    'src/tracker-needle/tracker-history.vala',
+    'src/tracker-needle/tracker-needle.vala',
+    'src/tracker-needle/tracker-query.vala',
+    'src/tracker-needle/tracker-result-store.vala',
+    'src/tracker-needle/tracker-stats.vala',
+    'src/tracker-needle/tracker-tags-view.vala',
+    'src/tracker-needle/tracker-utils.vala',
+    'src/tracker-needle/tracker-view.vala',
+    dependencies: [gtk3],
+    # FIXME: we shouldn't need to specify libtracker-sparql-vala here,
+    # surely? It's linked against libtracker-sparql already...
+    link_with: [libtracker_sparql, libtracker_sparql_vala],
+    c_args: [
+        '-DSRCDIR="' + meson.current_source_dir() + '"',
+        '-include', 'config.h'
+    ]
+)


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