[tracker: 1/2] build: Use meson feature option type where appropriate



commit cfab5f96042d31f603cf176e408269ec60fe581b
Author: Mart Raudsepp <leio gentoo org>
Date:   Thu Feb 14 21:27:17 2019 +0200

    build: Use meson feature option type where appropriate

 meson.build                       | 22 +++++++---------------
 meson_options.txt                 |  8 ++++----
 src/libtracker-common/meson.build |  6 +-----
 3 files changed, 12 insertions(+), 24 deletions(-)
---
diff --git a/meson.build b/meson.build
index 10bb5d1bd..ca2073253 100644
--- a/meson.build
+++ b/meson.build
@@ -1,4 +1,6 @@
-project('tracker', 'c', 'vala', version: '2.2.0-alpha2')
+project('tracker', 'c', 'vala',
+        version: '2.2.0-alpha2',
+        meson_version: '>=0.47')
 
 gnome = import('gnome')
 i18n = import('i18n')
@@ -66,25 +68,15 @@ 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
+network_manager = dependency('libnm', required: get_option('network_manager'))
+have_network_manager = network_manager.found()
 
 ##################################################################
 # Check for libtracker-common, make sure libstemmer exists
 ##################################################################
 
-have_libstemmer = false
-if get_option('stemmer') != 'no'
-    libstemmer = cc.find_library('stemmer', required: false)
-    if libstemmer.found()
-        have_libstemmer = true
-    elif get_option('stemmer') == 'yes'
-        error('stemmer support explicitly requested, but stemmer library couldn\'t be found')
-    endif
-endif
+libstemmer = cc.find_library('stemmer', required: get_option('stemmer'))
+have_libstemmer = libstemmer.found()
 
 ##################################################################
 # Check for tracker-fts, allow disabling FTS support
diff --git a/meson_options.txt b/meson_options.txt
index b36ba1d1e..9443b8b1e 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -7,10 +7,10 @@ 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('network_manager', type: 'feature', value: 'auto',
+       description: 'Connection detection through NetworkManager')
+option('stemmer', type: 'feature', value: 'auto',
+       description: 'Stemming words while indexing')
 option('unicode_support', type: 'combo', choices: ['icu', 'unistring', 'auto'], value: 'auto',
        description: 'Unicode support library to use')
 
diff --git a/src/libtracker-common/meson.build b/src/libtracker-common/meson.build
index 3e53ee3bd..e2a1ad34b 100644
--- a/src/libtracker-common/meson.build
+++ b/src/libtracker-common/meson.build
@@ -31,11 +31,7 @@ else
 endif
 
 # FIXME: need to link against -lkvm on OpenBSD, see configure.ac
-tracker_common_dependencies = [glib, gio, gio_unix, libmath]
-
-if have_libstemmer
-  tracker_common_dependencies += [libstemmer]
-endif
+tracker_common_dependencies = [glib, gio, gio_unix, libmath, libstemmer]
 
 libtracker_common = library('tracker-common',
   tracker_common_sources,


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