[weasel-commit] Source: libusb=0.1.12-4

  • From: rbuilder@xxxxxxxxx
  • To: weasel-commit@xxxxxxxxxxxxx
  • Date: Thu, 14 Jan 2010 11:58:53 -0500

================================
libusb:source=0.1.12-4 (previous: 0.1.12-3)
cvc rdiff libusb -1 /weasel.rpath.org@wgl:3-devel/0.1.12-4
================================
0.1.12-4 Filip Brcic (brcha@xxxxxxx) Thu Jan 14 11:58:36 2010
    fixed recipe + metadata

libusb-0.1.12-no-infinite-bulk.patch: new
--- /dev/null
+++ libusb-0.1.12-no-infinite-bulk.patch
@@ -0,0 +24 @@
+Patch-from: http://bugs.gentoo.org/show_bug.cgi?id=225879
+Gentoo-Bug: 225879
+Signed-off-by: Robin H. Johnson <robbat2@xxxxxxxxxx>
+
+Prevents an infinite loop if device is removed during usb_bulk_read or
+usb_bulk_write.
+
+diff -Naur libusb-0.1.12/linux.c libusb-0.1.12-new/linux.c
+--- libusb-0.1.12/linux.c      2006-03-04 04:52:46.000000000 +0200
++++ libusb-0.1.12-new/linux.c  2008-06-11 14:22:20.000000000 +0300
+@@ -220,6 +220,13 @@
+     waiting = 1;
+     context = NULL;
+     while (!urb.usercontext && ((ret = ioctl(dev->fd, 
IOCTL_USB_REAPURBNDELAY, &context)) == -1) && waiting) {
++      if (ret == -1)
++      {
++              if (errno == ENODEV)
++      {
++        return -ENODEV;
++      }
++      }
+       tv.tv_sec = 0;
+       tv.tv_usec = 1000; // 1 msec
+       select(dev->fd + 1, NULL, &writefds, NULL, &tv); //sub second wait

libusb.recipe: changed
Index: libusb.recipe
====================================================================
contents(size sha1)
inode(mtime)
--- libusb.recipe /weasel.rpath.org@wgl:3-devel/0.1.12-3
+++ libusb.recipe /weasel.rpath.org@wgl:3-devel/0.1.12-4
@@ -1,45 +1,50 @@
 #
-# Copyright (c) 2004-2006 rPath, Inc.
-# This file is distributed under the terms of the MIT License.
-# A copy is available at http://www.rpath.com/permanent/mit-license.html
+# Copyright (c) 2010 Filip Brcic <brcha@xxxxxxxxxxxx>
+# Distributed under the terms of the GNU General Public License v3
 #
 
-class Libusb(CPackageRecipe):
+class Libusb(AutoPackageRecipe):
     name = 'libusb'
     version = '0.1.12'
 
     buildRequires = [
-        'libstdc++:devel', 'pkg-config:devel', 'gcc-c++:runtime',
+        'autoconf:runtime', 'automake:runtime', 'libstdc++:devel',
+        'libtool:runtime', 'pkg-config:devel'
         ]
 
-    if Arch.x86_64:
-        buildRequires.extend(['multiarch_wrapper:runtime'])
+    shortDesc  = 'USB library'
+    longDesc   = 'Userspace access to USB devices'
+    url        = 'http://libusb.sourceforge.net/'
+    licenses   = [ 'LGPL-2' ]
+    categories = [ 'Development/Library' ]
 
-    def setup(r):
+    def unpack(r):
         r.addArchive('mirror://sourceforge/libusb/')
 
-        r.macros.cflags += ' -fPIC'
-        r.macros.cppflags += ' -fPIC'
+        r.Replace('-Werror', '', 'Makefile.am')
 
-        if Arch.x86_64:
-            # First build 32bit version
-            macros32 = r.macros.copy()
-            macros32.cc = '"gcc -m32"'
-            macros32.cxx = '"g++ -m32"'
-            macros32.libdir = '%(prefix)s/lib'
+        r.Replace('AC_LANG_CPLUSPLUS', 'AC_PROG_CXX', 'configure.in')
+        
+        r.addPatch('0.1.12-fbsd.patch')
+        r.addPatch('libusb-0.1.12-no-infinite-bulk.patch')
 
-            r.Configure(objDir='build32', overrideMacros=macros32)
-            r.Make(dir='build32', overrideMacros=macros32)
-            r.MakeInstall(dir='build32', overrideMacros=macros32)
-            r.Move('%(bindir)s/libusb-config', '%(bindir)s/libusb-config-32')
-            r.ComponentSpec('devel', '%(bindir)s/libusb-config-32')
-            r.NormalizePkgConfig(exceptions='.*')
+        r.Autoreconf()
 
-        r.Configure()
-        r.Make()
-        r.MakeInstall()
+        r.macros.docbookdtd = 
'%(datadir)s/sgml/docbook/sgml-dtd-4.2/docbook.dtd'
+        r.macros.sysid = '"-//OASIS//DTD DocBook V4.2//EN"'
 
-        if Arch.x86_64:
-            r.Move('%(bindir)s/libusb-config', '%(bindir)s/libusb-config-64')
-            r.ComponentSpec('devel', '%(bindir)s/libusb-config-64')
-            r.Symlink('%(bindir)s/multiarch_wrapper', 
'%(bindir)s/libusb-config')
+        # Ensure that the documentation actually finds the DTD it needs
+        # r.Replace('(%(sysid)s) \\[\\$' % r.macros,
+        #           '\\1 \\"%(docbookdtd)s\\" \\[' % r.macros,
+        #           'doc/manual.sgml')
+
+    def configure(r):
+        r.Configure(
+#            ' --enable-build-docs' # once openjade&co are built
+            )
+
+    def policy(r):
+        r.Move('%(libdir)s/libusb-0.1.so.*',
+               '%(essentiallibdir)s/')
+        r.Symlink('%(essentiallibdir)s/libusb-0.1.so.4',
+                  '%(libdir)s/libusb.so')


0.1.12-fbsd.patch: new
--- /dev/null
+++ 0.1.12-fbsd.patch
@@ -0,0 +97 @@
+Index: libusb-0.1.12/configure.in
+===================================================================
+--- libusb-0.1.12.orig/configure.in
++++ libusb-0.1.12/configure.in
+@@ -90,6 +90,8 @@ LINUX_API=0
+ DARWIN_API=0
+ BSD_API=0
+ 
++DEFINE_USB_HID_DESCRIPTOR=1
++
+ AC_MSG_CHECKING(for what USB OS support)
+ case $host in
+   *-linux*)
+@@ -101,13 +103,40 @@ case $host in
+     AC_MSG_RESULT(Linux)
+     OSLIBS=""
+     ;;
+-  *-freebsd*|*-kfreebsd*-gnu|*-openbsd*|*-netbsd*)
++  *-freebsd*)
++    AC_DEFINE(BSD_API, 1)
++    AC_DEFINE(LINUX_API, 0)
++    AC_DEFINE(DARWIN_API, 0)
++    BSD_API=1
++    os_support=bsd
++    AC_MSG_RESULT(FreeBSD)
++    OSLIBS=""
++    AC_CHECK_HEADERS([dev/usb/usbhid.h])
++    if test "x$ac_cv_header_dev_usb_hisbhid_h" = "xyes"; then
++      AC_MSG_CHECKING([for usb_hid_descriptor])
++      have_usb_hid_descriptor=no
++      AC_TRY_COMPILE([
++        #include <sys/types.h>
++        #include <dev/usb/usb.h>
++        #include <dev/usb/usbhid.h>
++      ], [
++        struct usb_hid_descriptor descr;
++      ], [
++        have_usb_hid_descriptor=yes
++      ])
++      AC_MSG_RESULT([$have_usb_hid_descriptor])
++      if test "x$have_usb_hid_descriptor" = "xyes"; then
++        DEFINE_USB_HID_DESCRIPTOR=0
++      fi
++    fi
++    ;;
++  *-dragonfly*|*-kfreebsd*-gnu|*-openbsd*|*-netbsd*)
+     AC_DEFINE(BSD_API, 1)
+     AC_DEFINE(LINUX_API, 0)
+     AC_DEFINE(DARWIN_API, 0)
+     BSD_API=1
+     os_support=bsd
+-    AC_MSG_RESULT(FreeBSD, OpenBSD and/or NetBSD)
++    AC_MSG_RESULT(DragonFly, OpenBSD and/or NetBSD)
+     OSLIBS=""
+     ;;
+   *-darwin*)
+@@ -128,6 +157,7 @@ esac
+ AC_SUBST(DARWIN_API)
+ AC_SUBST(LINUX_API)
+ AC_SUBST(BSD_API)
++AC_SUBST(DEFINE_USB_HID_DESCRIPTOR)
+ 
+ AM_CONDITIONAL(LINUX_API, test "$os_support" = "linux")
+ AM_CONDITIONAL(BSD_API, test "$os_support" = "bsd")
+Index: libusb-0.1.12/usb.h.in
+===================================================================
+--- libusb-0.1.12.orig/usb.h.in
++++ libusb-0.1.12/usb.h.in
+@@ -17,6 +17,12 @@
+ 
+ #include <dirent.h>
+ 
++#if ! @DEFINE_USB_HID_DESCRIPTOR@ && defined(__FreeBSD__)
++#include <sys/types.h>
++#include <dev/usb/usb.h>
++#include <dev/usb/usbhid.h>
++#endif
++
+ /*
+  * USB spec information
+  *
+@@ -75,6 +81,7 @@ struct usb_string_descriptor {
+       u_int16_t wData[1];
+ };
+ 
++#if ! @DEFINE_USB_HID_DESCRIPTOR@ && defined(__FreeBSD__)
+ /* HID descriptor */
+ struct usb_hid_descriptor {
+       u_int8_t  bLength;
+@@ -86,6 +93,7 @@ struct usb_hid_descriptor {
+       /* u_int16_t wDescriptorLength; */
+       /* ... */
+ };
++#endif
+ 
+ /* Endpoint descriptor */
+ #define USB_MAXENDPOINTS      32


Committed by: brcha

Other related posts: