[gnome-boxes] ovirt: Conditionally use libgovirt during build



commit 2040b6364fcac70fa643ed307b12bc454651a2cb
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Thu Jun 14 18:56:07 2012 +0200

    ovirt: Conditionally use libgovirt during build
    
    https://bugzilla.gnome.org/show_bug.cgi?id=681747

 configure.ac         |   14 ++++++++-
 src/Makefile.am      |    6 +++
 src/config.vapi      |    1 +
 vapi/Makefile.am     |    1 +
 vapi/govirt-1.0.vapi |   83 ++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 104 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index e7d1c68..aef95ca 100644
--- a/configure.ac
+++ b/configure.ac
@@ -46,6 +46,7 @@ CLUTTER_MIN_VERSION=1.11.14
 GLIB_MIN_VERSION=2.32.0
 AC_SUBST(GLIB_MIN_VERSION)
 GOBJECT_INTROSPECTION_MIN_VERSION=0.9.6
+GOVIRT_MIN_VERSION=0.0.3
 GTK_MIN_VERSION=3.5.5
 GTK_VNC_MIN_VERSION=0.4.4
 LIBVIRT_GLIB_MIN_VERSION=0.1.5
@@ -54,6 +55,7 @@ LIBXML2_MIN_VERSION=2.7.8
 SPICE_GTK_MIN_VERSION=0.12.101
 GUDEV_MIN_VERSION=165
 OSINFO_MIN_VERSION=0.2.3
+REST_MIN_VERSION=0.7.90
 TRACKER_SPARQL=0.13.1
 UUID_REQUIRED=1.41.3
 LIBSOUP_REQUIRED=2.38
@@ -92,7 +94,16 @@ VALA_ADD_CHECKFILE([src/gnome_boxes_search_provider_vala.stamp])
 
 VALA_ADD_CHECKFILE([libgd/gd-1.0.vapi])
 
-VALA_CHECK([0.17.3], [
+PKG_CHECK_MODULES(OVIRT, [govirt-1.0 >= $GOVIRT_MIN_VERSION rest-0.7 >= $REST_MIN_VERSION],
+                  [have_govirt=yes], [have_govirt=no])
+if test "x$have_govirt" = "xyes"; then
+  AC_DEFINE([HAVE_OVIRT], [1], [Build with oVirt support?])
+else
+  AC_DEFINE([HAVE_OVIRT], [0], [Build with oVirt support?])
+fi
+AM_CONDITIONAL([HAVE_OVIRT], [test "x$have_govirt" = "xyes"])
+
+VALA_CHECK([0.18.0], [
   clutter-gtk-1.0
   cogl-1.0
   gdk-pixbuf-2.0
@@ -105,6 +116,7 @@ VALA_CHECK([0.17.3], [
   libvirt-gobject-1.0
   libxml-2.0
   posix
+  rest-0.7
   spice-client-gtk-3.0
   libsoup-2.4
 ])
diff --git a/src/Makefile.am b/src/Makefile.am
index 421aa5c..502607f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -128,6 +128,12 @@ gnome_boxes_LDADD =                                \
 gnome_boxes_CFLAGS = $(BOXES_CFLAGS) $(TRACKER_CFLAGS)
 $(srcdir)/gnome_boxes_vala.stamp: $(libcommon_a_DEPENDENCIES)
 
+AM_VALAFLAGS += --pkg govirt-1.0 --pkg rest-0.7
+if HAVE_OVIRT
+gnome_boxes_LDADD += $(OVIRT_LIBS)
+gnome_boxes_CFLAGS += $(OVIRT_CFLAGS)
+endif
+
 MAINTAINERCLEANFILES += $(gnome_boxes_SOURCES:.vala=.c)
 
 libexec_PROGRAMS = gnome-boxes-search-provider
diff --git a/src/config.vapi b/src/config.vapi
index 12bfd32..c61ddc4 100644
--- a/src/config.vapi
+++ b/src/config.vapi
@@ -11,4 +11,5 @@ namespace Config {
         public const string PACKAGE_URL;
         public const bool HAVE_USBREDIR;
         public const bool HAVE_SMARTCARD;
+        public const bool HAVE_OVIRT;
 }
diff --git a/vapi/Makefile.am b/vapi/Makefile.am
index 87227de..9161c55 100644
--- a/vapi/Makefile.am
+++ b/vapi/Makefile.am
@@ -3,6 +3,7 @@ SUBDIRS = upstream
 
 EXTRA_DIST =                                   \
        gio-2.0-workaround.vapi                 \
+       govirt-1.0.vapi                         \
        $(NULL)
 
 -include $(top_srcdir)/git.mk
diff --git a/vapi/govirt-1.0.vapi b/vapi/govirt-1.0.vapi
new file mode 100644
index 0000000..5a508be
--- /dev/null
+++ b/vapi/govirt-1.0.vapi
@@ -0,0 +1,83 @@
+/* govirt.vapi generated by lt-vapigen, do not modify. */
+
+[CCode (cprefix = "Ovirt", gir_namespace = "GoVirt", gir_version = "1.0", lower_case_cprefix = "ovirt_")]
+namespace Ovirt {
+       [CCode (cheader_filename = "govirt/govirt.h", type_id = "ovirt_proxy_get_type ()")]
+       public class Proxy : Rest.Proxy {
+               [CCode (has_construct_function = false)]
+               public Proxy (string uri);
+               public bool fetch_ca_certificate () throws GLib.Error;
+               public async GLib.ByteArray fetch_ca_certificate_async (GLib.Cancellable? cancellable) throws 
GLib.Error;
+               public bool fetch_vms () throws GLib.Error;
+               public async unowned GLib.List<Ovirt.Vm> fetch_vms_async (GLib.Cancellable? cancellable) 
throws GLib.Error;
+               public unowned GLib.List<Ovirt.Vm> get_vms ();
+               public Ovirt.Vm lookup_vm (string vm_name);
+               [NoAccessorMethod]
+               public bool admin { get; set; }
+               [NoAccessorMethod]
+               public GLib.ByteArray ca_cert { owned get; set; }
+       }
+       [CCode (cheader_filename = "govirt/govirt.h", type_id = "ovirt_vm_get_type ()")]
+       public class Vm : GLib.Object {
+               [CCode (has_construct_function = false)]
+               public Vm ();
+               public bool get_ticket (Ovirt.Proxy proxy) throws GLib.Error;
+               public async bool get_ticket_async (Ovirt.Proxy proxy, GLib.Cancellable? cancellable) throws 
GLib.Error;
+               public bool start (Ovirt.Proxy proxy) throws GLib.Error;
+               public async bool start_async (Ovirt.Proxy proxy, GLib.Cancellable? cancellable) throws 
GLib.Error;
+               public bool stop (Ovirt.Proxy proxy) throws GLib.Error;
+               public async bool stop_async (Ovirt.Proxy proxy, GLib.Cancellable? cancellable) throws 
GLib.Error;
+               [NoAccessorMethod]
+               public Ovirt.VmDisplay display { owned get; set; }
+               [NoAccessorMethod]
+               public string href { owned get; set; }
+               [NoAccessorMethod]
+               public string name { owned get; set; }
+               [NoAccessorMethod]
+               public Ovirt.VmState state { get; set; }
+               [NoAccessorMethod]
+               public string uuid { owned get; set; }
+       }
+       [CCode (cheader_filename = "govirt/govirt.h", type_id = "ovirt_vm_display_get_type ()")]
+       public class VmDisplay : GLib.Object {
+               [CCode (has_construct_function = false)]
+               public VmDisplay ();
+               [NoAccessorMethod]
+               public string address { owned get; set; }
+               [NoAccessorMethod]
+               public uint expiry { get; set; }
+               [NoAccessorMethod]
+               public uint monitor_count { get; set; }
+               [NoAccessorMethod]
+               public uint port { get; set; }
+               [NoAccessorMethod]
+               public uint secure_port { get; set; }
+               [NoAccessorMethod]
+               public string ticket { owned get; set; }
+               [NoAccessorMethod]
+               public Ovirt.VmDisplayType type { get; set; }
+       }
+       [CCode (cheader_filename = "govirt/govirt.h", cprefix = "OVIRT_VM_DISPLAY_", type_id = 
"ovirt_vm_display_type_get_type ()")]
+       public enum VmDisplayType {
+               SPICE,
+               VNC
+       }
+       [CCode (cheader_filename = "govirt/govirt.h", cprefix = "OVIRT_VM_STATE_", type_id = 
"ovirt_vm_state_get_type ()")]
+       public enum VmState {
+               DOWN,
+               UP,
+               REBOOTING
+       }
+       [CCode (cheader_filename = "govirt/govirt.h", cprefix = "OVIRT_PROXY_")]
+       public errordomain ProxyError {
+               PARSING_FAILED,
+               ACTION_FAILED,
+               FAULT;
+               public static GLib.Quark quark ();
+       }
+       [CCode (cheader_filename = "govirt/govirt.h", cprefix = "OVIRT_REST_CALL_ERROR_")]
+       public errordomain RestCallError {
+               XML;
+               public static GLib.Quark quark ();
+       }
+}



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