7060741 Move libopenusb to userland
authorRich Burridge <rich.burridge@oracle.com>
Thu, 07 Jul 2011 14:07:49 -0700
changeset 377 5df42c8502d2
parent 376 dbac94285f1e
child 378 f0b61ed1d10d
7060741 Move libopenusb to userland
components/meta-packages/history/SUNWlibopenusb.p5m
components/openusb/Makefile
components/openusb/files/libopenusb.3lib
components/openusb/openusb.copyright
components/openusb/openusb.p5m
components/openusb/patches/Makefile.in.patch
components/openusb/patches/testopenusb.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/meta-packages/history/SUNWlibopenusb.p5m	Thu Jul 07 14:07:49 2011 -0700
@@ -0,0 +1,28 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+set name=pkg.fmri value=pkg:/[email protected],5.11-0.133
+set name=pkg.renamed value=true
+
+set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
+
+depend fmri=system/library/usb/[email protected] type=require
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/openusb/Makefile	Thu Jul 07 14:07:49 2011 -0700
@@ -0,0 +1,58 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+include ../../make-rules/shared-macros.mk
+
+COMPONENT_NAME=		libopenusb
+COMPONENT_VERSION=	1.0.1
+COMPONENT_SRC=		$(COMPONENT_NAME)-$(COMPONENT_VERSION)
+COMPONENT_PROJECT_URL=	http://openusb.sourceforge.net/
+COMPONENT_ARCHIVE=	$(COMPONENT_SRC).tar.gz
+COMPONENT_ARCHIVE_HASH=	sha1:c8a6b493f31a349f19c27a45565425f58897d443
+COMPONENT_ARCHIVE_URL=	http://sourceforge.net/projects/openusb/files/$(COMPONENT_NAME)/libopenusb%201.0.1/$(COMPONENT_ARCHIVE)/download
+
+include ../../make-rules/prep.mk
+include ../../make-rules/configure.mk
+include ../../make-rules/ips.mk
+
+CONFIGURE_ENV += CFLAGS="$(CFLAGS)"
+
+COMPONENT_PRE_CONFIGURE_ACTION = \
+        ($(CLONEY) $(SOURCE_DIR) $(@D))
+
+COMPILER = gcc
+
+PATCH_LEVEL = 1
+
+COMPONENT_POST_BUILD_ACTION = \
+	(cd $(@D)/src; $(MAKE) install-sunos-backend)
+
+build: $(BUILD_32_and_64)
+
+install: $(INSTALL_32_and_64)
+
+test: $(TEST_32_and_64)
+
+BUILD_PKG_DEPENDENCIES = $(BUILD_TOOLS)
+
+include ../../make-rules/depend.mk
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/openusb/files/libopenusb.3lib	Thu Jul 07 14:07:49 2011 -0700
@@ -0,0 +1,59 @@
+'\" te
+.\" Copyright (c) 2007, Sun Microsystems Inc\&. All Rights Reserved\&.
+.TH libopenusb 3LIB "December 19 2007" "SunOS 5.11" "Interface Libraries" 
+.SH NAME
+libopenusb \- user-level USB device management library
+.SH SYNOPSIS
+.LP
+.nf
+cc [ \fIflag\fR\&.\&.\&.\ ] \fIfile\fR\&.\&.\&. -\fBlopenusb\fR [ \fIlibrary\fR\&.\&.\&. ]
+#include <openusb.h>
+.fi
+.SH DESCRIPTION
+.sp
+.LP
+See /usr/share/doc/openusb/openusb_guide.html for a full description.
+.SH FILES
+
+.sp
+.ne 2
+.mk
+\fB\fB/usr/lib/libopenusb\&.so\&.0\fR\fR
+.in +40n
+.rt
+shared object
+.in -40n
+
+.sp
+.ne 2
+.mk
+\fB\fB/usr/lib/openusb_backend\fR\fR
+.in +40n
+.rt
+openusb backend modules
+.in -40n
+.SH "ATTRIBUTES"
+.PP
+See \fBattributes\fR(5) for descriptions of the following attributes:
+.sp
+.TS
+tab() allbox;
+cw(2.750000i)| cw(2.750000i)
+lw(2.750000i)| lw(2.750000i).
+ATTRIBUTE TYPEATTRIBUTE VALUE
+AvailabilityT{
+system/library/usb/openusb
+T}
+MT-LevelSafe
+.TE
+.sp
+.SH "SEE ALSO"
+.PP
+\fBintro\fR(3), \fBlibusb\fR(3LIB), \fBattributes\fR(5)
+.PP
+\fIhttp://openusb\&.sourceforge\&.net\fR
+
+.SH LICENSE
+.sp
+.LP
+The \fBlibopenusb\fR library is distributed under the LGPL and BSD licenses.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/openusb/openusb.copyright	Thu Jul 07 14:07:49 2011 -0700
@@ -0,0 +1,29 @@
+Oracle elects to use only the GNU Lesser General Public License version
+2.1 (LGPL)/GNU General Public License version 2 (GPL) for any software
+where a choice of LGPL/GPL license versions are made available with the
+language indicating that LGPLv2.1/GPLv2 or any later version may be
+used, or where a choice of which version of the LGPL/GPL is applied is
+unspecified.  Unless specifically stated otherwise, where a choice
+exists between another license and either the GPL or the LGPL, Oracle
+chooses the other license.
+===================================================================
+
+Copyright 2000-2005 Johannes Erdfelt <[email protected]>
+Copyright 2004-2008 Sun Microsystems, Inc.
+Copyright 2007 Michael Lewis <[email protected]>
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the
+Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/openusb/openusb.p5m	Thu Jul 07 14:07:49 2011 -0700
@@ -0,0 +1,68 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+
+<transform file path=usr.*/man/.+ -> default mangler.man.stability volatile>
+set name=pkg.fmri \
+    value=pkg:/system/library/usb/openusb@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
+set name=pkg.description \
+    value="A library to enable userspace application programs to communicate with USB devices"
+set name=pkg.summary value="A USB device management library"
+set name=info.classification \
+    value=org.opensolaris.category.2008:System/Libraries
+set name=info.source_url value=$(COMPONENT_ARCHIVE_URL)
+set name=info.upstream_url value=$(COMPONENT_PROJECT_URL)
+set name=opensolaris.arc_url \
+    value=http://arc.opensolaris.org/caselog/PSARC/2008/018
+set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
+
+dir path=usr
+dir path=usr/bin
+dir path=usr/include
+dir path=usr/lib
+dir path=usr/lib/$(MACH64)
+dir path=usr/lib/$(MACH64)/openusb_backend
+dir path=usr/lib/openusb_backend
+dir path=usr/share
+dir path=usr/share/doc
+dir path=usr/share/doc/openusb
+dir path=usr/share/man
+dir path=usr/share/man/man3lib
+
+file path=usr/include/openusb.h
+file path=usr/lib/$(MACH64)/libopenusb.so.0.0.1  
+file path=usr/lib/$(MACH64)/openusb_backend/sunos.so  
+file path=usr/lib/libopenusb.so.0.0.1
+file path=usr/lib/openusb_backend/sunos.so
+file doc/html/openusb_guide.html path=usr/share/doc/openusb/openusb_guide.html
+file files/libopenusb.3lib path=usr/share/man/man3lib/libopenusb.3lib
+
+link path=usr/lib/$(MACH64)/libopenusb.so target=libopenusb.so.0.0.1 
+link path=usr/lib/$(MACH64)/libopenusb.so.0 target=libopenusb.so.0.0.1 
+link path=usr/lib/libopenusb.so target=libopenusb.so.0.0.1
+link path=usr/lib/libopenusb.so.0 target=libopenusb.so.0.0.1
+
+license openusb.copyright license="LGPLv2.1, BSD"
+
+legacy pkg=SUNWlibopenusb \
+    desc="Libopenusb - a USB device management library (1.0.0)" \
+    name="Libopenusb - a USB device management library"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/openusb/patches/Makefile.in.patch	Thu Jul 07 14:07:49 2011 -0700
@@ -0,0 +1,12 @@
+--- libopenusb-1.0.1/src/Makefile.in	Thu Feb 21 17:54:43 2008
++++ Makefile.in	Thu Feb 21 17:59:12 2008
+@@ -374,6 +374,9 @@
+ 	  else :; fi; \
+ 	done
+ 
++install-sunos-backend: $(usblib_LTLIBRARIES)
++	$(CC) $(CFLAGS) -shared -Wl,-h -Wl,sunos.so -o .libs/sunos.so  .libs/sunos_la-sunos.o  -R$(libdir) -L.libs $(sunos_la_LIBADD)
++
+ uninstall-usblibLTLIBRARIES:
+ 	@$(NORMAL_UNINSTALL)
+ 	@list='$(usblib_LTLIBRARIES)'; for p in $$list; do \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/openusb/patches/testopenusb.patch	Thu Jul 07 14:07:49 2011 -0700
@@ -0,0 +1,226 @@
+Index: libopenusb-1.0.1/tests/testopenusb.c
+===================================================================
+--- libopenusb-1.0.1/tests/testopenusb.c	(revision 122)
++++ libopenusb-1.0.1/tests/testopenusb.c	(working copy)
+@@ -183,7 +183,7 @@
+ 		break;
+ 	}
+ 	printf("CALLBACK: lib(%llu) device(%llu) get a event(%s) with arg=%p\n",
+-		handle, devid, evstring, arg);
++		(unsigned long long)handle, (unsigned long long)devid, evstring, arg);
+ }
+ 
+ int convert_string(char *buf, usb_string_desc_t *st, int buflen)
+@@ -350,14 +350,16 @@
+ 
+ 	ret = openusb_claim_interface(devh,0,0);
+ 	if (ret != 0) {
+-		printf("Device(%llu) claim interface error:%s\n",devids[0],
++		printf("Device(%llu) claim interface error:%s\n",
++				(unsigned long long)devids[0],
+ 				openusb_strerror(ret));
+ 		return -1;
+ 	}
+ 
+ 	ret = openusb_set_altsetting(devh,0,0);
+ 	if (ret != 0) {
+-		printf("Device(%llu) interface(0) set alt:%s\n",devids[0],
++		printf("Device(%llu) interface(0) set alt:%s\n",
++				(unsigned long long)devids[0],
+ 				openusb_strerror(ret));
+ 		return -1;
+ 	}
+@@ -424,14 +426,16 @@
+ 
+ 	ret = openusb_claim_interface(devh,0,0);
+ 	if (ret != 0) {
+-		printf("Device(%llu) claim interface error:%s\n",devids[0],
++		printf("Device(%llu) claim interface error:%s\n",
++				(unsigned long long)devids[0],
+ 				openusb_strerror(ret));
+ 		return -1;
+ 	}
+ 
+ 	ret = openusb_set_altsetting(devh,0,0);
+ 	if (ret != 0) {
+-		printf("Device(%llu) interface(0) set alt:%s\n",devids[0],
++		printf("Device(%llu) interface(0) set alt:%s\n",
++				(unsigned long long)devids[0],
+ 				openusb_strerror(ret));
+ 		return -1;
+ 	}
+@@ -498,14 +502,16 @@
+ 
+ 	ret = openusb_claim_interface(devh,0,0);
+ 	if (ret != 0) {
+-		printf("Device(%llu) claim interface error:%s\n",devids[0],
++		printf("Device(%llu) claim interface error:%s\n",
++				(unsigned long long)devids[0],
+ 				openusb_strerror(ret));
+ 		return -1;
+ 	}
+ 
+ 	ret = openusb_set_altsetting(devh,0,3);/* alt 3, depends on the fw */
+ 	if (ret != 0) {
+-		printf("Device(%llu) interface(0) set alt:%s\n",devids[0],
++		printf("Device(%llu) interface(0) set alt:%s\n",
++				(unsigned long long)devids[0],
+ 				openusb_strerror(ret));
+ 		return -1;
+ 	}
+@@ -593,14 +599,16 @@
+ 
+ 	ret = openusb_claim_interface(devh,0,0);
+ 	if (ret != 0) {
+-		printf("Device(%llu) claim interface error:%s\n",devids[0],
++		printf("Device(%llu) claim interface error:%s\n",
++				(unsigned long long)devids[0],
+ 				openusb_strerror(ret));
+ 		return -1;
+ 	}
+ 
+ 	ret = openusb_set_altsetting(devh,0,0);
+ 	if (ret != 0) {
+-		printf("Device(%llu) interface(0) set alt:%s\n",devids[0],
++		printf("Device(%llu) interface(0) set alt:%s\n",
++				(unsigned long long)devids[0],
+ 				openusb_strerror(ret));
+ 		return -1;
+ 	}
+@@ -735,7 +743,8 @@
+ 
+ 	ret = openusb_claim_interface(devh,0,0);
+ 	if (ret != 0) {
+-		printf("Device(%llu) claim interface error:%s\n", devids[0],
++		printf("Device(%llu) claim interface error:%s\n",
++				(unsigned long long)devids[0],
+ 				openusb_strerror(ret));
+ 		return -1;
+ 	}
+@@ -747,7 +756,8 @@
+ 	}
+ 
+ 	if (ret != 0) {
+-		printf("Device(%llu) interface(0) set alt:%s\n", devids[0],
++		printf("Device(%llu) interface(0) set alt:%s\n",
++			       (unsigned long long)devids[0],
+ 				openusb_strerror(ret));
+ 		return -1;
+ 	}
+@@ -1027,14 +1037,16 @@
+ 
+ 	ret = openusb_claim_interface(devh,0,0);
+ 	if (ret != 0) {
+-		printf("Device(%llu) claim interface error:%s\n", devids[0],
++		printf("Device(%llu) claim interface error:%s\n",
++				(unsigned long long)devids[0],
+ 				openusb_strerror(ret));
+ 		return -1;
+ 	}
+ 
+ 	ret = openusb_set_altsetting(devh,0,0);
+ 	if (ret != 0) {
+-		printf("Device(%llu) interface(0) set alt:%s\n", devids[0],
++		printf("Device(%llu) interface(0) set alt:%s\n",
++				(unsigned long long)devids[0],
+ 				openusb_strerror(ret));
+ 		return -1;
+ 	}
+@@ -1195,7 +1207,8 @@
+ 				openusb_strerror(ret));
+ 		goto err;
+ 	}
+-	printf("Device(%llu) opened: %llu\n",devids[0],devh);
++	printf("Device(%llu) opened: %llu\n", (unsigned long long)devids[0],
++			(unsigned long long)devh);
+ 
+ 	ret = openusb_get_devid(devh, &devid);
+ 	if(ret < 0) {
+@@ -1206,11 +1219,12 @@
+ 
+ 	ret = openusb_get_lib_handle(devh,&libh);
+ 	if (ret != 0) {
+-		printf("Get device(%llu) lib handle error:%s\n",devids[0],
++		printf("Get device(%llu) lib handle error:%s\n",
++				(unsigned long long)devids[0],
+ 				openusb_strerror(ret));
+ 		goto err;
+ 	}
+-	printf("Lib handle = %llu\n",libh);
++	printf("Lib handle = %llu\n", (unsigned long long)libh);
+ 
+ #if 1  /* multi xfer test */
+ 	ret = multi_xfer_test(devh);
+@@ -1241,14 +1255,16 @@
+ #if 1	/* configuration test */
+ 	ret = openusb_set_configuration(devh,1);
+ 	if (ret != 0) {
+-		printf("Set device(%llu) config error:%s\n",devids[0],
++		printf("Set device(%llu) config error:%s\n",
++				(unsigned long long)devids[0],
+ 				openusb_strerror(ret));
+ 		goto err;
+ 	}
+ 
+ 	ret = openusb_get_configuration(devh,&cfg);
+ 	if (ret != 0) {
+-		printf("Get device(%llu) config error:%s\n",devids[0],
++		printf("Get device(%llu) config error:%s\n",
++				(unsigned long long)devids[0],
+ 				openusb_strerror(ret));
+ 		goto err;
+ 	}
+@@ -1259,18 +1275,21 @@
+ #if 1	/* claim interface test */
+ 	ret = openusb_claim_interface(devh,0,0);
+ 	if (ret != 0) {
+-		printf("Device(%llu) claim interface error:%s\n",devids[0],
++		printf("Device(%llu) claim interface error:%s\n",
++				(unsigned long long)devids[0],
+ 				openusb_strerror(ret));
+ 		goto err;
+ 	}
+ 
+ 	ret = openusb_is_interface_claimed(devh,0);
+-	printf("Device(%llu) interface(0) claimed return %d\n", devids[0],
++	printf("Device(%llu) interface(0) claimed return %d\n",
++			(unsigned long long)devids[0],
+ 			ret);
+ 
+ 	ret = openusb_set_altsetting(devh,0,0);
+ 	if (ret != 0) {
+-		printf("Device(%llu) interface(0) set alt:%s\n",devids[0],
++		printf("Device(%llu) interface(0) set alt:%s\n",
++				(unsigned long long)devids[0],
+ 				openusb_strerror(ret));
+ 		goto err;
+ 	}
+@@ -1278,7 +1297,8 @@
+ 
+ 	ret = openusb_get_altsetting(devh,0,&alt);
+ 	if (ret != 0) {
+-		printf("Device(%llu) interface(0) get alt:%s\n",devids[0],
++		printf("Device(%llu) interface(0) get alt:%s\n",
++				(unsigned long long)devids[0],
+ 				openusb_strerror(ret));
+ 		goto err;
+ 	}
+@@ -1286,7 +1306,8 @@
+ 
+ 	ret = openusb_release_interface(devh,0);
+ 	if (ret != 0) {
+-		printf("Device(%llu) release interface error:%s\n",devids[0],
++		printf("Device(%llu) release interface error:%s\n",
++				(unsigned long long)devids[0],
+ 				openusb_strerror(ret));
+ 		goto err;
+ 	}
+@@ -1396,7 +1417,7 @@
+ 		printf("error init\n");
+ 		exit(1);
+ 	}
+-	printf("lib handle=%llu \n",libhandle);
++	printf("lib handle=%llu \n", (unsigned long long)libhandle);
+ 	printf("openusb_init PASS\n");
+ 
+ 	ret = openusb_set_event_callback(libhandle, USB_ATTACH, event_cb, NULL);