libusb override port

Emiel Kollof coolvibe at hackerheaven.org
Sun Feb 8 14:59:03 PST 2004


It's broken on dragonfly, so included is a override port for libusb, which is 
needed for gphoto and SANE.

Cheers,
Emiel
-- 
. .. at least I thought I was dancing, 'til somebody stepped on my hand.
		-- J. B. White
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	devel/libusb/
#	devel/libusb/files
#	devel/libusb/files/patch-dfly-bsd.c
#	devel/libusb/files/patch-bsd.c
#	devel/libusb/files/patch-ltmain.sh
#	devel/libusb/Makefile
#	devel/libusb/distinfo
#	devel/libusb/pkg-descr
#	devel/libusb/pkg-plist
#
echo c - devel/libusb/
mkdir -p devel/libusb/ > /dev/null 2>&1
echo c - devel/libusb/files
mkdir -p devel/libusb/files > /dev/null 2>&1
echo x - devel/libusb/files/patch-dfly-bsd.c
sed 's/^X//' >devel/libusb/files/patch-dfly-bsd.c << 'END-of-devel/libusb/files/patch-dfly-bsd.c'
Xdiff -urN ./bsd.c ../../libusb-patched/bsd.c
X--- ./bsd.c	Sun Feb  8 23:50:01 2004
X+++ ../../libusb-patched/bsd.c	Sun Feb  8 23:45:56 2004
X@@ -35,14 +35,18 @@
X #include <sys/time.h>
X #include <sys/ioctl.h>
X 
X+#ifndef __DragonFly__
X #include <dev/usb/usb.h>
X+#else
X+#include <bus/usb/usb.h>
X+#endif
X 
X #include "usbi.h"
X #ifdef HAVE_CONFIG_H
X #include "config.h"
X #endif
X 
X-#ifdef HAVE_OLD_DEV_USB_USB_H
X+#if defined(HAVE_OLD_DEV_USB_USB_H) && !defined(__DragonFly__)
X /* It appears some of the BSD's (OpenBSD atleast) have switched over to a */
X /* new naming convention, so we setup some macro's for backward */
X /* compability with older versions --jerdfelt */
END-of-devel/libusb/files/patch-dfly-bsd.c
echo x - devel/libusb/files/patch-bsd.c
sed 's/^X//' >devel/libusb/files/patch-bsd.c << 'END-of-devel/libusb/files/patch-bsd.c'
X--- bsd.c.orig	Mon Nov 11 19:04:16 2002
X+++ bsd.c	Sun Nov 23 15:51:49 2003
X@@ -276,7 +276,7 @@
X int usb_bulk_write(usb_dev_handle *dev, int ep, char *bytes, int size,
X                    int timeout)
X {
X-  int fd, ret, sent = 0;
X+  int fd, ret;
X 
X   /* Ensure the endpoint address is correct */
X   ep &= ~USB_ENDPOINT_IN;
X@@ -298,8 +298,7 @@
X     USB_ERROR_STR(ret, "error setting timeout: %s",
X                   strerror(errno));
X 
X-  do {
X-    ret = write(fd, bytes+sent, size-sent);
X+    ret = write(fd, bytes, size);
X     if (ret < 0)
X #if __FreeBSD__
X       USB_ERROR_STR(ret, "error writing to bulk endpoint %s.%d: %s",
X@@ -309,16 +308,13 @@
X                   dev->device->filename, UE_GET_ADDR(ep), strerror(errno));
X #endif
X 
X-    sent += ret;
X-  } while(ret > 0 && sent < size);
X-
X-  return sent;
X+  return ret;
X }
X 
X int usb_bulk_read(usb_dev_handle *dev, int ep, char *bytes, int size,
X                   int timeout)
X {
X-  int fd, ret, retrieved = 0, one = 1;
X+  int fd, ret, one = 1;
X 
X   /* Ensure the endpoint address is correct */
X   ep |= USB_ENDPOINT_IN;
X@@ -345,8 +341,7 @@
X     USB_ERROR_STR(ret, "error setting short xfer: %s",
X                   strerror(errno));
X 
X-  do {
X-    ret = read(fd, bytes+retrieved, size-retrieved);
X+    ret = read(fd, bytes, size);
X     if (ret < 0)
X #if __FreeBSD__
X       USB_ERROR_STR(ret, "error reading from bulk endpoint %s.%d: %s",
X@@ -355,10 +350,8 @@
X       USB_ERROR_STR(ret, "error reading from bulk endpoint %s.%02d: %s",
X                   dev->device->filename, UE_GET_ADDR(ep), strerror(errno));
X #endif
X-    retrieved += ret;
X-  } while (ret > 0 && retrieved < size);
X 
X-  return retrieved;
X+  return ret;
X }
X 
X int usb_control_msg(usb_dev_handle *dev, int requesttype, int request,
END-of-devel/libusb/files/patch-bsd.c
echo x - devel/libusb/files/patch-ltmain.sh
sed 's/^X//' >devel/libusb/files/patch-ltmain.sh << 'END-of-devel/libusb/files/patch-ltmain.sh'
X--- ltmain.sh.orig	Sat Sep 22 20:10:52 2001
X+++ ltmain.sh	Tue Nov 20 21:14:55 2001
X@@ -2444,6 +2444,9 @@
X 	  *-*-openbsd*)
X 	    # Do not include libc due to us having libc/libc_r.
X 	    ;;
X+	  *-*-freebsd*)
X+	    # FreeBSD doesn't need this...
X+	    ;;
X 	  *)
X 	    # Add libc to deplibs on all other systems if necessary.
X 	    if test $build_libtool_need_lc = "yes"; then
X@@ -4210,10 +4213,12 @@
X 	fi
X 
X 	# Install the pseudo-library for information purposes.
X+	if false; then
X 	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
X 	instname="$dir/$name"i
X 	$show "$install_prog $instname $destdir/$name"
X 	$run eval "$install_prog $instname $destdir/$name" || exit $?
X+	fi
X 
X 	# Maybe install the static library, too.
X 	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
END-of-devel/libusb/files/patch-ltmain.sh
echo x - devel/libusb/Makefile
sed 's/^X//' >devel/libusb/Makefile << 'END-of-devel/libusb/Makefile'
X# New ports collection makefile for:	libusb
X# Date created:				27 January 2001
X# Whom:					John Reynolds <johnjen at xxxxxxxxxxxxxxx>
X#
X# $FreeBSD: ports/devel/libusb/Makefile,v 1.8 2003/11/25 19:35:43 andreas Exp $
X#
X
XPORTNAME=	libusb
XPORTVERSION=	0.1.7
XPORTREVISION=	1
XCATEGORIES=	devel
XMASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
XMASTER_SITE_SUBDIR=	${PORTNAME}
X
XMAINTAINER=	johnjen at xxxxxxxxxxxxxxx
XCOMMENT=	Library giving userland programs access to USB devices
X
XGNU_CONFIGURE=	yes
XCONFIGURE_ARGS=	--disable-build-docs
XINSTALLS_SHLIB=	yes
X
X.include <bsd.dfport.mk>
END-of-devel/libusb/Makefile
echo x - devel/libusb/distinfo
sed 's/^X//' >devel/libusb/distinfo << 'END-of-devel/libusb/distinfo'
XMD5 (libusb-0.1.7.tar.gz) = 4c7abee86d8715bccb43428a500d2170
END-of-devel/libusb/distinfo
echo x - devel/libusb/pkg-descr
sed 's/^X//' >devel/libusb/pkg-descr << 'END-of-devel/libusb/pkg-descr'
XA library originally developed under Linux to give userland programs
Xan API to access to USB hardware. The FreeBSD port was originally
Xdone by Richard Tobin <richard at xxxxxxxxxxxxxxx> and should still
Xbe considered "beta" (not all calls implemented in the Linux port
Xare available).  Allows gPhoto, gPhoto2, s10sh and others to access
XUSB under FreeBSD successfully.
X
XWWW: http://sourceforge.net/projects/libusb/
END-of-devel/libusb/pkg-descr
echo x - devel/libusb/pkg-plist
sed 's/^X//' >devel/libusb/pkg-plist << 'END-of-devel/libusb/pkg-plist'
Xbin/libusb-config
Xinclude/usb.h
Xlib/libusb-0.1.so.7
Xlib/libusb-0.1.so
Xlib/libusb.so
Xlib/libusb.a
END-of-devel/libusb/pkg-plist
exit





More information about the Submit mailing list