mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-22 03:30:05 +02:00
Add recipe and patch for libusb-compat
(the 0.1 libusb API wrapper) For now it only builds with gcc2, it seems libtool wants to use a libstdc++ from an outdated gcc4 package and fails to get the symlink.
This commit is contained in:
78
dev-libs/libusb-compat/libusb_compat-0.1.5.recipe
Normal file
78
dev-libs/libusb-compat/libusb_compat-0.1.5.recipe
Normal file
@@ -0,0 +1,78 @@
|
||||
SUMMARY="libusb 0.1 API wrapper for libusb"
|
||||
DESCRIPTION="
|
||||
libusb is a C library that provides generic access to USB devices. \
|
||||
It is intended to be used by developers to facilitate the production \
|
||||
of applications that communicate with USB hardware.
|
||||
|
||||
libusb-compat is a wrapper library for software that use the 0.1 API.
|
||||
"
|
||||
LICENSE="GNU LGPL v2"
|
||||
COPYRIGHT="
|
||||
2008 Daniel Drake
|
||||
"
|
||||
HOMEPAGE="http://libusb.info/"
|
||||
SRC_URI="http://sourceforge.net/projects/libusb/files/libusb-compat-0.1/libusb-compat-0.1.5/libusb-compat-0.1.5.tar.bz2"
|
||||
CHECKSUM_SHA256="404ef4b6b324be79ac1bfb3d839eac860fbc929e6acb1ef88793a6ea328bc55a"
|
||||
REVISION="1"
|
||||
ARCHITECTURES="!x86 !x86_64 x86_gcc2"
|
||||
SECONDARY_ARCHITECTURES="!x86"
|
||||
|
||||
PROVIDES="
|
||||
libusb_compat$secondaryArchSuffix = $portVersion
|
||||
lib:libusb_0.1$secondaryArchSuffix = $portVersion
|
||||
lib:libusb$secondaryArchSuffix = $portVersion
|
||||
cmd:libusb_config$secondaryArchSuffix = $portVersion
|
||||
"
|
||||
REQUIRES="
|
||||
haiku$secondaryArchSuffix >= $haikuVersion
|
||||
lib:libstdc++$secondaryArchSuffix
|
||||
lib:libusb_1.0$secondaryArchSuffix
|
||||
"
|
||||
BUILD_REQUIRES="
|
||||
devel:libusb_1.0$secondaryArchSuffix
|
||||
"
|
||||
BUILD_PREREQUIRES="
|
||||
haiku${secondaryArchSuffix}_devel >= $haikuVersion
|
||||
cmd:autoconf
|
||||
cmd:automake
|
||||
cmd:libtool
|
||||
cmd:gcc$secondaryArchSuffix
|
||||
cmd:ld$secondaryArchSuffix
|
||||
cmd:make
|
||||
cmd:pkg_config$secondaryArchSuffix
|
||||
cmd:sed
|
||||
"
|
||||
SOURCE_DIR=libusb-compat-$portVersion
|
||||
|
||||
PATCHES="libusb_compat-0.1.5.patchset"
|
||||
|
||||
BUILD()
|
||||
{
|
||||
#sh bootstrap.sh
|
||||
runConfigure ./configure
|
||||
make $jobArgs
|
||||
}
|
||||
|
||||
INSTALL()
|
||||
{
|
||||
make install
|
||||
|
||||
# set up the develop directory correctly
|
||||
prepareInstalledDevelLibs libusb-0.1 libusb
|
||||
fixPkgconfig libusb-0.1
|
||||
|
||||
# devel package
|
||||
packageEntries devel \
|
||||
$developDir
|
||||
}
|
||||
|
||||
# ----- devel package -------------------------------------------------------
|
||||
|
||||
PROVIDES_devel="
|
||||
libusb_compat${secondaryArchSuffix}_devel = $portVersion
|
||||
devel:libusb_0.1${secondaryArchSuffix} = $portVersion
|
||||
devel:libusb$secondaryArchSuffix = $portVersion
|
||||
"
|
||||
REQUIRES_devel="
|
||||
libusb_compat${secondaryArchSuffix} == $portVersion base
|
||||
"
|
||||
233
dev-libs/libusb-compat/patches/libusb_compat-0.1.5.patchset
Normal file
233
dev-libs/libusb-compat/patches/libusb_compat-0.1.5.patchset
Normal file
@@ -0,0 +1,233 @@
|
||||
From 112d4b70e1ffb419b85f11472b102af50265189b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
|
||||
Date: Fri, 7 Nov 2014 23:21:52 +0100
|
||||
Subject: [PATCH 1/3] Drop unsupported gcc2 flags
|
||||
|
||||
---
|
||||
configure.ac | 2 +-
|
||||
libusb/Makefile.am | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index debfef2..397098d 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -56,7 +56,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], inline_cflags="-fgnu89-inline", inline_
|
||||
CFLAGS="$saved_cflags"
|
||||
|
||||
AC_DEFINE([API_EXPORTED], [__attribute__((visibility("default")))], [Default visibility])
|
||||
-AM_CFLAGS="-std=gnu99 $inline_cflags -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration -Wno-pointer-sign -Wshadow"
|
||||
+AM_CFLAGS="-std=gnu89 $inline_cflags -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration -Wshadow"
|
||||
AC_SUBST(AM_CFLAGS)
|
||||
|
||||
AC_CONFIG_FILES([libusb.pc] [libusb-config] [Makefile] [libusb/Makefile] [examples/Makefile])
|
||||
diff --git a/libusb/Makefile.am b/libusb/Makefile.am
|
||||
index 33a609a..b72849e 100644
|
||||
--- a/libusb/Makefile.am
|
||||
+++ b/libusb/Makefile.am
|
||||
@@ -2,7 +2,7 @@ include_HEADERS = usb.h
|
||||
lib_LTLIBRARIES = libusb.la
|
||||
|
||||
libusb_la_SOURCES = core.c usbi.h
|
||||
-libusb_la_CFLAGS = -fvisibility=hidden $(AM_CFLAGS) $(LIBUSB_1_0_CFLAGS)
|
||||
+libusb_la_CFLAGS = $(AM_CFLAGS) $(LIBUSB_1_0_CFLAGS)
|
||||
libusb_la_LIBADD = $(LIBUSB_1_0_LIBS)
|
||||
libusb_la_LDFLAGS = -version-info $(LT_MAJOR):$(LT_REVISION):$(LT_AGE) \
|
||||
-release 0.1
|
||||
--
|
||||
1.8.3.4
|
||||
|
||||
|
||||
From ccfa2f42d6b82fac02a77e2567689c3b7e2ddc3c Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
|
||||
Date: Sat, 8 Nov 2014 01:10:41 +0100
|
||||
Subject: [PATCH 2/3] C89
|
||||
|
||||
gcc2 requires C89
|
||||
---
|
||||
libusb/core.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libusb/core.c b/libusb/core.c
|
||||
index c0ccb1f..63567c5 100644
|
||||
--- a/libusb/core.c
|
||||
+++ b/libusb/core.c
|
||||
@@ -210,8 +210,8 @@ static int find_busses(struct usb_bus **ret)
|
||||
|
||||
/* if we already know about it, continue */
|
||||
if (busses) {
|
||||
- bus = busses;
|
||||
int found = 0;
|
||||
+ bus = busses;
|
||||
do {
|
||||
if (bus_num == bus->location) {
|
||||
found = 1;
|
||||
@@ -661,9 +661,10 @@ API_EXPORTED struct usb_bus *usb_get_busses(void)
|
||||
API_EXPORTED usb_dev_handle *usb_open(struct usb_device *dev)
|
||||
{
|
||||
int r;
|
||||
+ usb_dev_handle *udev;
|
||||
usbi_dbg("");
|
||||
|
||||
- usb_dev_handle *udev = malloc(sizeof(*udev));
|
||||
+ udev = malloc(sizeof(*udev));
|
||||
if (!udev)
|
||||
return NULL;
|
||||
|
||||
--
|
||||
1.8.3.4
|
||||
|
||||
|
||||
From b389cb382da70b40a422977639e7ecc91c855413 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
|
||||
Date: Mon, 11 Aug 2014 19:20:13 +0200
|
||||
Subject: [PATCH 3/3] Work around ugly return -EFOO constructs
|
||||
|
||||
Apps will also need to be fixed...
|
||||
---
|
||||
libusb/core.c | 39 ++++++++++++++++++++++-----------------
|
||||
1 file changed, 22 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/libusb/core.c b/libusb/core.c
|
||||
index 63567c5..c6fa4bb 100644
|
||||
--- a/libusb/core.c
|
||||
+++ b/libusb/core.c
|
||||
@@ -58,7 +58,12 @@ enum usbi_log_level {
|
||||
|
||||
API_EXPORTED struct usb_bus *usb_busses = NULL;
|
||||
|
||||
-#define compat_err(e) -(errno=libusb_to_errno(e))
|
||||
+#if (EINVAL < 0)
|
||||
+#define ret_err(e) (e)
|
||||
+#else
|
||||
+#define ret_err(e) -(e)
|
||||
+#endif
|
||||
+#define compat_err(e) (ret_err(errno=libusb_to_errno(e)))
|
||||
|
||||
static int libusb_to_errno(int result)
|
||||
{
|
||||
@@ -244,7 +249,7 @@ err:
|
||||
free(bus);
|
||||
bus = tbus;
|
||||
}
|
||||
- return -ENOMEM;
|
||||
+ return ret_err(ENOMEM);
|
||||
}
|
||||
|
||||
API_EXPORTED int usb_find_busses(void)
|
||||
@@ -352,7 +357,7 @@ err:
|
||||
free(dev);
|
||||
dev = tdev;
|
||||
}
|
||||
- return -ENOMEM;
|
||||
+ return ret_err(ENOMEM);
|
||||
}
|
||||
|
||||
static void clear_endpoint_descriptor(struct usb_endpoint_descriptor *ep)
|
||||
@@ -411,7 +416,7 @@ static int copy_endpoint_descriptor(struct usb_endpoint_descriptor *dest,
|
||||
if (src->extra_length) {
|
||||
dest->extra = malloc(src->extra_length);
|
||||
if (!dest->extra)
|
||||
- return -ENOMEM;
|
||||
+ return ret_err(ENOMEM);
|
||||
memcpy(dest->extra, src->extra, src->extra_length);
|
||||
}
|
||||
|
||||
@@ -428,7 +433,7 @@ static int copy_interface_descriptor(struct usb_interface_descriptor *dest,
|
||||
memcpy(dest, src, USB_DT_INTERFACE_SIZE);
|
||||
dest->endpoint = malloc(alloc_size);
|
||||
if (!dest->endpoint)
|
||||
- return -ENOMEM;
|
||||
+ return ret_err(ENOMEM);
|
||||
memset(dest->endpoint, 0, alloc_size);
|
||||
|
||||
for (i = 0; i < num_endpoints; i++) {
|
||||
@@ -444,7 +449,7 @@ static int copy_interface_descriptor(struct usb_interface_descriptor *dest,
|
||||
dest->extra = malloc(src->extra_length);
|
||||
if (!dest->extra) {
|
||||
clear_interface_descriptor(dest);
|
||||
- return -ENOMEM;
|
||||
+ return ret_err(ENOMEM);
|
||||
}
|
||||
memcpy(dest->extra, src->extra, src->extra_length);
|
||||
}
|
||||
@@ -463,7 +468,7 @@ static int copy_interface(struct usb_interface *dest,
|
||||
dest->num_altsetting = num_altsetting;
|
||||
dest->altsetting = malloc(alloc_size);
|
||||
if (!dest->altsetting)
|
||||
- return -ENOMEM;
|
||||
+ return ret_err(ENOMEM);
|
||||
memset(dest->altsetting, 0, alloc_size);
|
||||
|
||||
for (i = 0; i < num_altsetting; i++) {
|
||||
@@ -488,7 +493,7 @@ static int copy_config_descriptor(struct usb_config_descriptor *dest,
|
||||
memcpy(dest, src, USB_DT_CONFIG_SIZE);
|
||||
dest->interface = malloc(alloc_size);
|
||||
if (!dest->interface)
|
||||
- return -ENOMEM;
|
||||
+ return ret_err(ENOMEM);
|
||||
memset(dest->interface, 0, alloc_size);
|
||||
|
||||
for (i = 0; i < num_interfaces; i++) {
|
||||
@@ -504,7 +509,7 @@ static int copy_config_descriptor(struct usb_config_descriptor *dest,
|
||||
dest->extra = malloc(src->extra_length);
|
||||
if (!dest->extra) {
|
||||
clear_config_descriptor(dest);
|
||||
- return -ENOMEM;
|
||||
+ return ret_err(ENOMEM);
|
||||
}
|
||||
memcpy(dest->extra, src->extra, src->extra_length);
|
||||
}
|
||||
@@ -532,7 +537,7 @@ static int initialize_device(struct usb_device *dev)
|
||||
alloc_size = sizeof(struct usb_config_descriptor) * num_configurations;
|
||||
dev->config = malloc(alloc_size);
|
||||
if (!dev->config)
|
||||
- return -ENOMEM;
|
||||
+ return ret_err(ENOMEM);
|
||||
memset(dev->config, 0, alloc_size);
|
||||
|
||||
/* even though structures are identical, we can't just use libusb-1.0's
|
||||
@@ -734,7 +739,7 @@ API_EXPORTED int usb_set_altinterface(usb_dev_handle *dev, int alternate)
|
||||
{
|
||||
usbi_dbg("alternate %d", alternate);
|
||||
if (dev->last_claimed_interface < 0)
|
||||
- return -(errno=EINVAL);
|
||||
+ return ret_err(errno=EINVAL);
|
||||
|
||||
return compat_err(libusb_set_interface_alt_setting(dev->handle,
|
||||
dev->last_claimed_interface, alternate));
|
||||
@@ -919,7 +924,7 @@ API_EXPORTED int usb_get_driver_np(usb_dev_handle *dev, int interface,
|
||||
snprintf(name, namelen, "dummy");
|
||||
return 0;
|
||||
} else if (r == 0) {
|
||||
- return -(errno=ENODATA);
|
||||
+ return ret_err(errno=ENODATA);
|
||||
} else {
|
||||
return compat_err(r);
|
||||
}
|
||||
@@ -932,17 +937,17 @@ API_EXPORTED int usb_detach_kernel_driver_np(usb_dev_handle *dev, int interface)
|
||||
case LIBUSB_SUCCESS:
|
||||
return 0;
|
||||
case LIBUSB_ERROR_NOT_FOUND:
|
||||
- return -ENODATA;
|
||||
+ return ret_err(ENODATA);
|
||||
case LIBUSB_ERROR_INVALID_PARAM:
|
||||
- return -EINVAL;
|
||||
+ return ret_err(EINVAL);
|
||||
case LIBUSB_ERROR_NO_DEVICE:
|
||||
- return -ENODEV;
|
||||
+ return ret_err(ENODEV);
|
||||
case LIBUSB_ERROR_OTHER:
|
||||
- return -errno;
|
||||
+ return ret_err(errno);
|
||||
/* default can be reached only in non-Linux implementations,
|
||||
* mostly with LIBUSB_ERROR_NOT_SUPPORTED. */
|
||||
default:
|
||||
- return -ENOSYS;
|
||||
+ return ret_err(ENOSYS);
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
1.8.3.4
|
||||
|
||||
Reference in New Issue
Block a user