[recipes/meson2: 15/19] meson: Add options for autoar/canberra/gspell



commit 5ac61bc5f29727e0ff59935a0e088d91303ea359
Author: Nirbheek Chauhan <nirbheek centricular com>
Date:   Sat Feb 18 23:24:33 2017 +0530

    meson: Add options for autoar/canberra/gspell

 meson.build       |   41 +++++++++++++++++++++++++++++------------
 meson_options.txt |    3 +++
 2 files changed, 32 insertions(+), 12 deletions(-)
---
diff --git a/meson.build b/meson.build
index b3e9f96..3082943 100644
--- a/meson.build
+++ b/meson.build
@@ -26,22 +26,39 @@ else
   conf.set_quoted('LIBGD_INFO', 'unknown')
 endif
 
-autoar_dep = dependency('gnome-autoar-0', required : false)
-if autoar_dep.found()
-  conf.set('ENABLE_AUTOAR', true)
-  conf.set_quoted('AUTOAR_VERSION', autoar_dep.version())
+# Options + dependency checking is overly verbose and repetitive right now, but
+# there is work ongoing to fix it: https://github.com/mesonbuild/meson/pull/1330
+autoar_dep = []
+if get_option('autoar') != 'no'
+  autoar_dep = dependency('gnome-autoar-0', required : false)
+  if autoar_dep.found()
+    conf.set('ENABLE_AUTOAR', true)
+    conf.set_quoted('AUTOAR_VERSION', autoar_dep.version())
+  elif get_option('autoar') == 'yes'
+    error('Support for gnome-autoar was requested but not found')
+  endif
 endif
 
-gspell_dep = dependency('gspell-1', required : false)
-if gspell_dep.found()
-  conf.set('ENABLE_GSPELL', true)
-  conf.set_quoted('GSPELL_VERSION', gspell_dep.version())
+gspell_dep = []
+if get_option('gspell') != 'no'
+  gspell_dep = dependency('gspell-1', required : false)
+  if gspell_dep.found()
+    conf.set('ENABLE_GSPELL', true)
+    conf.set_quoted('GSPELL_VERSION', gspell_dep.version())
+  elif get_option('gspell') == 'yes'
+    error('Support for gspell was requested but not found')
+  endif
 endif
 
-canberra_dep = dependency('libcanberra', required : false)
-if canberra_dep.found()
-  conf.set('ENABLE_CANBERRA', true)
-  conf.set_quoted('CANBERRA_VERSION', canberra_dep.version())
+canberra_dep = []
+if get_option('canberra') != 'no'
+  canberra_dep = dependency('libcanberra', required : false)
+  if canberra_dep.found()
+    conf.set('ENABLE_CANBERRA', true)
+    conf.set_quoted('CANBERRA_VERSION', canberra_dep.version())
+  elif get_option('canberra') == 'yes'
+    error('Support for canberra was requested but not found')
+  endif
 endif
 
 deps = [ dependency('gtk+-3.0'),
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..14312f8
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,3 @@
+option('autoar', type : 'combo', choices : ['auto', 'yes', 'no'], default : 'auto')
+option('gspell', type : 'combo', choices : ['auto', 'yes', 'no'], default : 'auto')
+option('canberra', type : 'combo', choices : ['auto', 'yes', 'no'], default : 'auto')


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