[Spice-devel] [spice-gtk v2 1/2] build-sys: require usbredir 0.7.1 or above

Victor Toso victortoso at redhat.com
Fri Feb 22 17:41:45 UTC 2019


From: Victor Toso <me at victortoso.com>

usbredir-0.7.1 was released on 29-Oct-2015, relatively old compared to
most recent usbredir-0.8.0 from 03-Aug-2018.

* Debian 9 (stretch) -> 0.7.1
* Fedora 21 to Fedora 27 -> 0.7.1
* Fedora 28 to rawhide -> 0.8.0

Signed-off-by: Victor Toso <victortoso at redhat.com>
---
 configure.ac           | 2 +-
 meson.build            | 6 ++++--
 src/channel-usbredir.c | 6 ------
 3 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index 2e6f7e7..d234822 100644
--- a/configure.ac
+++ b/configure.ac
@@ -282,7 +282,7 @@ if test "x$enable_usbredir" = "xno"; then
   have_usbredir="no"
 else
   PKG_CHECK_MODULES([USBREDIR],
-                    [libusb-1.0 >= 1.0.16 libusbredirhost libusbredirparser-0.5],
+                    [libusb-1.0 >= 1.0.16 libusbredirhost >= 0.7.1 libusbredirparser-0.5 >= 0.7.1],
                     [have_usbredir=yes],
                     [have_usbredir=no])
   if test "x$have_usbredir" = "xno" && test "x$enable_usbredir" = "xyes"; then
diff --git a/meson.build b/meson.build
index 1863c52..1dedbe1 100644
--- a/meson.build
+++ b/meson.build
@@ -188,8 +188,10 @@ endif
 
 # usbredir
 spice_gtk_has_usbredir = false
-d1 = dependency('libusbredirparser-0.5', required : get_option('usbredir'))
-d2 = dependency('libusbredirhost', version : '>= 0.4.2', required : get_option('usbredir'))
+usbredir_version = '0.7.1'
+usbredir_version_info = '>= @0@'.format(usbredir_version)
+d1 = dependency('libusbredirparser-0.5', version: usbredir_version_info, required : get_option('usbredir'))
+d2 = dependency('libusbredirhost', version: usbredir_version_info, required : get_option('usbredir'))
 d3 = dependency('libusb-1.0', version : '>= 1.0.16', required : get_option('usbredir'))
 if d1.found() and d2.found() and d3.found()
   spice_glib_deps += [d1, d2, d3]
diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c
index 182edc4..3562164 100644
--- a/src/channel-usbredir.c
+++ b/src/channel-usbredir.c
@@ -94,9 +94,7 @@ static void usbredir_log(void *user_data, int level, const char *msg);
 static int usbredir_read_callback(void *user_data, uint8_t *data, int count);
 static int usbredir_write_callback(void *user_data, uint8_t *data, int count);
 static void usbredir_write_flush_callback(void *user_data);
-#if USBREDIR_VERSION >= 0x000701
 static uint64_t usbredir_buffered_output_size_callback(void *user_data);
-#endif
 
 static void *usbredir_alloc_lock(void);
 static void usbredir_lock_lock(void *user_data);
@@ -286,9 +284,7 @@ void spice_usbredir_channel_set_context(SpiceUsbredirChannel *channel,
     if (!priv->host)
         g_error("Out of memory allocating usbredirhost");
 
-#if USBREDIR_VERSION >= 0x000701
     usbredirhost_set_buffered_output_size_cb(priv->host, usbredir_buffered_output_size_callback);
-#endif
 #ifdef USE_LZ4
     spice_channel_set_capability(channel, SPICE_SPICEVMC_CAP_DATA_COMPRESS_LZ4);
 #endif
@@ -589,13 +585,11 @@ void spice_usbredir_channel_get_guest_filter(
 /* ------------------------------------------------------------------ */
 /* callbacks (any context)                                            */
 
-#if USBREDIR_VERSION >= 0x000701
 static uint64_t usbredir_buffered_output_size_callback(void *user_data)
 {
     g_return_val_if_fail(SPICE_IS_USBREDIR_CHANNEL(user_data), 0);
     return spice_channel_get_queue_size(SPICE_CHANNEL(user_data));
 }
-#endif
 
 /* Note that this function must be re-entrant safe, as it can get called
    from both the main thread as well as from the usb event handling thread */
-- 
2.20.1



More information about the Spice-devel mailing list