[tracker] meson: Avoid NetworkManager automagic dependency



commit 186d8b4cae176a6a540e9aaf1966c94751525531
Author: Quentin Glidic <sardemff7+git sardemff7 net>
Date:   Sun Dec 10 11:20:58 2017 +0100

    meson: Avoid NetworkManager automagic dependency
    
    https://bugzilla.gnome.org/show_bug.cgi?id=791433
    
    Signed-off-by: Quentin Glidic <sardemff7+git sardemff7 net>

 meson.build                      |   11 ++++++++---
 meson_options.txt                |    2 ++
 src/libtracker-miner/meson.build |    2 +-
 3 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/meson.build b/meson.build
index e293215..17173b2 100644
--- a/meson.build
+++ b/meson.build
@@ -28,7 +28,6 @@ icu_uc = dependency('icu-uc', version: '> 4.8.1.1', required: false)
 json_glib = dependency('json-glib-1.0', version: '>= 1.0', required: true)
 libsoup = dependency('libsoup-2.4', version: '> 2.40', required: true)
 libxml2 = dependency('libxml-2.0', version: '> 2.6')
-network_manager = dependency('libnm', required: false)
 sqlite = dependency('sqlite3', version: '>' + sqlite_required)
 
 libmath = cc.find_library('m', required: false)
@@ -48,6 +47,12 @@ add_project_arguments('-DTRACKER_COMPILATION', language: 'c')
 
 enable_fts = get_option('fts')
 
+have_network_manager = false
+if get_option('network_manager') != 'no'
+    network_manager = dependency('libnm', required: get_option('network_manager') == 'yes')
+    have_network_manager = network_manager.found()
+endif
+
 ##################################################################
 # Check for libtracker-common, make sure libstemmer exists
 ##################################################################
@@ -196,7 +201,7 @@ conf.set('HAVE_BUILTIN_FTS', sqlite3_has_builtin_fts5)
 conf.set('HAVE_LIBICU', unicode_library_name == 'icu')
 conf.set('HAVE_LIBSTEMMER', have_libstemmer)
 conf.set('HAVE_LIBUNISTRING', unicode_library_name == 'unistring')
-conf.set('HAVE_NETWORK_MANAGER', network_manager.found())
+conf.set('HAVE_NETWORK_MANAGER', have_network_manager)
 
 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>'))
@@ -300,7 +305,7 @@ summary = [
   '    Source code location:                   ' + meson.current_source_dir(),
   '    Compiler:                               ' + cc.get_id(),
   '\nFeature Support:',
-  '    Support for network status detection:   ' + network_manager.found().to_string(),
+  '    Support for network status detection:   ' + have_network_manager.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(
diff --git a/meson_options.txt b/meson_options.txt
index 05c65c9..b36ba1d 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -7,6 +7,8 @@ option('functional_tests', type: 'boolean', value: true,
 option('journal', type: 'boolean', value: true,
        description: 'Enable database journal backup mechanism')
 
+option('network_manager', type: 'combo', choices: ['auto', 'no', 'yes'], value: 'auto',
+       description: 'Enable connection detection through NetworkManager')
 option('stemmer', type: 'combo', choices: ['auto', 'no', 'yes'], value: 'auto',
        description: 'Enable stemming words while indexing')
 option('unicode_support', type: 'combo', choices: ['icu', 'unistring', 'auto'], value: 'auto',
diff --git a/src/libtracker-miner/meson.build b/src/libtracker-miner/meson.build
index 1647475..d3a8c7a 100644
--- a/src/libtracker-miner/meson.build
+++ b/src/libtracker-miner/meson.build
@@ -52,7 +52,7 @@ libtracker_miner_private = static_library(
 )
 
 tracker_miner_dependencies = []
-if network_manager.found()
+if have_network_manager
     tracker_miner_dependencies += network_manager
 endif
 


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