Import of libusb-0.1.3b

libusb provides a library for application access to USB
devices.

Port based on FreeBSD/NetBSD
This commit is contained in:
pvalchev 2001-08-20 06:23:00 +00:00
parent c4314741d7
commit b4de21dc27
11 changed files with 276 additions and 0 deletions

27
devel/libusb/Makefile Normal file
View File

@ -0,0 +1,27 @@
# $OpenBSD: Makefile,v 1.1.1.1 2001/08/20 06:23:00 pvalchev Exp $
COMMENT= "usb access library"
VERSION= 0.1.3b
DISTNAME= libusb-${VERSION}
CATEGORIES= devel
NEED_VERSION= 1.440
HOMEPAGE= http://libusb.sourceforge.net/
MAINTAINER= Peter Valchev <pvalchev@openbsd.org>
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= libusb
SEPARATE_BUILD= concurrent
CONFIGURE_STYLE= gnu
CONFIGURE_ARGS+= ${CONFIGURE_SHARED}
CONFIGURE_ARGS+= --enable-static
.include <bsd.port.mk>

3
devel/libusb/files/md5 Normal file
View File

@ -0,0 +1,3 @@
MD5 (libusb-0.1.3b.tar.gz) = a5d80dff371935ca0bb0e4f9547ac401
RMD160 (libusb-0.1.3b.tar.gz) = 8725ea753e1f1c289606f1be7357c28318219d6e
SHA1 (libusb-0.1.3b.tar.gz) = ff64bf2c093f37c3f3b4ebbb40601f49e1d5fb64

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-Makefile_in,v 1.1.1.1 2001/08/20 06:23:00 pvalchev Exp $
--- Makefile.in.orig Sat Jan 13 13:18:06 2001
+++ Makefile.in Sun Aug 19 23:46:10 2001
@@ -108,7 +108,7 @@ libusb_la_SOURCES = usb.c usbi.h error.c
include_HEADERS = usb.h
-libusb_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE) -export-dynamic
+libusb_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -export-dynamic
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-configure,v 1.1.1.1 2001/08/20 06:23:00 pvalchev Exp $
--- configure.orig Sat Jan 13 13:17:45 2001
+++ configure Sun Aug 19 23:44:47 2001
@@ -1605,7 +1605,7 @@ EOF
os_support=linux
echo "$ac_t""Linux" 1>&6
;;
- *-freebsd*)
+ *-freebsd*|*-netbsd*|*-openbsd*)
cat >> confdefs.h <<\EOF
#define FREEBSD 1
EOF

View File

@ -0,0 +1,69 @@
$OpenBSD: patch-freebsd_c,v 1.1.1.1 2001/08/20 06:23:00 pvalchev Exp $
--- freebsd.c.orig Mon Oct 9 16:08:22 2000
+++ freebsd.c Sun Aug 19 23:44:47 2001
@@ -41,16 +41,18 @@ int usb_os_open(usb_dev_handle *dev)
{
int i;
struct freebsd_usb_dev_handle_info *info;
+ char ctlpath[PATH_MAX];
info = malloc(sizeof(*info));
if (!info)
USB_ERROR(-ENOMEM);
dev->impl_info = info;
- dev->fd = open(dev->device->filename, O_RDWR);
+ snprintf(ctlpath, PATH_MAX, "%s.00", dev->device->filename);
+ dev->fd = open(ctlpath, O_RDWR);
if (dev->fd < 0)
{
- dev->fd = open(dev->device->filename, O_RDONLY);
+ dev->fd = open(ctlpath, O_RDONLY);
if (dev->fd < 0)
{
free(info);
@@ -152,10 +154,10 @@ static int ensure_ep_open(usb_dev_handle
if(info->ep_fd[ep] < 0)
{
- sprintf(buf, "%s.%d", dev->device->filename, ep);
- fd = open(buf, O_RDONLY);
+ sprintf(buf, "%s.%02d", dev->device->filename, ep);
+ fd = open(buf, mode);
if(fd < 0)
- USB_ERROR_STR(fd, "can't open %s for bulk read: %s\n",
+ USB_ERROR_STR(fd, "can't open %s for bulk operations: %s\n",
buf, strerror(errno));
info->ep_fd[ep] = fd;
}
@@ -234,10 +236,12 @@ int usb_control_msg(usb_dev_handle *dev,
req.data = bytes;
req.flags = 0;
+#if 0
ret = ioctl(dev->fd, USB_SET_TIMEOUT, &timeout);
if (ret < 0)
USB_ERROR_STR(ret, "error setting timeout: %s",
strerror(errno));
+#endif
ret = ioctl(dev->fd, USB_DO_REQUEST, &req);
if (ret < 0)
@@ -285,7 +289,7 @@ int usb_find_devices_on_bus(struct usb_b
/* Open its control endpoint */
- sprintf(buf, "/dev/%s", di.devnames[0]);
+ sprintf(buf, "/dev/%s.00", di.devnames[0]);
dfd = open(buf, O_RDONLY);
if(dfd < 0)
{
@@ -302,7 +306,7 @@ int usb_find_devices_on_bus(struct usb_b
dev->bus = bus;
- strcpy(dev->filename, buf);
+ sprintf(dev->filename, "/dev/%s", di.devnames[0]);
if(ioctl(dfd, USB_GET_DEVICE_DESC, &dev->descriptor) < 0)
USB_ERROR_STR(-errno, "couldn't get device descriptor for %s: %s",

View File

@ -0,0 +1,10 @@
$OpenBSD: patch-libusb-config_in,v 1.1.1.1 2001/08/20 06:23:00 pvalchev Exp $
--- libusb-config.in.orig Wed Feb 16 15:09:31 2000
+++ libusb-config.in Sun Aug 19 23:44:47 2001
@@ -75,5 +75,5 @@ if test "$echo_cflags" = "yes"; then
echo $includes
fi
if test "$echo_libs" = "yes"; then
- echo -L@libdir@ -lusb
+ echo -L@libdir@ -Wl,-R@libdir@ -lusb
fi

View File

@ -0,0 +1,57 @@
$OpenBSD: patch-ltconfig,v 1.1.1.1 2001/08/20 06:23:00 pvalchev Exp $
--- ltconfig.orig Thu Jul 15 13:31:35 1999
+++ ltconfig Sun Aug 19 23:42:57 2001
@@ -1105,6 +1105,9 @@ cygwin* | mingw*)
with_gnu_ld=no
fi
;;
+openbsd*)
+ with_gnu_ld=no
+ ;;
esac
@@ -1391,10 +1394,21 @@ else
;;
openbsd*)
- archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'
- hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
hardcode_shlibpath_var=no
+ case "$host_os" in
+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'
+ hardcode_libdir_flag_spec='-R$libdir'
+ ;;
+ *)
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linkopts'
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ if test "`echo __ELF__ | $CC -E - | grep __ELF__`" = "" -o "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ export_dynamic_flag_spec='${wl}-E'
+ fi
+ ;;
+ esac
;;
os2*)
@@ -1955,9 +1969,16 @@ netbsd*)
openbsd*)
version_type=sunos
- if test "$with_gnu_ld" = yes; then
- need_lib_prefix=no
- need_version=no
+ need_lib_prefix=no
+ need_version=no
+ file_magic_cmd=/usr/bin/file
+ file_magic_test_file=`echo /usr/lib/libc.so.*`
+ if test "`echo __ELF__ | $CC -E - | grep __ELF__`" = "" -o "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'
+ shlibpath_overrides_runpath=no
+ else
+ deplibs_check_method='file_magic OpenBSD.* shared library'
+ shlibpath_overrides_runpath=yes
fi
library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'

View File

@ -0,0 +1,73 @@
$OpenBSD: patch-ltmain_sh,v 1.1.1.1 2001/08/20 06:23:00 pvalchev Exp $
--- ltmain.sh.orig Thu Jul 15 13:31:35 1999
+++ ltmain.sh Sun Aug 19 23:43:00 2001
@@ -1073,6 +1073,17 @@ compiler."
# These systems don't actually have c library (as such)
continue
;;
+ *-*-openbsd*)
+ # Do not include libc due to us having libc/libc_r.
+ continue
+ ;;
+ esac
+ elif test "$arg" = "-lc_r"; then
+ case "$host" in
+ *-*-openbsd*)
+ # Do not include libc_r directly, use -pthread flag.
+ continue
+ ;;
esac
elif test "$arg" = "-lm"; then
case "$host" in
@@ -1085,6 +1096,10 @@ compiler."
deplibs="$deplibs $arg"
;;
+ -?thread)
+ deplibs="$deplibs $arg"
+ ;;
+
-module)
module=yes
continue
@@ -3522,40 +3537,6 @@ libdir='$install_libdir'\
# Exit here if they wanted silent mode.
test "$show" = : && exit 0
- echo "----------------------------------------------------------------------"
- echo "Libraries have been installed in:"
- for libdir in $libdirs; do
- echo " $libdir"
- done
- echo
- echo "If you ever happen to want to link against installed libraries"
- echo "in a given directory, LIBDIR, you must either use libtool, and"
- echo "specify the full pathname of the library, or use \`-LLIBDIR'"
- echo "flag during linking and do at least one of the following:"
- if test -n "$shlibpath_var"; then
- echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
- echo " during execution"
- fi
- if test -n "$runpath_var"; then
- echo " - add LIBDIR to the \`$runpath_var' environment variable"
- echo " during linking"
- fi
- if test -n "$hardcode_libdir_flag_spec"; then
- libdir=LIBDIR
- eval flag=\"$hardcode_libdir_flag_spec\"
-
- echo " - use the \`$flag' linker flag"
- fi
- if test -n "$admincmds"; then
- echo " - have your system administrator run these commands:$admincmds"
- fi
- if test -f /etc/ld.so.conf; then
- echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
- fi
- echo
- echo "See any operating system documentation about shared libraries for"
- echo "more information, such as the ld(1) and ld.so(8) manual pages."
- echo "----------------------------------------------------------------------"
exit 0
;;

4
devel/libusb/pkg/DESCR Normal file
View File

@ -0,0 +1,4 @@
libusb provides a library for application access to
USB devices.
WWW: ${HOMEPAGE}

View File

@ -0,0 +1,3 @@
@comment $OpenBSD: PFRAG.shared,v 1.1.1.1 2001/08/20 06:23:00 pvalchev Exp $
lib/libusb.so.3.0
DYNLIBDIR(%B)

6
devel/libusb/pkg/PLIST Normal file
View File

@ -0,0 +1,6 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2001/08/20 06:23:00 pvalchev Exp $
bin/libusb-config
include/usb.h
lib/libusb.a
lib/libusb.la
%%SHARED%%