[tracker-miners/wip/sam/meson-subproject: 4/5] meson: Allow building Tracker core as a subproject



commit 76faa2d2d712bbc476f40af06930b898e93a9713
Author: Sam Thursfield <sam thursfield codethink co uk>
Date:   Thu Oct 19 20:25:26 2017 +0100

    meson: Allow building Tracker core as a subproject
    
    Both repos contain a libtracker-common target and we need to disable
    one of them. We use the one from tracker.git, but to work this requires
    a change in tracker.git that adds tracker-seccomp.c from this repo to
    the build.

 meson.build     |   15 +++++++++++++--
 src/meson.build |    6 +++++-
 2 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/meson.build b/meson.build
index b7b7a9d..183f02f 100644
--- a/meson.build
+++ b/meson.build
@@ -9,8 +9,19 @@ tracker_api_version = '2.0'
 
 glib_required = '2.40.0'
 
-tracker_sparql = dependency('tracker-sparql-2.0', version: '>= 1.99.0', required: true)
-tracker_miner = dependency('tracker-miner-2.0', version: '>= 1.99.0', required: true)
+tracker_sparql = dependency('tracker-sparql-2.0', version: '>= 1.99.0', required: false)
+tracker_miner = dependency('tracker-miner-2.0', version: '>= 1.99.0', required: false)
+
+if not tracker_sparql.found() or not tracker_miner.found()
+  message('Tracker libraries were not found or are too old. A local copy will be built if possible.')
+  tracker_subproject = subproject('tracker')
+
+  tracker_sparql = tracker_subproject.get_variable('tracker_sparql_dep')
+  tracker_miner = tracker_subproject.get_variable('tracker_miner_dep')
+else
+  tracker_subproject = false
+endif
+
 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)
diff --git a/src/meson.build b/src/meson.build
index 8aeeae3..096ccf0 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,5 +1,9 @@
 # Shared common code
-subdir('libtracker-common')
+if tracker_subproject == false
+  subdir('libtracker-common')
+else
+  tracker_common_dep = tracker_subproject.get_variable('tracker_common_dep')
+endif
 
 # Internal data extraction helpers
 subdir('libtracker-extract')


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