[mingw-usbredir/f17] Fix after review
Marc-André Lureau
elmarco at fedoraproject.org
Tue Jul 10 23:40:26 UTC 2012
commit 9204926b060b65fa9f22c37a8a09e35483ecbfcf
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date: Tue Jul 10 21:52:59 2012 +0200
Fix after review
...indows-ignore-usbredirserver-and-usbredir.patch | 53 +++++++
...bredirhost-undef-ERROR-if-already-defined.patch | 30 ++++
...do-not-run-.-configure-if-env-variable-NO.patch | 25 +++
...t-add-LIBUSB_CALL-to-libusb-complete-call.patch | 65 ++++++++
...t-claim-release-ignore-NOT_SUPPORTED-on-a.patch | 38 +++++
...ost-Don-t-set-a-timeout-on-bulk-transfers.patch | 47 ++++++
...t-Properly-log-an-error-when-the-initial-.patch | 36 +++++
...ter-Win32-use-strtok_r-implementation-of-.patch | 156 ++++++++++++++++++++
mingw-usbredir.spec | 85 ++++++++++-
sources | 1 +
10 files changed, 527 insertions(+), 9 deletions(-)
---
diff --git a/0001-configure-Windows-ignore-usbredirserver-and-usbredir.patch b/0001-configure-Windows-ignore-usbredirserver-and-usbredir.patch
new file mode 100644
index 0000000..917d18b
--- /dev/null
+++ b/0001-configure-Windows-ignore-usbredirserver-and-usbredir.patch
@@ -0,0 +1,53 @@
+From e059de1d00a0df5c4176a768619e4b355d8880a6 Mon Sep 17 00:00:00 2001
+From: Uri Lublin <uril at redhat.com>
+Date: Sun, 26 Feb 2012 16:33:44 +0200
+Subject: [PATCH 1/8] configure: Windows: ignore usbredirserver and
+ usbredirtestclient subdirs
+
+Their build fails, so skip them.
+Things to fix to make the them work on Win32 include sockets, signals, threads
+and more.
+---
+ Makefile.am | 5 ++++-
+ configure.ac | 13 +++++++++++++
+ 2 files changed, 17 insertions(+), 1 deletion(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 9d392d5..6b77127 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -1,2 +1,5 @@
+-SUBDIRS = usbredirparser usbredirhost usbredirserver usbredirtestclient
++SUBDIRS = usbredirparser usbredirhost
++if ! OS_WIN32
++SUBDIRS += usbredirserver usbredirtestclient
++endif
+ EXTRA_DIST = README.multi-thread usb-redirection-protocol.txt
+\ No newline at end of file
+diff --git a/configure.ac b/configure.ac
+index 8c72972..60fda74 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -26,6 +26,19 @@ AC_PROG_LN_S
+ LT_INIT
+ dnl AC_DEFINE(_GNU_SOURCE, [1], [Enable GNU extensions])
+
++AC_MSG_CHECKING([for native Win32])
++echo "host is $host"
++case "$host" in
++ *mingw*|*cygwin*)
++ os_win32=yes
++ ;;
++ *)
++ os_win32=no
++ ;;
++esac
++AC_MSG_RESULT([$os_win32])
++AM_CONDITIONAL([OS_WIN32],[test "$os_win32" = "yes"])
++
+ # Set some sane default CFLAGS, avoid having to do another release like 0.4.1
+ if test "$ac_test_CFLAGS" != set; then
+ DEFAULT_CFLAGS="-Wall -Werror -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4"
+--
+1.7.10.2
+
diff --git a/0002-usbredirhost-undef-ERROR-if-already-defined.patch b/0002-usbredirhost-undef-ERROR-if-already-defined.patch
new file mode 100644
index 0000000..cefd4d8
--- /dev/null
+++ b/0002-usbredirhost-undef-ERROR-if-already-defined.patch
@@ -0,0 +1,30 @@
+From f6d1c7ae1105c8ffe232c589445f00ae31898174 Mon Sep 17 00:00:00 2001
+From: Uri Lublin <uril at redhat.com>
+Date: Sun, 26 Feb 2012 16:37:29 +0200
+Subject: [PATCH 2/8] usbredirhost: undef ERROR if already defined
+
+On Windows (mingw), ERROR is already defined (to 0)
+
+This fixes the following compiler warning:
+ warning: "ERROR" redefined [enabled by default]
+---
+ usbredirhost/usbredirhost.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/usbredirhost/usbredirhost.c b/usbredirhost/usbredirhost.c
+index 1dfaee1..d686612 100644
+--- a/usbredirhost/usbredirhost.c
++++ b/usbredirhost/usbredirhost.c
+@@ -142,6 +142,9 @@ static void va_log(struct usbredirhost *host, int level,
+ host->log_func(host->func_priv, level, buf);
+ }
+
++#ifdef ERROR /* defined on WIN32 */
++#undef ERROR
++#endif
+ #define ERROR(...) va_log(host, usbredirparser_error, \
+ "usbredirhost error: " __VA_ARGS__)
+ #define WARNING(...) va_log(host, usbredirparser_warning, \
+--
+1.7.10.2
+
diff --git a/0003-autogen.sh-do-not-run-.-configure-if-env-variable-NO.patch b/0003-autogen.sh-do-not-run-.-configure-if-env-variable-NO.patch
new file mode 100644
index 0000000..b7c16a6
--- /dev/null
+++ b/0003-autogen.sh-do-not-run-.-configure-if-env-variable-NO.patch
@@ -0,0 +1,25 @@
+From 02018db6fc289d3e7156b363017f76609513b7b2 Mon Sep 17 00:00:00 2001
+From: Uri Lublin <uril at redhat.com>
+Date: Sun, 25 Mar 2012 12:36:06 +0200
+Subject: [PATCH 3/8] autogen.sh: do not run ./configure if env variable
+ NOCONFIGURE is defined
+
+---
+ autogen.sh | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/autogen.sh b/autogen.sh
+index 52083e5..568f718 100755
+--- a/autogen.sh
++++ b/autogen.sh
+@@ -1,4 +1,6 @@
+ #!/bin/sh
+
+ autoreconf -fi
+-./configure $@
++if [ -z "$NOCONFIGURE" ]; then
++ ./configure $@
++fi
+--
+1.7.10.2
+
diff --git a/0004-usbredirhost-add-LIBUSB_CALL-to-libusb-complete-call.patch b/0004-usbredirhost-add-LIBUSB_CALL-to-libusb-complete-call.patch
new file mode 100644
index 0000000..5e2d9f4
--- /dev/null
+++ b/0004-usbredirhost-add-LIBUSB_CALL-to-libusb-complete-call.patch
@@ -0,0 +1,65 @@
+From 99e9b47e2d0ed7c84c83c1a711f6a9b3ce96593e Mon Sep 17 00:00:00 2001
+From: Uri Lublin <uril at redhat.com>
+Date: Sun, 25 Mar 2012 14:13:28 +0200
+Subject: [PATCH 4/8] usbredirhost: add LIBUSB_CALL to libusb
+ complete-callback-functions
+
+In libusb.h the following definition appears:
+typedef void (LIBUSB_CALL *libusb_transfer_cb_fn)(struct libusb_transfer *transfer);
+
+Added LIBUSB_CALL to the following functions:
+ usbredirhost_iso_packet_complete
+ usbredirhost_interrupt_packet_complete
+ usbredirhost_control_packet_complete
+ usbredirhost_bulk_packet_complete
+
+This fixes the following compiler warning for Windows (mingw):
+./usbredirhost/usbredirhost.c: In function 'usbredirhost_alloc_iso_stream':
+./usbredir/usbredirhost/usbredirhost.c:1206:13: warning: passing argument 7 of 'libusb_fill_iso_transfer' from incompatible pointer type [enabled by default]
+---
+ usbredirhost/usbredirhost.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/usbredirhost/usbredirhost.c b/usbredirhost/usbredirhost.c
+index d686612..110e790 100644
+--- a/usbredirhost/usbredirhost.c
++++ b/usbredirhost/usbredirhost.c
+@@ -1031,7 +1031,7 @@ static int usbredirhost_handle_iso_status(struct usbredirhost *host,
+ }
+ }
+
+-static void usbredirhost_iso_packet_complete(
++static void LIBUSB_CALL usbredirhost_iso_packet_complete(
+ struct libusb_transfer *libusb_transfer)
+ {
+ struct usbredirtransfer *transfer = libusb_transfer->user_data;
+@@ -1270,7 +1270,7 @@ static int usbredirhost_submit_interrupt_in_transfer(struct usbredirhost *host,
+ return usb_redir_success;
+ }
+
+-static void usbredirhost_interrupt_packet_complete(
++static void LIBUSB_CALL usbredirhost_interrupt_packet_complete(
+ struct libusb_transfer *libusb_transfer)
+ {
+ struct usbredirtransfer *transfer = libusb_transfer->user_data;
+@@ -1793,7 +1793,7 @@ static void usbredirhost_cancel_data_packet(void *priv, uint32_t id)
+ UNLOCK(host);
+ }
+
+-static void usbredirhost_control_packet_complete(
++static void LIBUSB_CALL usbredirhost_control_packet_complete(
+ struct libusb_transfer *libusb_transfer)
+ {
+ struct usb_redir_control_packet_header control_packet;
+@@ -1924,7 +1924,7 @@ static void usbredirhost_control_packet(void *priv, uint32_t id,
+ }
+ }
+
+-static void usbredirhost_bulk_packet_complete(
++static void LIBUSB_CALL usbredirhost_bulk_packet_complete(
+ struct libusb_transfer *libusb_transfer)
+ {
+ struct usb_redir_bulk_packet_header bulk_packet;
+--
+1.7.10.2
+
diff --git a/0005-usbredirhost-claim-release-ignore-NOT_SUPPORTED-on-a.patch b/0005-usbredirhost-claim-release-ignore-NOT_SUPPORTED-on-a.patch
new file mode 100644
index 0000000..f5a7d46
--- /dev/null
+++ b/0005-usbredirhost-claim-release-ignore-NOT_SUPPORTED-on-a.patch
@@ -0,0 +1,38 @@
+From 4ff1a981739e0711684dcf8b4f7221d55bbf23b7 Mon Sep 17 00:00:00 2001
+From: Uri Lublin <uril at redhat.com>
+Date: Mon, 30 Apr 2012 11:54:51 +0300
+Subject: [PATCH 5/8] usbredirhost: claim/release: ignore NOT_SUPPORTED on
+ attach|detach kernel driver
+
+On Windows libusb_(attach|detach)_kernel_driver are not supported.
+A libusb driver is already installed (device was successfully opened).
+In that case just continue as if operation was successful.
+---
+ usbredirhost/usbredirhost.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/usbredirhost/usbredirhost.c b/usbredirhost/usbredirhost.c
+index 110e790..8b0c1ba 100644
+--- a/usbredirhost/usbredirhost.c
++++ b/usbredirhost/usbredirhost.c
+@@ -485,7 +485,8 @@ static int usbredirhost_claim(struct usbredirhost *host, int initial_claim)
+ n = host->config->interface[i].altsetting[0].bInterfaceNumber;
+
+ r = libusb_detach_kernel_driver(host->handle, n);
+- if (r < 0 && r != LIBUSB_ERROR_NOT_FOUND) {
++ if (r < 0 && r != LIBUSB_ERROR_NOT_FOUND
++ && r != LIBUSB_ERROR_NOT_SUPPORTED) {
+ ERROR("could not detach driver from interface %d (configuration %d): %d",
+ n, host->config->bConfigurationValue, r);
+ return libusb_status_or_error_to_redir_status(host, r);
+@@ -543,6 +544,7 @@ static void usbredirhost_release(struct usbredirhost *host, int attach_drivers)
+ r = libusb_attach_kernel_driver(host->handle, n);
+ if (r < 0 && r != LIBUSB_ERROR_NOT_FOUND /* No driver */
+ && r != LIBUSB_ERROR_NO_DEVICE /* Device unplugged */
++ && r != LIBUSB_ERROR_NOT_SUPPORTED /* Not supported */
+ && r != LIBUSB_ERROR_BUSY /* driver rebound already */) {
+ ERROR("could not re-attach driver to interface %d (configuration %d): %d",
+ n, host->config->bConfigurationValue, r);
+--
+1.7.10.2
+
diff --git a/0006-usbredirhost-Don-t-set-a-timeout-on-bulk-transfers.patch b/0006-usbredirhost-Don-t-set-a-timeout-on-bulk-transfers.patch
new file mode 100644
index 0000000..acf0c23
--- /dev/null
+++ b/0006-usbredirhost-Don-t-set-a-timeout-on-bulk-transfers.patch
@@ -0,0 +1,47 @@
+From 7783d3db61083bbf7f61b1ea8608c666b4c6a1dd Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at redhat.com>
+Date: Fri, 22 Jun 2012 11:48:37 +0200
+Subject: [PATCH 6/8] usbredirhost: Don't set a timeout on bulk transfers
+
+Bulk packets can be (ab)used as interrupt transfers without timing guarantees,
+iow you can submit a bulk in transfer and let it be submitted until the
+device has data to reports a few eons later.
+
+This is used by (some?) USB cdc-acm devices (modems, smartcard readers, gps
+devices), specifically a smartcard reader I've been debugging, which currently
+does not work.
+
+Not setting a timeout at the usb-host side fixes these devices. For devices
+where timeouts do make sense, the timeouts should be handled by the usb-guest,
+which has device specific knowledge we lack.
+
+Signed-off-by: Hans de Goede <hdegoede at redhat.com>
+---
+ usbredirhost/usbredirhost.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/usbredirhost/usbredirhost.c b/usbredirhost/usbredirhost.c
+index 8b0c1ba..be75f87 100644
+--- a/usbredirhost/usbredirhost.c
++++ b/usbredirhost/usbredirhost.c
+@@ -31,7 +31,7 @@
+ #define MAX_ENDPOINTS 32
+ #define MAX_INTERFACES 32 /* Max 32 endpoints and thus interfaces */
+ #define CTRL_TIMEOUT 5000 /* USB specifies a 5 second max timeout */
+-#define BULK_TIMEOUT 5000
++#define BULK_TIMEOUT 0 /* No timeout for bulk transfers */
+ #define ISO_TIMEOUT 1000
+ #define INTERRUPT_TIMEOUT 0 /* No timeout for interrupt transfers */
+
+@@ -2017,7 +2017,7 @@ static void usbredirhost_bulk_packet(void *priv, uint32_t id,
+ libusb_fill_bulk_transfer(transfer->transfer, host->handle, ep,
+ data, bulk_packet->length,
+ usbredirhost_bulk_packet_complete,
+- transfer, CTRL_TIMEOUT);
++ transfer, BULK_TIMEOUT);
+ transfer->id = id;
+ transfer->bulk_packet = *bulk_packet;
+
+--
+1.7.10.2
+
diff --git a/0007-usbredirhost-Properly-log-an-error-when-the-initial-.patch b/0007-usbredirhost-Properly-log-an-error-when-the-initial-.patch
new file mode 100644
index 0000000..95fedbf
--- /dev/null
+++ b/0007-usbredirhost-Properly-log-an-error-when-the-initial-.patch
@@ -0,0 +1,36 @@
+From cb74b3113076d6e18c799a0c73978e1aea32bad0 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at redhat.com>
+Date: Fri, 6 Jul 2012 14:25:48 +0200
+Subject: [PATCH 7/8] usbredirhost: Properly log an error when the initial
+ device reset fails
+
+Signed-off-by: Hans de Goede <hdegoede at redhat.com>
+---
+ TODO | 1 +
+ usbredirhost/usbredirhost.c | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/TODO b/TODO
+index e6715b1..2085006 100644
+--- a/TODO
++++ b/TODO
+@@ -4,3 +4,4 @@
+ * cancel pending packets / active streams before reset?
+ * add a queue_buf call to parser, use it in host to avoid memcpy of
+ "in" bulk transfers
++* use libusb strerror equivalent instead of numeric error codes in logs
+diff --git a/usbredirhost/usbredirhost.c b/usbredirhost/usbredirhost.c
+index be75f87..2415c26 100644
+--- a/usbredirhost/usbredirhost.c
++++ b/usbredirhost/usbredirhost.c
+@@ -707,6 +707,7 @@ int usbredirhost_set_device(struct usbredirhost *host,
+ so lets do that before hand */
+ r = libusb_reset_device(host->handle);
+ if (r != 0) {
++ ERROR("resetting device: %d", r);
+ usbredirhost_clear_device(host);
+ return libusb_status_or_error_to_redir_status(host, r);
+ }
+--
+1.7.10.2
+
diff --git a/0008-usbredirfilter-Win32-use-strtok_r-implementation-of-.patch b/0008-usbredirfilter-Win32-use-strtok_r-implementation-of-.patch
new file mode 100644
index 0000000..3d9ef26
--- /dev/null
+++ b/0008-usbredirfilter-Win32-use-strtok_r-implementation-of-.patch
@@ -0,0 +1,156 @@
+From 8db9136a14b78db713a564647e6e676e5fcb8a9b Mon Sep 17 00:00:00 2001
+From: Uri Lublin <uril at redhat.com>
+Date: Mon, 14 May 2012 13:05:28 +0300
+Subject: [PATCH 8/8] usbredirfilter: Win32: use strtok_r implementation of
+ glibc
+
+I could not find an imlpementation of strtok_r in mingw.
+It seems strtok_s requires an additional package to be installed on the
+usb-host machine.
+
+This patch adds the glibc implementation of strtok_r to be used on windows.
+---
+ usbredirparser/Makefile.am | 4 +++
+ usbredirparser/strtok_r.c | 65 +++++++++++++++++++++++++++++++++++++++
+ usbredirparser/strtok_r.h | 26 ++++++++++++++++
+ usbredirparser/usbredirfilter.c | 5 +++
+ 4 files changed, 100 insertions(+)
+ create mode 100644 usbredirparser/strtok_r.c
+ create mode 100644 usbredirparser/strtok_r.h
+
+diff --git a/usbredirparser/Makefile.am b/usbredirparser/Makefile.am
+index d73ba77..53c1012 100644
+--- a/usbredirparser/Makefile.am
++++ b/usbredirparser/Makefile.am
+@@ -6,5 +6,9 @@ libusbredirparser_la_HEADERS = usbredirparser.h usbredirfilter.h usbredirproto.h
+ libusbredirparser_la_LDFLAGS = -version-info $(LIBUSBREDIRPARSER_SO_VERSION) \
+ -no-undefined
+
++if OS_WIN32
++libusbredirparser_la_SOURCES += strtok_r.c strtok_r.h
++endif
++
+ pkgconfigdir = $(libdir)/pkgconfig
+ pkgconfig_DATA = libusbredirparser.pc
+diff --git a/usbredirparser/strtok_r.c b/usbredirparser/strtok_r.c
+new file mode 100644
+index 0000000..227d1ea
+--- /dev/null
++++ b/usbredirparser/strtok_r.c
+@@ -0,0 +1,65 @@
++/* Reentrant string tokenizer. Generic version.
++ Copyright (C) 1991,1996-1999,2001,2004 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#ifdef HAVE_CONFIG_H
++# include <config.h>
++#endif
++
++#include <string.h>
++
++/* Parse S into tokens separated by characters in DELIM.
++ If S is NULL, the saved pointer in SAVE_PTR is used as
++ the next starting point. For example:
++ char s[] = "-abc-=-def";
++ char *sp;
++ x = strtok_r(s, "-", &sp); // x = "abc", sp = "=-def"
++ x = strtok_r(NULL, "-=", &sp); // x = "def", sp = NULL
++ x = strtok_r(NULL, "=", &sp); // x = NULL
++ // s = "abc\0-def\0"
++*/
++char *
++glibc_strtok_r (char *s, const char *delim, char **save_ptr)
++{
++ char *token;
++
++ if (s == NULL)
++ s = *save_ptr;
++
++ /* Scan leading delimiters. */
++ s += strspn (s, delim);
++ if (*s == '\0')
++ {
++ *save_ptr = s;
++ return NULL;
++ }
++
++ /* Find the end of the token. */
++ token = s;
++ s = strpbrk (token, delim);
++ if (s == NULL)
++ /* This token finishes the string. */
++ *save_ptr = strchr (token, '\0');
++ else
++ {
++ /* Terminate the token and make *SAVE_PTR point past it. */
++ *s = '\0';
++ *save_ptr = s + 1;
++ }
++ return token;
++}
+diff --git a/usbredirparser/strtok_r.h b/usbredirparser/strtok_r.h
+new file mode 100644
+index 0000000..50e6e0e
+--- /dev/null
++++ b/usbredirparser/strtok_r.h
+@@ -0,0 +1,26 @@
++/* Reentrant string tokenizer. Generic version.
++ Copyright (C) 1991,1996-1999,2001,2004 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#ifndef _USBREDIRPARSER_STRTOK_H_
++#define _USBREDIRPARSER_STRTOK_H_
++
++char *
++glibc_strtok_r(char *s, const char *delim, char **save_ptr);
++
++#endif
+diff --git a/usbredirparser/usbredirfilter.c b/usbredirparser/usbredirfilter.c
+index b74c921..b90d16f 100644
+--- a/usbredirparser/usbredirfilter.c
++++ b/usbredirparser/usbredirfilter.c
+@@ -23,6 +23,11 @@
+ #include <string.h>
+ #include <errno.h>
+
++#ifdef WIN32
++#include "strtok_r.h"
++#define strtok_r glibc_strtok_r
++#endif
++
+ #include "usbredirfilter.h"
+
+ int usbredirfilter_string_to_rules(
+--
+1.7.10.2
+
diff --git a/mingw-usbredir.spec b/mingw-usbredir.spec
index cbd0ff5..f86fe0c 100644
--- a/mingw-usbredir.spec
+++ b/mingw-usbredir.spec
@@ -8,14 +8,21 @@ Summary: MinGW USB network redirection protocol libraries
License: LGPLv2+
URL: http://spice-space.org/page/UsbRedir
Source0: http://spice-space.org/download/usbredir/usbredir-%{version}.tar.bz2
+Patch1: 0001-configure-Windows-ignore-usbredirserver-and-usbredir.patch
+Patch2: 0002-usbredirhost-undef-ERROR-if-already-defined.patch
+Patch4: 0004-usbredirhost-add-LIBUSB_CALL-to-libusb-complete-call.patch
+Patch5: 0005-usbredirhost-claim-release-ignore-NOT_SUPPORTED-on-a.patch
+Patch6: 0006-usbredirhost-Don-t-set-a-timeout-on-bulk-transfers.patch
+Patch7: 0007-usbredirhost-Properly-log-an-error-when-the-initial-.patch
+Patch8: 0008-usbredirfilter-Win32-use-strtok_r-implementation-of-.patch
BuildArch: noarch
BuildRequires: mingw32-filesystem >= 95
BuildRequires: mingw64-filesystem >= 95
BuildRequires: mingw32-gcc
BuildRequires: mingw64-gcc
-BuildRequires: mingw32-libusb1 >= 1.0.9
-BuildRequires: mingw64-libusb1 >= 1.0.9
+BuildRequires: mingw32-libusbx >= 1.0.9
+BuildRequires: mingw64-libusbx >= 1.0.9
%description
The usbredir libraries allow USB devices to be used on remote and/or virtual
@@ -39,12 +46,42 @@ Requires: pkgconfig
This package contains the header files and libraries needed to develop
applications that use usbredir with MinGW.
+%package -n mingw32-usbredir-static
+Summary: MinGW USB network redirection protocol static libraries
+Requires: mingw32-usbredir = %{version}-%{release}
+
+%description -n mingw32-usbredir-static
+This package contains the static libraries needed to develop
+applications that use usbredir with MinGW.
+
+%package -n mingw64-usbredir
+Summary: MinGW USB network redirection protocol libraries
+Requires: pkgconfig
+
+%description -n mingw64-usbredir
+This package contains the header files and libraries needed to develop
+applications that use usbredir with MinGW.
+
+%package -n mingw64-usbredir-static
+Summary: MinGW USB network redirection protocol static libraries
+Requires: mingw64-usbredir = %{version}-%{release}
+
+%description -n mingw64-usbredir-static
+This package contains the static libraries needed to develop
+applications that use usbredir with MinGW.
+
%{?mingw_debug_package}
%prep
%setup -q -n usbredir-%{version}
-
+%patch1 -p1
+%patch2 -p1
+%patch4 -p1
+%patch5 -p1
+%patch6 -p1
+%patch7 -p1
+%patch8 -p1
%build
%mingw_configure
@@ -52,17 +89,47 @@ applications that use usbredir with MinGW.
%install
-rm -rf $RPM_BUILD_ROOT
%mingw_make_install "DESTDIR=$RPM_BUILD_ROOT"
+# Libtool files don't need to be bundled
+find $RPM_BUILD_ROOT -name "*.la" -delete
-%files -n mingw32-usbredir
-%defattr(-,root,root)
-%doc ChangeLog COPYING.LIB README TODO
+%files -n mingw32-usbredir
+%doc ChangeLog COPYING.LIB README TODO
+%{mingw32_bindir}/libusbredirhost-1.dll
+%{mingw32_bindir}/libusbredirparser-0.dll
+%{mingw32_libdir}/libusbredirhost.dll.a
+%{mingw32_libdir}/libusbredirparser.dll.a
+%{mingw32_includedir}/usbredirfilter.h
+%{mingw32_includedir}/usbredirhost.h
+%{mingw32_includedir}/usbredirparser.h
+%{mingw32_includedir}/usbredirproto.h
+%{mingw32_libdir}/pkgconfig/libusbredirhost.pc
+%{mingw32_libdir}/pkgconfig/libusbredirparser.pc
+
+%files -n mingw32-usbredir-static
+%{mingw32_libdir}/libusbredirhost.a
+%{mingw32_libdir}/libusbredirparser.a
+
+%files -n mingw64-usbredir
+%doc ChangeLog COPYING.LIB README TODO
+%{mingw64_bindir}/libusbredirhost-1.dll
+%{mingw64_bindir}/libusbredirparser-0.dll
+%{mingw64_libdir}/libusbredirhost.dll.a
+%{mingw64_libdir}/libusbredirparser.dll.a
+%{mingw64_includedir}/usbredirfilter.h
+%{mingw64_includedir}/usbredirhost.h
+%{mingw64_includedir}/usbredirparser.h
+%{mingw64_includedir}/usbredirproto.h
+%{mingw64_libdir}/pkgconfig/libusbredirhost.pc
+%{mingw64_libdir}/pkgconfig/libusbredirparser.pc
+
+%files -n mingw64-usbredir-static
+%{mingw64_libdir}/libusbredirhost.a
+%{mingw64_libdir}/libusbredirparser.a
%changelog
* Mon May 21 2012 Marc-André Lureau <marcandre.lureau at redhat.com> - 0.4.3-1
-- Initial Fedora MinGW package.
-
+- Initial Fedora MinGW package
diff --git a/sources b/sources
index e69de29..e636d64 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+98464d74f867ded3bcab0078666d621f usbredir-0.4.3.tar.bz2
More information about the scm-commits
mailing list