[gnome-boxes] build: Make oVirt support optional
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] build: Make oVirt support optional
- Date: Mon, 12 Feb 2018 15:47:00 +0000 (UTC)
commit db5d242f763401e6787368f7a3b0d52fe733ec01
Author: Iñigo Martínez <inigomartinez gmail com>
Date: Mon Feb 12 15:43:21 2018 +0100
build: 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 by using vala preprocessor[0].
[0] https://wiki.gnome.org/Projects/Vala/Manual/Preprocessor
meson.build | 5 -----
src/app.vala | 5 +++--
src/config.vapi | 1 -
src/meson.build | 33 +++++++++++++--------------------
4 files changed, 16 insertions(+), 28 deletions(-)
---
diff --git a/meson.build b/meson.build
index a074028e..d6119298 100644
--- a/meson.build
+++ b/meson.build
@@ -11,7 +11,6 @@ i18n = import ('i18n')
cc = meson.get_compiler ('c')
valac = meson.get_compiler ('vala')
-govirt_dep = dependency ('govirt-1.0', version: '>= 0.3.4')
libarchive_dep = dependency ('libarchive', version: '>= 3.0.0')
src_dir = join_paths (meson.source_root (), 'src')
@@ -38,10 +37,6 @@ 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_dep.found()
- conf.set10 ('HAVE_OVIRT', get_option ('ovirt'))
-endif
-
configure_file (output: 'config.h', configuration: conf)
config_h_dir = include_directories ('.')
diff --git a/src/app.vala b/src/app.vala
index e56c582c..89aba7a8 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -127,8 +127,9 @@ public override void startup () {
collection = new Collection ();
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 15e1eff6..92409b51 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 8adce5cb..1b4ae44d 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -114,20 +114,6 @@ vala_sources = [
'snapshots-property.vala',
]
-if govirt_dep.found ()
- if get_option ('ovirt')
- vala_sources += [
- 'ovirt-broker.vala',
- 'ovirt-machine.vala',
- ]
- endif
-endif
-
-boxes_sources = [
- vala_sources,
- resources
-]
-
dependencies = [
config_dep,
libarchive_dep,
@@ -148,17 +134,24 @@ dependencies = [
valac.find_library ('gio-2.0-workaround', dirs: vapi_dir),
valac.find_library ('linux'),
valac.find_library ('posix'),
- valac.find_library ('rest-0.7'),
valac.find_library ('spice-client-gtk-3.0'),
]
-if govirt_dep.found()
- if get_option ('ovirt')
- dependencies += govirt_dep
- endif
+if get_option('ovirt')
+ vala_sources += [
+ 'ovirt-broker.vala',
+ 'ovirt-machine.vala'
+ ]
+
+ vala_args += '--define=HAVE_OVIRT'
+
+ dependencies += [
+ dependency ('govirt-1.0', version: '>= 0.3.4'),
+ valac.find_library ('rest-0.7')
+ ]
endif
-executable ('gnome-boxes', boxes_sources,
+executable ('gnome-boxes', vala_sources + resources,
include_directories: config_h_dir,
vala_args: vala_args,
c_args : c_args,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]