[nautilus] build: Fix tracker detection



commit 4ac20d7b6a032a654128e7e51bb141bd04d46c24
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Jul 14 11:24:30 2017 +0200

    build: Fix tracker detection
    
    Make sure that tracker-sparql is optional and auto-detected by default
    and that tracker-sparql-1.0 is still supported.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=784940

 meson.build       |   10 +++++++---
 meson_options.txt |    5 +++--
 src/meson.build   |    4 ++--
 3 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/meson.build b/meson.build
index 85c3cb9..4160c8f 100644
--- a/meson.build
+++ b/meson.build
@@ -81,9 +81,13 @@ if get_option ('enable-selinux')
     conf.set10 ('HAVE_SELINUX', true)
 endif
 
-if get_option ('enable-tracker')
-    tracker_sparql = dependency ('tracker-sparql-2.0')
-    conf.set10 ('ENABLE_TRACKER', true)
+tracker_option = get_option ('enable-tracker')
+if tracker_option != 'no'
+    tracker_sparql = dependency ('tracker-sparql-2.0', required: (tracker_option == 'yes'))
+    if not tracker_sparql.found()
+      tracker_sparql = dependency ('tracker-sparql-1.0', required: (tracker_option == 'yes'))
+    endif
+    conf.set10 ('ENABLE_TRACKER', tracker_sparql.found())
 endif
 
 if get_option ('enable-xmp')
diff --git a/meson_options.txt b/meson_options.txt
index ac4b74a..4e2880a 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -22,8 +22,9 @@ option ('enable-packagekit',
         type: 'boolean',
         value: true)
 option ('enable-tracker',
-        type: 'boolean',
-        value: true)
+        type: 'combo',
+        choices: ['yes', 'no', 'auto'],
+        value: 'auto')
 option ('enable-gtk-doc',
         type: 'boolean',
         value: false)
diff --git a/src/meson.build b/src/meson.build
index 83723b9..dd49350 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -258,7 +258,7 @@ libnautilus_sources = [
     'nautilus-file-undo-manager.h'
 ]
 
-if get_option ('enable-tracker')
+if tracker_sparql.found()
     libnautilus_sources += ['nautilus-batch-rename-dialog.c',
                             'nautilus-batch-rename-dialog.h',
                             'nautilus-batch-rename-utilities.c',
@@ -284,7 +284,7 @@ if get_option ('enable-exif')
     nautilus_deps += exif
 endif
 
-if get_option ('enable-tracker')
+if tracker_sparql.found()
     nautilus_deps += tracker_sparql
 endif
 


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