[Spice-commits] 5 commits - configure.ac .gitlab-ci.yml meson.build meson_options.txt src/desktop-integration.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jan 14 10:59:55 UTC 2019


 .gitlab-ci.yml            |    4 --
 configure.ac              |   15 ---------
 meson.build               |   72 +++++++++++++++++++++++-----------------------
 meson_options.txt         |   14 ++------
 src/desktop-integration.c |   37 ++++++++++++-----------
 5 files changed, 61 insertions(+), 81 deletions(-)

New commits:
commit 0b6529afd2d396d7b403cb267dc7246fea216c61
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Fri Jan 4 23:38:10 2019 +0400

    meson: switch vapi to auto feature
    
    Removed unused vapigen/vapidir variables as well.
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
    Acked-by: Victor Toso <victortoso at redhat.com>

diff --git a/meson.build b/meson.build
index 3eb90ea..acd5dca 100644
--- a/meson.build
+++ b/meson.build
@@ -296,10 +296,11 @@ endif
 
 # vala (depends on introspection)
 spice_gtk_has_vala = false
-if spice_gtk_has_introspection and get_option('vapi')
-  vapigen_dep = dependency('vapigen')
-  vapidir = vapigen_dep.get_pkgconfig_variable('vapidir')
-  vapigen = dependency('vapigen').get_pkgconfig_variable('vapigen')
+d = dependency('vapigen', required : get_option('vapi'))
+if d.found()
+  if not spice_gtk_has_introspection
+    error('VAPI support requested without introspection')
+  endif
   spice_gtk_has_vala = true
 endif
 
diff --git a/meson_options.txt b/meson_options.txt
index 1397664..b7386a6 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -54,8 +54,7 @@ option('introspection',
     description: 'Check for GObject instrospection requirements')
 
 option('vapi',
-    type : 'boolean',
-    value : true,
+    type : 'feature',
     description: 'Check for vala requirements')
 
 option('alignment-checks',
commit 68d2b9870d3aef3925ba6823f46d92203b59e56f
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Fri Jan 4 23:31:37 2019 +0400

    meson: choose a better default coroutine
    
    Let's have a new 'auto' default value, and use winfibers on Windows.
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
    Acked-by: Victor Toso <victortoso at redhat.com>

diff --git a/meson.build b/meson.build
index 7bf5cdd..3eb90ea 100644
--- a/meson.build
+++ b/meson.build
@@ -258,17 +258,26 @@ endif
 
 # coroutine
 spice_gtk_coroutine = get_option('coroutine')
-if spice_gtk_coroutine == 'ucontext'
-  if compiler.has_function('makecontext') and compiler.has_function('swapcontext') and compiler.has_function('getcontext')
-    spice_gtk_config_data.set('WITH_UCONTEXT', '1')
-    if host_machine.system() == 'darwin'
-      spice_gtk_config_data.set('_XOPEN_SOURCE', '1')
-    endif
+if spice_gtk_coroutine == 'auto'
+  if host_machine.system() == 'windows'
+    spice_gtk_coroutine = 'winfiber'
   else
-    spice_gtk_coroutine = 'gthread'
+    spice_gtk_coroutine = 'ucontext'
   endif
 endif
 
+if spice_gtk_coroutine == 'ucontext'
+  foreach f : ['makecontext', 'swapcontext', 'getcontext']
+    if not compiler.has_function(f)
+      error('Function missing:' + f)
+    endif
+  endforeach
+  spice_gtk_config_data.set('WITH_UCONTEXT', '1')
+  if host_machine.system() == 'darwin'
+    spice_gtk_config_data.set('_XOPEN_SOURCE', '1')
+  endif
+  endif
+
 if spice_gtk_coroutine == 'gthread'
   spice_gtk_config_data.set('WITH_GTHREAD', '1')
 endif
diff --git a/meson_options.txt b/meson_options.txt
index 09cab1e..1397664 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -45,7 +45,8 @@ option('usb-ids-path',
 
 option('coroutine',
     type : 'combo',
-    choices : ['ucontext', 'gthread', 'winfiber'],
+    value : 'auto',
+    choices : ['auto', 'ucontext', 'gthread', 'winfiber'],
     description : 'Use ucontext or GThread for coroutines')
 
 option('introspection',
commit 13c9cc173f63c2863e18710af8c3d77bd3811d8f
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Fri Jan 4 21:49:38 2019 +0400

    build-sys: remove dbus option
    
    Let's have GNOME desktop integration enabled by default (unless
    Windows or Mac)
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
    Acked-by: Victor Toso <victortoso at redhat.com>

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e5a10a2..14e1cc1 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -39,15 +39,13 @@ makecheck_simple:
         --enable-pulse=no
         --enable-smartcard=no
         --enable-usbredir=no
-        --enable-dbus=no
   - make -j4
   - make check
 
 makecheck_simple-meson:
   script:
   - meson build -Dauto_features=disabled
-                -Dgstvideo=false
-                -Ddbus=false || (cat build/meson-logs/meson-log.txt && exit 1)
+                -Dgstvideo=false || (cat build/meson-logs/meson-log.txt && exit 1)
   - ninja -C build
   - (cd build && meson test) || (cat build/meson-logs/testlog.txt && exit 1)
 
diff --git a/configure.ac b/configure.ac
index 85827b1..bba13fb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -470,20 +470,6 @@ AM_CONDITIONAL(WITH_VALA, [test "x$enable_vala" = "xyes"])
 VAPIDIR="${datadir}/vala/vapi"
 AC_SUBST(VAPIDIR)
 
-AC_ARG_ENABLE([dbus],
-  AS_HELP_STRING([--enable-dbus=@<:@auto/yes/no@:>@],
-                 [Enable dbus support for desktop integration (disabling automount) @<:@default=auto@:>@]),
-  [],
-  [enable_dbus="auto"])
-
-have_dbus=no
-if test "x$enable_dbus" != "xno"; then
-  AC_DEFINE([USE_GDBUS], [1], [Define if supporting gdbus])
-  have_dbus=yes
-else
-  SPICE_WARNING([No D-Bus support, desktop integration and USB redirection may not work properly])
-fi
-
 AC_ARG_ENABLE([alignment-checks],
   AS_HELP_STRING([--enable-alignment-checks],
                  [Enable runtime checks for cast alignment @<:@default=no@:>@]),
@@ -551,7 +537,6 @@ AC_MSG_NOTICE([
         SASL support:             ${have_sasl}
         Smartcard support:        ${have_smartcard}
         USB redirection support:  ${have_usbredir} ${with_usbredir_hotplug}
-        DBus:                     ${have_dbus}
         WebDAV support:           ${have_phodav}
         LZ4 support:              ${have_lz4}
 
diff --git a/meson.build b/meson.build
index 39d6b91..7bf5cdd 100644
--- a/meson.build
+++ b/meson.build
@@ -294,13 +294,6 @@ if spice_gtk_has_introspection and get_option('vapi')
   spice_gtk_has_vala = true
 endif
 
-# dbus
-if get_option('dbus')
-  spice_gtk_config_data.set('USE_GDBUS', '1')
-else
-  warning('No D-Bus support, desktop integration and USB redirection may not work properly')
-endif
-
 # lz4
 spice_gtk_has_lz4 = false
 d = dependency('liblz4', required : get_option('lz4'))
diff --git a/meson_options.txt b/meson_options.txt
index 605cd7a..09cab1e 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -57,11 +57,6 @@ option('vapi',
     value : true,
     description: 'Check for vala requirements')
 
-option('dbus',
-    type : 'boolean',
-    value : true,
-    description: 'Enable dbus support for desktop integration (disabling automount)')
-
 option('alignment-checks',
     type : 'boolean',
     value : false,
diff --git a/src/desktop-integration.c b/src/desktop-integration.c
index 4d0a9b6..8458efa 100644
--- a/src/desktop-integration.c
+++ b/src/desktop-integration.c
@@ -30,7 +30,7 @@
 
 #define GNOME_SESSION_INHIBIT_AUTOMOUNT 16
 
-#if defined(USE_GDBUS) && defined(G_OS_UNIX) && !__APPLE__
+#if defined(G_OS_UNIX) && !__APPLE__
 # define WITH_GNOME
 #endif
 
commit 0d621d00052025ec43050e281346e3b001717841
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Fri Jan 4 19:42:27 2019 +0400

    meson: switch polkit option to auto feature
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
    Acked-by: Victor Toso <victortoso at redhat.com>

diff --git a/meson.build b/meson.build
index 9ca579b..39d6b91 100644
--- a/meson.build
+++ b/meson.build
@@ -201,26 +201,25 @@ 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
+
+  # TODO:  With 'auto', we should just disable polkit support if this is missing.
+  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 eaaf739..605cd7a 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -25,8 +25,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',
commit 752f7f949191087ec651199d56e91c345afd8d9a
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Wed Jan 9 01:34:24 2019 +0400

    desktop: compile out GNOME support if host is Windows or Mac
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
    Acked-by: Victor Toso <victortoso at redhat.com>

diff --git a/src/desktop-integration.c b/src/desktop-integration.c
index 8a9d5ca..4d0a9b6 100644
--- a/src/desktop-integration.c
+++ b/src/desktop-integration.c
@@ -30,20 +30,22 @@
 
 #define GNOME_SESSION_INHIBIT_AUTOMOUNT 16
 
+#if defined(USE_GDBUS) && defined(G_OS_UNIX) && !__APPLE__
+# define WITH_GNOME
+#endif
+
 struct _SpiceDesktopIntegrationPrivate {
-#if defined(USE_GDBUS)
+#ifdef WITH_GNOME
     GDBusProxy *gnome_session_proxy;
-#else
-    GObject *gnome_session_proxy; /* dummy */
-#endif
     guint gnome_automount_inhibit_cookie;
+#endif
 };
 
 G_DEFINE_TYPE_WITH_PRIVATE(SpiceDesktopIntegration, spice_desktop_integration, G_TYPE_OBJECT)
 
 /* ------------------------------------------------------------------ */
 /* Gnome specific code                                                */
-
+#ifdef WITH_GNOME
 static void handle_dbus_call_error(const char *call, GError **_error)
 {
     GError *error = *_error;
@@ -53,15 +55,13 @@ static void handle_dbus_call_error(const char *call, GError **_error)
     g_clear_error(_error);
 }
 
-G_GNUC_UNUSED
 static gboolean gnome_integration_init(SpiceDesktopIntegration *self)
 {
-    G_GNUC_UNUSED SpiceDesktopIntegrationPrivate *priv = self->priv;
+    SpiceDesktopIntegrationPrivate *priv = self->priv;
     GError *error = NULL;
     gboolean success = TRUE;
-
-#if defined(USE_GDBUS)
     gchar *name_owner = NULL;
+
     priv->gnome_session_proxy =
         g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION,
                                       G_DBUS_PROXY_FLAGS_NONE,
@@ -77,9 +77,6 @@ static gboolean gnome_integration_init(SpiceDesktopIntegration *self)
         success = FALSE;
     }
     g_free(name_owner);
-#else
-    success = FALSE;
-#endif
 
     if (error) {
         g_warning("Could not create org.gnome.SessionManager dbus proxy: %s",
@@ -95,7 +92,7 @@ static void gnome_integration_inhibit_automount(SpiceDesktopIntegration *self)
 {
     SpiceDesktopIntegrationPrivate *priv = self->priv;
     GError *error = NULL;
-    G_GNUC_UNUSED const gchar *reason =
+    const gchar *reason =
         _("Automounting has been inhibited for USB auto-redirecting");
 
     if (!priv->gnome_session_proxy)
@@ -103,7 +100,6 @@ static void gnome_integration_inhibit_automount(SpiceDesktopIntegration *self)
 
     g_return_if_fail(priv->gnome_automount_inhibit_cookie == 0);
 
-#if defined(USE_GDBUS)
     GVariant *v = g_dbus_proxy_call_sync(priv->gnome_session_proxy,
                 "Inhibit",
                 g_variant_new("(susu)",
@@ -116,7 +112,7 @@ static void gnome_integration_inhibit_automount(SpiceDesktopIntegration *self)
         g_variant_get(v, "(u)", &priv->gnome_automount_inhibit_cookie);
 
     g_clear_pointer(&v, g_variant_unref);
-#endif
+
     if (error)
         handle_dbus_call_error("org.gnome.SessionManager.Inhibit", &error);
 }
@@ -133,14 +129,12 @@ static void gnome_integration_uninhibit_automount(SpiceDesktopIntegration *self)
     if (priv->gnome_automount_inhibit_cookie == 0)
         return;
 
-#if defined(USE_GDBUS)
     GVariant *v = g_dbus_proxy_call_sync(priv->gnome_session_proxy,
                 "Uninhibit",
                 g_variant_new("(u)",
                               priv->gnome_automount_inhibit_cookie),
                 G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
     g_clear_pointer(&v, g_variant_unref);
-#endif
     if (error)
         handle_dbus_call_error("org.gnome.SessionManager.Uninhibit", &error);
 
@@ -153,6 +147,7 @@ static void gnome_integration_dispose(SpiceDesktopIntegration *self)
 
     g_clear_object(&priv->gnome_session_proxy);
 }
+#endif /* WITH_GNOME */
 
 static void spice_desktop_integration_init(SpiceDesktopIntegration *self)
 {
@@ -161,7 +156,7 @@ static void spice_desktop_integration_init(SpiceDesktopIntegration *self)
     priv = spice_desktop_integration_get_instance_private(self);
     self->priv = priv;
 
-#if defined(G_OS_UNIX) && !__APPLE__
+#ifdef WITH_GNOME
     if (gnome_integration_init(self)) {
         return;
     }
@@ -172,9 +167,11 @@ static void spice_desktop_integration_init(SpiceDesktopIntegration *self)
 
 static void spice_desktop_integration_dispose(GObject *gobject)
 {
+#ifdef WITH_GNOME
     SpiceDesktopIntegration *self = SPICE_DESKTOP_INTEGRATION(gobject);
 
     gnome_integration_dispose(self);
+#endif
 
     /* Chain up to the parent class */
     if (G_OBJECT_CLASS(spice_desktop_integration_parent_class)->dispose)
@@ -208,10 +205,14 @@ SpiceDesktopIntegration *spice_desktop_integration_get(SpiceSession *session)
 
 void spice_desktop_integration_inhibit_automount(SpiceDesktopIntegration *self)
 {
+#ifdef WITH_GNOME
     gnome_integration_inhibit_automount(self);
+#endif
 }
 
 void spice_desktop_integration_uninhibit_automount(SpiceDesktopIntegration *self)
 {
+#ifdef WITH_GNOME
     gnome_integration_uninhibit_automount(self);
+#endif
 }


More information about the Spice-commits mailing list