[gnome-boxes/wip/inigomartinez/meson: 11/13] meson: Make oVirt support optional
- From: Iñigo Martínez <inigomartinez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/wip/inigomartinez/meson: 11/13] meson: Make oVirt support optional
- Date: Mon, 18 Dec 2017 14:21:15 +0000 (UTC)
commit f491d97927f96569ef270d7768e20a3334c3aeef
Author: Iñigo Martínez <inigomartinez gmail com>
Date: Sat Dec 9 22:37:45 2017 +0100
meson: Make oVirt support optional
Although there is an option to make oVirt support optinal, the
GObject-based library to access oVirt REST API must be available
to build gnome-boxes.
This patch makes the library dependency optional if the oVirt
support is disabled.
https://bugzilla.gnome.org/show_bug.cgi?id=791421
meson.build | 7 ++---
src/app.vala | 5 ++-
src/config.vapi | 1 -
src/meson.build | 56 ++++++++++++++++++++++++++----------------------------
4 files changed, 33 insertions(+), 36 deletions(-)
---
diff --git a/meson.build b/meson.build
index dbbe949..197febb 100644
--- a/meson.build
+++ b/meson.build
@@ -14,7 +14,6 @@ valac = meson.get_compiler ('vala')
glib = dependency ('glib-2.0', version: '>= 2.38.0')
gio = dependency ('gio-2.0', version: '>= 2.38.0')
gobject = dependency ('gobject-2.0', version: '>= 2.44')
-govirt = dependency ('govirt-1.0', version: '>= 0.3.4')
gtk = dependency ('gtk+-3.0', version: '>= 3.19.8')
gtk_vnc = dependency ('gtk-vnc-2.0', version: '>= 0.4.4')
gudev = dependency ('gudev-1.0', version: '>= 165')
@@ -37,7 +36,6 @@ config = valac.find_library ('config', dirs: src_dir)
gio_workaround = valac.find_library ('gio-2.0-workaround', dirs: vapi_dir)
linux = valac.find_library ('linux')
posix = valac.find_library ('posix')
-rest = valac.find_library ('rest-0.7')
pkglibdir = join_paths (get_option ('libdir'), meson.project_name ())
libgd = subproject (
@@ -70,8 +68,9 @@ conf.set_quoted ('CACHEDIR', '/var/cache')
conf.set_quoted ('LOCALEDIR', locale_dir)
conf.set('PACKAGE_BUGREPORT', '"https://bugzilla.gnome.org/enter_bug.cgi?product=gnome-boxes"')
-if govirt.found()
- conf.set10 ('HAVE_OVIRT', get_option ('ovirt'))
+if get_option ('ovirt')
+ govirt = dependency ('govirt-1.0', version: '>= 0.3.4')
+ rest = valac.find_library ('rest-0.7')
endif
configure_file (output: 'config.h', configuration: conf)
diff --git a/src/app.vala b/src/app.vala
index 9c21615..faa6ada 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -132,8 +132,9 @@ private class Boxes.App: Gtk.Application {
});
brokers.insert ("libvirt", LibvirtBroker.get_default ());
- if (Config.HAVE_OVIRT)
- brokers.insert ("ovirt", OvirtBroker.get_default ());
+#if HAVE_OVIRT
+ brokers.insert ("ovirt", OvirtBroker.get_default ());
+#endif
check_cpu_vt_capability.begin ();
check_module_kvm_loaded.begin ();
diff --git a/src/config.vapi b/src/config.vapi
index 15e1eff..92409b5 100644
--- a/src/config.vapi
+++ b/src/config.vapi
@@ -11,5 +11,4 @@ namespace Config {
public const string CACHEDIR;
public const string PACKAGE_BUGREPORT;
public const string PACKAGE_URL;
- public const bool HAVE_OVIRT;
}
diff --git a/src/meson.build b/src/meson.build
index 96aef0b..d25db14 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -42,6 +42,16 @@ libcommon = static_library(
c_args: c_args
)
+executable ('gnome-boxes-search-provider', 'gnome-boxes-search-provider.vala',
+ include_directories: config_h_dir,
+ vala_args: vala_args,
+ c_args: c_args,
+ dependencies: common_dependencies,
+ link_with: libcommon,
+ install: true,
+ install_dir: get_option ('libexecdir')
+)
+
vala_sources = [
'app.vala',
'app-window.vala',
@@ -113,20 +123,6 @@ vala_sources = [
'snapshots-property.vala',
]
-if govirt.found ()
- if get_option ('ovirt')
- vala_sources += [
- 'ovirt-broker.vala',
- 'ovirt-machine.vala',
- ]
- endif
-endif
-
-boxes_sources = [
- vala_sources,
- resources
-]
-
dependencies = [
config,
gio_workaround,
@@ -146,18 +142,30 @@ dependencies = [
libosinfo,
libsoup,
libarchive,
- rest,
tracker,
posix,
webkitgtk,
]
-if govirt.found()
- if get_option ('ovirt')
- dependencies += govirt
- endif
+if get_option ('ovirt')
+ vala_sources += [
+ 'ovirt-broker.vala',
+ 'ovirt-machine.vala',
+ ]
+
+ vala_args += '--define=HAVE_OVIRT'
+
+ dependencies += [
+ govirt,
+ rest,
+ ]
endif
+boxes_sources = [
+ vala_sources,
+ resources
+]
+
executable ('gnome-boxes', boxes_sources,
include_directories: config_h_dir,
vala_args: vala_args,
@@ -166,13 +174,3 @@ executable ('gnome-boxes', boxes_sources,
link_with: libcommon,
install: true
)
-
-executable ('gnome-boxes-search-provider', 'gnome-boxes-search-provider.vala',
- include_directories: config_h_dir,
- vala_args: vala_args,
- c_args: c_args,
- dependencies: common_dependencies,
- link_with: libcommon,
- install: true,
- install_dir: get_option ('libexecdir')
-)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]