[rhythmbox/mesonjunk: 2/9] build: don't use feature.allowed() around dependency checks
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox/mesonjunk: 2/9] build: don't use feature.allowed() around dependency checks
- Date: Sun, 29 May 2022 12:03:45 +0000 (UTC)
commit 2268d69a1dd57ab7a74cba6aff753b610dc2a98a
Author: Jonathan Matthew <jonathan d14n org>
Date: Tue May 17 08:18:21 2022 +1000
build: don't use feature.allowed() around dependency checks
When the feature specified as the 'required' parameter to dependency()
is disabled, it returns an empty dependency object, which is much easier
to deal with than a dependency variable that's only conditionally
defined.
Fixes: #1972
meson.build | 94 ++++++++++++++++++++++++-------------------------------------
1 file changed, 37 insertions(+), 57 deletions(-)
---
diff --git a/meson.build b/meson.build
index 5792b0e49..de265901b 100644
--- a/meson.build
+++ b/meson.build
@@ -70,71 +70,52 @@ tdb = dependency('tdb', version: '>= 1.2.6', required: true)
totem_plparser = dependency('totem-plparser', version: '>= 3.2.0', required: true)
use_gudev = false
-if get_option('gudev').allowed()
- gudev = dependency('gudev-1.0', version: '>= 143', required: get_option('gudev'))
- if gudev.found()
- use_gudev = true
- cdata.set('HAVE_GUDEV', 1)
- endif
+gudev = dependency('gudev-1.0', version: '>= 143', required: get_option('gudev'))
+if gudev.found()
+ use_gudev = true
+ cdata.set('HAVE_GUDEV', 1)
endif
use_ipod = false
-if get_option('ipod').allowed()
- libgpod = dependency('libgpod-1.0', version: '>= 0.7.92', required: get_option('ipod'))
- if libgpod.found()
- use_ipod = true
- endif
+libgpod = dependency('libgpod-1.0', version: '>= 0.7.92', required: get_option('ipod'))
+if libgpod.found()
+ use_ipod = true
endif
use_mtp = false
-if get_option('mtp').allowed()
- libmtp = dependency('libmtp', version: '>= 0.3.0', required: get_option('mtp'))
-
- if libmtp.found()
- if use_gudev
- use_mtp = true
- elif get_option('mtp').enabled()
- error('MTP explicitly requested but GUdev is not available')
- endif
+libmtp = dependency('libmtp', version: '>= 0.3.0', required: get_option('mtp'))
+if libmtp.found()
+ if use_gudev
+ use_mtp = true
+ elif get_option('mtp').enabled()
+ error('MTP explicitly requested but GUdev is not available')
endif
endif
use_notify = false
-if get_option('libnotify').allowed()
- libnotify = dependency('libnotify', version: '>= 0.7.0', required: get_option('libnotify'))
-
- if libnotify.found()
- use_notify = true
- endif
+libnotify = dependency('libnotify', version: '>= 0.7.0', required: get_option('libnotify'))
+if libnotify.found()
+ use_notify = true
endif
use_libsecret = false
-if get_option('libsecret').allowed()
- libsecret = dependency('libsecret-1', version: '>= 0.18', required: get_option('libsecret'))
-
- if libsecret.found()
- use_libsecret = true
- endif
+libsecret = dependency('libsecret-1', version: '>= 0.18', required: get_option('libsecret'))
+if libsecret.found()
+ use_libsecret = true
endif
cdata.set('PY_LIBSECRET_ENABLED', use_libsecret)
cdata.set('WITH_LIBSECRET', use_libsecret)
use_lirc = false
-if get_option('lirc').allowed()
- lirc = dependency('lirc', required: get_option('lirc'))
-
- if lirc.found()
- use_lirc = true
- endif
+lirc = dependency('lirc', required: get_option('lirc'))
+if lirc.found()
+ use_lirc = true
endif
have_libbrasero_media = false
-if get_option('brasero').allowed()
- brasero_media = dependency('libbrasero-media3', version: '>= 2.31.5', required: get_option('brasero'))
-
- if brasero_media.found()
- have_libbrasero_media = true
- endif
+brasero_media = dependency('libbrasero-media3', version: '>= 2.31.5', required: get_option('brasero'))
+if brasero_media.found()
+ have_libbrasero_media = true
endif
have_gnu_fwrite_unlocked = false
@@ -189,16 +170,16 @@ cdata.set('PLUGINDATADIR', plugindatadir)
cdata.set('SAMPLEPLUGINDIR', libdir / 'rhythmbox' / 'sample-plugins')
enable_python = false
-if get_option('plugins_python').allowed()
- python = find_program('python3', required: get_option('plugins_python'))
- pygobject = dependency('pygobject-3.0', version: '>= 3.0.0', required: get_option('plugins_python'))
- pyoverridesdir = run_command([python, '-c', '''import gi; print(gi._overridesdir)'''], check:
true).stdout().strip()
+python = find_program('python3', required: get_option('plugins_python'))
+pygobject = dependency('pygobject-3.0', version: '>= 3.0.0', required: get_option('plugins_python'))
+pyoverridesdir = run_command([python, '-c', '''import gi; print(gi._overridesdir)'''], check:
true).stdout().strip()
+if python.found() and pygobject.found()
enable_python = true
endif
enable_vala = false
-if get_option('plugins_vala').allowed()
- vala_found = add_languages('vala', required: get_option('plugins_vala'), native: false)
+vala_found = add_languages('vala', required: get_option('plugins_vala'), native: false)
+if vala_found
enable_vala = true
vapi_dir = meson.current_source_dir() / 'bindings' / 'vala'
add_project_arguments(['--vapidir', vapi_dir], language: 'vala')
@@ -231,12 +212,9 @@ if get_option('daap').allowed()
endif
enable_grilo = false
-if get_option('grilo').allowed()
- grilo = dependency('grilo-0.3', version: '>= 0.3.1', required: get_option('grilo'))
-
- if grilo.found()
- enable_grilo = true
- endif
+grilo = dependency('grilo-0.3', version: '>= 0.3.1', required: get_option('grilo'))
+if grilo.found()
+ enable_grilo = true
endif
enable_check = false
@@ -279,7 +257,9 @@ summary({'iPod integration': use_ipod,
'Python plugin support': enable_python,
'Vala plugin support': enable_vala,
'Libsecret keyring support': use_libsecret,
- 'FM radio support': enable_fm_radio,},
+ 'FM radio support': enable_fm_radio,
+ 'Grilo support': enable_grilo,
+ },
section: 'Plugins')
configinc = include_directories('.')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]