[Spice-devel] [PATCH spice-gtk 18/34] meson: switch polkit option to auto feature

marcandre.lureau at redhat.com marcandre.lureau at redhat.com
Mon Jan 7 08:00:47 UTC 2019


From: Marc-André Lureau <marcandre.lureau at redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
---
 meson.build       | 32 +++++++++++++++-----------------
 meson_options.txt |  3 +--
 2 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/meson.build b/meson.build
index 18e330f..07e8227 100644
--- a/meson.build
+++ b/meson.build
@@ -186,26 +186,24 @@ endif
 
 # polkit
 spice_gtk_has_polkit = false
-if get_option('polkit')
-  polkit_dep = dependency('polkit-gobject-1', version : '>= 0.96')# ,required : false)
-  if polkit_dep.found()
-    spice_gtk_policy_dir = polkit_dep.get_pkgconfig_variable('policydir')
-    foreach func : ['polkit_authority_get_sync', 'polkit_authorization_result_get_dismissed']
-      if compiler.has_function(func, dependencies : polkit_dep)
-        spice_gtk_config_data.set('HAVE_ at 0@'.format(func.to_upper()), '1')
-      endif
-    endforeach
-
-    if not compiler.has_function('acl_get_file')
-      acl_dep = compiler.find_library('acl')
-      if not compiler.has_function('acl_get_file', dependencies : acl_dep)
-        error('PolicyKit support requested, but some required packages are not available')
-      endif
-      spice_acl_deps += acl_dep
+d = dependency('polkit-gobject-1', version : '>= 0.96', required : get_option('polkit'))
+if d.found()
+  spice_gtk_policy_dir = d.get_pkgconfig_variable('policydir')
+  foreach func : ['polkit_authority_get_sync', 'polkit_authorization_result_get_dismissed']
+    if compiler.has_function(func, dependencies : d)
+      spice_gtk_config_data.set('HAVE_ at 0@'.format(func.to_upper()), '1')
+    endif
+  endforeach
+
+  if not compiler.has_function('acl_get_file')
+    acl_dep = compiler.find_library('acl')
+    if not compiler.has_function('acl_get_file', dependencies : acl_dep)
+      error('PolicyKit support requested, but some required packages are not available')
     endif
+    spice_acl_deps += acl_dep
   endif
 
-  spice_acl_deps += polkit_dep
+  spice_acl_deps += d
   spice_acl_deps += dependency('gio-unix-2.0')
   spice_gtk_config_data.set('USE_POLKIT', '1')
   spice_gtk_has_polkit = true
diff --git a/meson_options.txt b/meson_options.txt
index 6aab3af..889c976 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -20,8 +20,7 @@ option('usbredir',
     description : 'Enable usbredir support')
 
 option('polkit',
-    type : 'boolean',
-    value : true,
+    type : 'feature',
     description : 'Enable PolicyKit support for the USB acl helper')
 
 option('pie',
-- 
2.20.1.2.gb21ebb671b



More information about the Spice-devel mailing list