diff options
author | tijl <tijl@FreeBSD.org> | 2014-01-30 05:01:51 +0800 |
---|---|---|
committer | tijl <tijl@FreeBSD.org> | 2014-01-30 05:01:51 +0800 |
commit | f2afc14e9aa083703ebf47ee2e00240abd7cf247 (patch) | |
tree | 20343cfc02c6ca5621587bc43a4dbae667d7e04c /comms/hidapi | |
parent | 52ccf96e04afaf41dc52da7e2ce5cf3edad3a4b3 (diff) | |
download | freebsd-ports-gnome-f2afc14e9aa083703ebf47ee2e00240abd7cf247.tar.gz freebsd-ports-gnome-f2afc14e9aa083703ebf47ee2e00240abd7cf247.tar.zst freebsd-ports-gnome-f2afc14e9aa083703ebf47ee2e00240abd7cf247.zip |
- Remove part of a patch that wasn't entirely correct and let the port
use the WCHAR_T iconv extension instead.
- Add USES=libtool and let libtoolize copy the necessary files instead of
symlinking them such that they can be patched.
- Add a configure check for libusb_handle_events_completed.
Diffstat (limited to 'comms/hidapi')
-rw-r--r-- | comms/hidapi/Makefile | 6 | ||||
-rw-r--r-- | comms/hidapi/files/patch-configure.ac | 7 | ||||
-rw-r--r-- | comms/hidapi/files/patch-libusb-hid.c | 50 | ||||
-rw-r--r-- | comms/hidapi/pkg-plist | 1 |
4 files changed, 13 insertions, 51 deletions
diff --git a/comms/hidapi/Makefile b/comms/hidapi/Makefile index ef644514e36f..d86efc7b9b73 100644 --- a/comms/hidapi/Makefile +++ b/comms/hidapi/Makefile @@ -2,6 +2,7 @@ PORTNAME= hidapi DISTVERSION= 0.8.0-rc1 +PORTREVISION= 1 CATEGORIES= comms MAINTAINER= tijl@FreeBSD.org @@ -16,9 +17,10 @@ GH_TAGNAME= ${PORTNAME}-${DISTVERSION} GH_COMMIT= 40cf516 USE_AUTOTOOLS= aclocal autoconf autoheader automake libtoolize -AUTOMAKE_ARGS= --add-missing +AUTOMAKE_ARGS= --add-missing --copy +LIBTOOLIZE_ARGS=--copy -USES= iconv +USES= iconv:wchar_t libtool USE_LDCONFIG= yes .include <bsd.port.mk> diff --git a/comms/hidapi/files/patch-configure.ac b/comms/hidapi/files/patch-configure.ac index c443da8ec654..23416d36d6cc 100644 --- a/comms/hidapi/files/patch-configure.ac +++ b/comms/hidapi/files/patch-configure.ac @@ -1,12 +1,11 @@ --- configure.ac.orig +++ configure.ac -@@ -93,7 +93,8 @@ - LDFLAGS="$LDFLAGS -L/usr/local/lib" +@@ -94,6 +94,8 @@ LIBS="${LIBS}" AC_CHECK_LIB([usb], [libusb_init], [LIBS_LIBUSB_PRIVATE="${LIBS_LIBUSB_PRIVATE} -lusb"], [hidapi_lib_error libusb]) -- AC_CHECK_LIB([iconv], [iconv_open], [LIBS_LIBUSB_PRIVATE="${LIBS_LIBUSB_PRIVATE} -liconv"], [hidapi_lib_error libiconv]) + AC_CHECK_LIB([iconv], [iconv_open], [LIBS_LIBUSB_PRIVATE="${LIBS_LIBUSB_PRIVATE} -liconv"], [hidapi_lib_error libiconv]) + AC_CHECK_DECLS([libusb_get_string_descriptor], [], [], [[#include <libusb.h>]]) -+ AC_SEARCH_LIBS([iconv_open], [iconv], [], [hidapi_lib_error libiconv]) ++ AC_CHECK_DECLS([libusb_handle_events_completed], [], [], [[#include <libusb.h>]]) echo libs_priv: $LIBS_LIBUSB_PRIVATE ;; *-mingw*) diff --git a/comms/hidapi/files/patch-libusb-hid.c b/comms/hidapi/files/patch-libusb-hid.c index 5a8968eab24e..96d0cd651584 100644 --- a/comms/hidapi/files/patch-libusb-hid.c +++ b/comms/hidapi/files/patch-libusb-hid.c @@ -18,55 +18,15 @@ /* The FreeBSD version of libusb doesn't have this funciton. In mainline libusb, it's inlined in libusb.h. This function will bear a striking resemblence to that one, because there's about one way to code it. -@@ -324,6 +326,7 @@ - static wchar_t *get_usb_string(libusb_device_handle *dev, uint8_t idx) - { - char buf[512]; -+ char buf2[512]; - int len; - wchar_t *str = NULL; - wchar_t wbuf[256]; -@@ -359,7 +362,7 @@ - it is only passed into iconv() which does not need it. */ - - /* Initialize iconv. */ -- ic = iconv_open("WCHAR_T", "UTF-16LE"); -+ ic = iconv_open("char", "UTF-16LE"); - if (ic == (iconv_t)-1) { - LOG("iconv_open() failed\n"); - return NULL; -@@ -369,18 +372,21 @@ - Skip the first character (2-bytes). */ - inptr = buf+2; - inbytes = len-2; -- outptr = (char*) wbuf; -- outbytes = sizeof(wbuf); -+ outptr = buf2; -+ outbytes = sizeof(buf2); - res = iconv(ic, &inptr, &inbytes, &outptr, &outbytes); - if (res == (size_t)-1) { - LOG("iconv() failed\n"); - goto err; - } -+ res = mbstowcs(wbuf, buf2, sizeof(wbuf)/sizeof(wbuf[0])); -+ if (res == (size_t)-1) { -+ LOG("mbstowcs() failed\n"); -+ goto err; -+ } - - /* Write the terminating NULL. */ - wbuf[sizeof(wbuf)/sizeof(wbuf[0])-1] = 0x00000000; -- if (outbytes >= sizeof(wbuf[0])) -- *((wchar_t*)outptr) = 0x00000000; - - /* Allocate and copy the string. */ - str = wcsdup(wbuf); -@@ -757,7 +763,7 @@ +@@ -757,7 +757,11 @@ libusb_cancel_transfer(dev->transfer); while (!dev->cancelled) -- libusb_handle_events_completed(usb_context, &dev->cancelled); ++#if HAVE_DECL_LIBUSB_HANDLE_EVENTS_COMPLETED + libusb_handle_events_completed(usb_context, &dev->cancelled); ++#else + libusb_handle_events(usb_context); ++#endif /* Now that the read thread is stopping, Wake any threads which are waiting on data (in hid_read_timeout()). Do this under a mutex to diff --git a/comms/hidapi/pkg-plist b/comms/hidapi/pkg-plist index 21941c92edc6..080770b4c595 100644 --- a/comms/hidapi/pkg-plist +++ b/comms/hidapi/pkg-plist @@ -3,5 +3,6 @@ lib/libhidapi.a lib/libhidapi.la lib/libhidapi.so lib/libhidapi.so.0 +lib/libhidapi.so.0.0.0 libdata/pkgconfig/hidapi.pc @dirrm include/hidapi |