[gnome-boxes/wip/feborges/rdp: 12/14] build: Make RDP support optional



commit 5360ea5fd775f72dddbf38d05b63ffd783931a45
Author: Felipe Borges <felipeborges gnome org>
Date:   Wed May 2 15:38:51 2018 +0200

    build: Make RDP support optional
    
    To build without RDP support:
      meson _build -Drdp=false
    
    RDP is enabled by default.
    
    The reason to build without RDP would be the lack of the freerdp
    dependency.

 meson_options.txt       |  4 ++++
 src/meson.build         | 25 +++++++++++++++----------
 src/rdp-display.vala    |  1 -
 src/remote-machine.vala |  3 ++-
 src/wizard.vala         |  2 ++
 5 files changed, 23 insertions(+), 12 deletions(-)
---
diff --git a/meson_options.txt b/meson_options.txt
index 3030bd11..a06a6977 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -12,6 +12,10 @@ option ('ovirt',
         type: 'boolean',
         value: true)
 
+option ('rdp',
+        type: 'boolean',
+        value: true)
+
 option ('installed_tests',
         type: 'boolean',
         value: false,
diff --git a/src/meson.build b/src/meson.build
index 2f30704b..4735fe35 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -154,17 +154,22 @@ if get_option('ovirt')
   ]
 endif
 
-# Gtk-fRDP
-pkgdatadir = join_paths (data_dir, meson.project_name ())
-gtk_frdp = subproject(
-  'gtk-frdp',
-  default_options: [
-    'pkgdatadir=' + pkgdatadir,
-    'pkglibdir=' + pkglibdir
-  ]
-)
+if get_option('rdp')
+  vala_sources += 'rdp-display.vala'
+
+  pkgdatadir = join_paths (data_dir, meson.project_name ())
+  gtk_frdp = subproject(
+    'gtk-frdp',
+    default_options: [
+      'pkgdatadir=' + pkgdatadir,
+      'pkglibdir=' + pkglibdir
+    ]
+  )
 
-dependencies += gtk_frdp.get_variable('gtk_frdp_vapi')
+  vala_args += '--define=HAVE_RDP'
+
+  dependencies += gtk_frdp.get_variable('gtk_frdp_vapi')
+endif
 
 executable ('gnome-boxes', vala_sources + resources,
             include_directories: config_h_dir,
diff --git a/src/rdp-display.vala b/src/rdp-display.vala
index d9666516..835f0f00 100644
--- a/src/rdp-display.vala
+++ b/src/rdp-display.vala
@@ -1,6 +1,5 @@
 // This file is part of GNOME Boxes. License: LGPLv2+
 using Gtk;
-using Frdp;
 
 private class Boxes.FrdpDisplay: Frdp.Display {
     public override bool authenticate (out string username, out string password, out string domain) {
diff --git a/src/remote-machine.vala b/src/remote-machine.vala
index ebe145d9..6cd8ccea 100644
--- a/src/remote-machine.vala
+++ b/src/remote-machine.vala
@@ -35,9 +35,10 @@ public RemoteMachine (CollectionSource source) throws Boxes.Error {
         case "vnc":
             return new VncDisplay.with_uri (config, source.uri);
 
+#if HAVE_RDP
         case "rdp":
             return new RdpDisplay.with_uri (config, source.uri);
-
+#endif
         default:
             throw new Boxes.Error.INVALID ("unsupported display of type " + type);
         }
diff --git a/src/wizard.vala b/src/wizard.vala
index c9be7dbe..0b83f95f 100644
--- a/src/wizard.vala
+++ b/src/wizard.vala
@@ -363,8 +363,10 @@ private void prepare_for_uri (string uri_as_text, string? filename = null) throw
             source.source_type = "spice";
         } else if (uri.scheme == "vnc") {
             // accept any vnc:// uri
+        #if HAVE_RDP
         } else if (uri.scheme == "rdp") {
             // accept any rdp:// uri
+        #endif
         } else if (uri.scheme.has_prefix ("qemu")) {
             // accept any qemu..:// uri
             source.source_type = "libvirt";


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