dev-libs/libusb: upgrade from 0.1.12 to 0.1.18

This CL imports libusb 0.1.18 from upstream Gentoo and modifies the
ebuild to use KEYWORDS="*".

BUG=chromium:381299
CQ-DEPEND=CL:202730
TEST=Tested the following:
1. `emerge-$BOARD dev-libs/libusb`
2. `FEATURES=test emerge-$BOARD platform2`
3. Test `mist`, `lsusb`, `servod`.

Change-Id: Ibac67b3019660faf802b6ca80329114ef0c6e5ce
Reviewed-on: https://chromium-review.googlesource.com/202731
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
diff --git a/dev-libs/libusb/Manifest b/dev-libs/libusb/Manifest
index 26fe05b..918c26f 100644
--- a/dev-libs/libusb/Manifest
+++ b/dev-libs/libusb/Manifest
@@ -1,2 +1 @@
-DIST libusb-0.1.12.tar.gz 389343 SHA256 37f6f7d9de74196eb5fc0bbe0aea9b5c939de7f500acba3af6fd643f3b538b44 SHA512 08c10e899f93b5f8567d1a1e1ed87dd5631ad0a1463975404709c1d165e545e340afb474a66788efcfdd8193542e2a2eb9cf133f55cbbf76441244191d0bb825 WHIRLPOOL 1991590fd971229d4cb809ff3cd1844243edffd0500a710019836683f291b7187756409c137c8a5bbdc908f90ff5a06c4a1923a77ee04c56988fcb5d68433245
-DIST libusb-1.0.9.tar.bz2 421971 SHA256 e920eedc2d06b09606611c99ec7304413c6784cba6e33928e78243d323195f9b SHA512 5eba3e9df2c1db71d685becebebf5b1310ee87e442f97a2553a430fd11655a2d9ce50e4ec2ffd62fe322286b0d6bc9e142ce552effc2466ee50424deba035ee5 WHIRLPOOL 9886cb6660d4530fe199441a8b5b76cb8a00012d69a13a40276bf3b880561eeb31301c186828b6fd08b687e038fac640475ba280473053e252cf23f15ca38372
+DIST libusb-1.0.18.tar.bz2 502160 SHA256 c73f5cec45a5de94418da4e151b7232958571926984acfb9bce02b9424e83720 SHA512 bbc3d75cb91f4e6a024549c2bac38ee85aeda8529a4553fd36bc8e8a5c223cd89eb952eda71fcc0071d6c6c818a0631d4cca084fed69d4986eee5dcf9a87d662 WHIRLPOOL fcc663884fb6d03bcf5f08c30bfded1d05c5b9ac836a2b99335553476201f956fed327c4a51609e19f54182bf5db125a0f22b41496def0443b5b4152a9f60a45
diff --git a/dev-libs/libusb/files/0.1.12-fbsd.patch b/dev-libs/libusb/files/0.1.12-fbsd.patch
deleted file mode 100644
index 57fd2ee..0000000
--- a/dev-libs/libusb/files/0.1.12-fbsd.patch
+++ /dev/null
@@ -1,97 +0,0 @@
-Index: libusb-0.1.12/configure.in
-===================================================================
---- libusb-0.1.12.orig/configure.in
-+++ libusb-0.1.12/configure.in
-@@ -90,6 +90,8 @@ LINUX_API=0
- DARWIN_API=0
- BSD_API=0
- 
-+DEFINE_USB_HID_DESCRIPTOR=1
-+
- AC_MSG_CHECKING(for what USB OS support)
- case $host in
-   *-linux*)
-@@ -101,13 +103,40 @@ case $host in
-     AC_MSG_RESULT(Linux)
-     OSLIBS=""
-     ;;
--  *-freebsd*|*-kfreebsd*-gnu|*-openbsd*|*-netbsd*)
-+  *-freebsd*)
-+    AC_DEFINE(BSD_API, 1)
-+    AC_DEFINE(LINUX_API, 0)
-+    AC_DEFINE(DARWIN_API, 0)
-+    BSD_API=1
-+    os_support=bsd
-+    AC_MSG_RESULT(FreeBSD)
-+    OSLIBS=""
-+    AC_CHECK_HEADERS([dev/usb/usbhid.h])
-+    if test "x$ac_cv_header_dev_usb_hisbhid_h" = "xyes"; then
-+    	AC_MSG_CHECKING([for usb_hid_descriptor])
-+	have_usb_hid_descriptor=no
-+	AC_TRY_COMPILE([
-+	  #include <sys/types.h>
-+	  #include <dev/usb/usb.h>
-+	  #include <dev/usb/usbhid.h>
-+	], [
-+	  struct usb_hid_descriptor descr;
-+	], [
-+	  have_usb_hid_descriptor=yes
-+	])
-+	AC_MSG_RESULT([$have_usb_hid_descriptor])
-+	if test "x$have_usb_hid_descriptor" = "xyes"; then
-+	  DEFINE_USB_HID_DESCRIPTOR=0
-+	fi
-+    fi
-+    ;;
-+  *-dragonfly*|*-kfreebsd*-gnu|*-openbsd*|*-netbsd*)
-     AC_DEFINE(BSD_API, 1)
-     AC_DEFINE(LINUX_API, 0)
-     AC_DEFINE(DARWIN_API, 0)
-     BSD_API=1
-     os_support=bsd
--    AC_MSG_RESULT(FreeBSD, OpenBSD and/or NetBSD)
-+    AC_MSG_RESULT(DragonFly, OpenBSD and/or NetBSD)
-     OSLIBS=""
-     ;;
-   *-darwin*)
-@@ -128,6 +157,7 @@ esac
- AC_SUBST(DARWIN_API)
- AC_SUBST(LINUX_API)
- AC_SUBST(BSD_API)
-+AC_SUBST(DEFINE_USB_HID_DESCRIPTOR)
- 
- AM_CONDITIONAL(LINUX_API, test "$os_support" = "linux")
- AM_CONDITIONAL(BSD_API, test "$os_support" = "bsd")
-Index: libusb-0.1.12/usb.h.in
-===================================================================
---- libusb-0.1.12.orig/usb.h.in
-+++ libusb-0.1.12/usb.h.in
-@@ -17,6 +17,12 @@
- 
- #include <dirent.h>
- 
-+#if ! @DEFINE_USB_HID_DESCRIPTOR@ && defined(__FreeBSD__)
-+#include <sys/types.h>
-+#include <dev/usb/usb.h>
-+#include <dev/usb/usbhid.h>
-+#endif
-+
- /*
-  * USB spec information
-  *
-@@ -75,6 +81,7 @@ struct usb_string_descriptor {
- 	u_int16_t wData[1];
- };
- 
-+#if ! @DEFINE_USB_HID_DESCRIPTOR@ && defined(__FreeBSD__)
- /* HID descriptor */
- struct usb_hid_descriptor {
- 	u_int8_t  bLength;
-@@ -86,6 +93,7 @@ struct usb_hid_descriptor {
- 	/* u_int16_t wDescriptorLength; */
- 	/* ... */
- };
-+#endif
- 
- /* Endpoint descriptor */
- #define USB_MAXENDPOINTS	32
diff --git a/dev-libs/libusb/files/libusb-0.1-ansi.patch b/dev-libs/libusb/files/libusb-0.1-ansi.patch
deleted file mode 100644
index 9db4b4d..0000000
--- a/dev-libs/libusb/files/libusb-0.1-ansi.patch
+++ /dev/null
@@ -1,191 +0,0 @@
-diff -Nuar --exclude '*.rej' --exclude '*.orig' libusb-0.1.12.orig/usb.h.in libusb-0.1.12/usb.h.in
---- libusb-0.1.12.orig/usb.h.in	2009-11-11 07:57:27.335948692 +0000
-+++ libusb-0.1.12/usb.h.in	2009-11-11 08:00:11.391786398 +0000
-@@ -13,8 +13,10 @@
- 
- #include <unistd.h>
- #include <stdlib.h>
-+#include <stdint.h>
- #include <limits.h>
- 
-+#include <sys/param.h>
- #include <dirent.h>
- 
- #if ! @DEFINE_USB_HID_DESCRIPTOR@ && defined(__FreeBSD__)
-@@ -70,27 +72,27 @@
- 
- /* All standard descriptors have these 2 fields in common */
- struct usb_descriptor_header {
--	u_int8_t  bLength;
--	u_int8_t  bDescriptorType;
-+	uint8_t  bLength;
-+	uint8_t  bDescriptorType;
- };
- 
- /* String descriptor */
- struct usb_string_descriptor {
--	u_int8_t  bLength;
--	u_int8_t  bDescriptorType;
--	u_int16_t wData[1];
-+	uint8_t  bLength;
-+	uint8_t  bDescriptorType;
-+	uint16_t wData[1];
- };
- 
- #if ! @DEFINE_USB_HID_DESCRIPTOR@ && defined(__FreeBSD__)
- /* HID descriptor */
- struct usb_hid_descriptor {
--	u_int8_t  bLength;
--	u_int8_t  bDescriptorType;
--	u_int16_t bcdHID;
--	u_int8_t  bCountryCode;
--	u_int8_t  bNumDescriptors;
--	/* u_int8_t  bReportDescriptorType; */
--	/* u_int16_t wDescriptorLength; */
-+	uint8_t  bLength;
-+	uint8_t  bDescriptorType;
-+	uint16_t bcdHID;
-+	uint8_t  bCountryCode;
-+	uint8_t  bNumDescriptors;
-+	/* uint8_t  bReportDescriptorType; */
-+	/* uint16_t wDescriptorLength; */
- 	/* ... */
- };
- #endif
-@@ -98,14 +100,14 @@
- /* Endpoint descriptor */
- #define USB_MAXENDPOINTS	32
- struct usb_endpoint_descriptor {
--	u_int8_t  bLength;
--	u_int8_t  bDescriptorType;
--	u_int8_t  bEndpointAddress;
--	u_int8_t  bmAttributes;
--	u_int16_t wMaxPacketSize;
--	u_int8_t  bInterval;
--	u_int8_t  bRefresh;
--	u_int8_t  bSynchAddress;
-+	uint8_t  bLength;
-+	uint8_t  bDescriptorType;
-+	uint8_t  bEndpointAddress;
-+	uint8_t  bmAttributes;
-+	uint16_t wMaxPacketSize;
-+	uint8_t  bInterval;
-+	uint8_t  bRefresh;
-+	uint8_t  bSynchAddress;
- 
- 	unsigned char *extra;	/* Extra descriptors */
- 	int extralen;
-@@ -123,15 +125,15 @@
- /* Interface descriptor */
- #define USB_MAXINTERFACES	32
- struct usb_interface_descriptor {
--	u_int8_t  bLength;
--	u_int8_t  bDescriptorType;
--	u_int8_t  bInterfaceNumber;
--	u_int8_t  bAlternateSetting;
--	u_int8_t  bNumEndpoints;
--	u_int8_t  bInterfaceClass;
--	u_int8_t  bInterfaceSubClass;
--	u_int8_t  bInterfaceProtocol;
--	u_int8_t  iInterface;
-+	uint8_t  bLength;
-+	uint8_t  bDescriptorType;
-+	uint8_t  bInterfaceNumber;
-+	uint8_t  bAlternateSetting;
-+	uint8_t  bNumEndpoints;
-+	uint8_t  bInterfaceClass;
-+	uint8_t  bInterfaceSubClass;
-+	uint8_t  bInterfaceProtocol;
-+	uint8_t  iInterface;
- 
- 	struct usb_endpoint_descriptor *endpoint;
- 
-@@ -149,14 +151,14 @@
- /* Configuration descriptor information.. */
- #define USB_MAXCONFIG		8
- struct usb_config_descriptor {
--	u_int8_t  bLength;
--	u_int8_t  bDescriptorType;
--	u_int16_t wTotalLength;
--	u_int8_t  bNumInterfaces;
--	u_int8_t  bConfigurationValue;
--	u_int8_t  iConfiguration;
--	u_int8_t  bmAttributes;
--	u_int8_t  MaxPower;
-+	uint8_t  bLength;
-+	uint8_t  bDescriptorType;
-+	uint16_t wTotalLength;
-+	uint8_t  bNumInterfaces;
-+	uint8_t  bConfigurationValue;
-+	uint8_t  iConfiguration;
-+	uint8_t  bmAttributes;
-+	uint8_t  MaxPower;
- 
- 	struct usb_interface *interface;
- 
-@@ -166,28 +168,28 @@
- 
- /* Device descriptor */
- struct usb_device_descriptor {
--	u_int8_t  bLength;
--	u_int8_t  bDescriptorType;
--	u_int16_t bcdUSB;
--	u_int8_t  bDeviceClass;
--	u_int8_t  bDeviceSubClass;
--	u_int8_t  bDeviceProtocol;
--	u_int8_t  bMaxPacketSize0;
--	u_int16_t idVendor;
--	u_int16_t idProduct;
--	u_int16_t bcdDevice;
--	u_int8_t  iManufacturer;
--	u_int8_t  iProduct;
--	u_int8_t  iSerialNumber;
--	u_int8_t  bNumConfigurations;
-+	uint8_t  bLength;
-+	uint8_t  bDescriptorType;
-+	uint16_t bcdUSB;
-+	uint8_t  bDeviceClass;
-+	uint8_t  bDeviceSubClass;
-+	uint8_t  bDeviceProtocol;
-+	uint8_t  bMaxPacketSize0;
-+	uint16_t idVendor;
-+	uint16_t idProduct;
-+	uint16_t bcdDevice;
-+	uint8_t  iManufacturer;
-+	uint8_t  iProduct;
-+	uint8_t  iSerialNumber;
-+	uint8_t  bNumConfigurations;
- };
- 
- struct usb_ctrl_setup {
--	u_int8_t  bRequestType;
--	u_int8_t  bRequest;
--	u_int16_t wValue;
--	u_int16_t wIndex;
--	u_int16_t wLength;
-+	uint8_t  bRequestType;
-+	uint8_t  bRequest;
-+	uint16_t wValue;
-+	uint16_t wIndex;
-+	uint16_t wLength;
- };
- 
- /*
-@@ -258,7 +260,7 @@
- 
-   void *dev;		/* Darwin support */
- 
--  u_int8_t devnum;
-+  uint8_t devnum;
- 
-   unsigned char num_children;
-   struct usb_device **children;
-@@ -270,7 +272,7 @@
-   char dirname[PATH_MAX + 1];
- 
-   struct usb_device *devices;
--  u_int32_t location;
-+  uint32_t location;
- 
-   struct usb_device *root_dev;
- };
diff --git a/dev-libs/libusb/files/libusb-0.1.12-no-infinite-bulk.patch b/dev-libs/libusb/files/libusb-0.1.12-no-infinite-bulk.patch
deleted file mode 100644
index 563397d..0000000
--- a/dev-libs/libusb/files/libusb-0.1.12-no-infinite-bulk.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-Patch-from: http://bugs.gentoo.org/show_bug.cgi?id=225879
-Gentoo-Bug: 225879
-Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-
-Prevents an infinite loop if device is removed during usb_bulk_read or
-usb_bulk_write.
-
-diff -Naur libusb-0.1.12/linux.c libusb-0.1.12-new/linux.c
---- libusb-0.1.12/linux.c	2006-03-04 04:52:46.000000000 +0200
-+++ libusb-0.1.12-new/linux.c	2008-06-11 14:22:20.000000000 +0300
-@@ -220,6 +220,13 @@
-     waiting = 1;
-     context = NULL;
-     while (!urb.usercontext && ((ret = ioctl(dev->fd, IOCTL_USB_REAPURBNDELAY, &context)) == -1) && waiting) {
-+      if (ret == -1)
-+      {
-+      	if (errno == ENODEV)
-+	{
-+	  return -ENODEV;
-+	}
-+      }
-       tv.tv_sec = 0;
-       tv.tv_usec = 1000; // 1 msec
-       select(dev->fd + 1, NULL, &writefds, NULL, &tv); //sub second wait
diff --git a/dev-libs/libusb/files/libusb-0.1.12-nocpp.patch b/dev-libs/libusb/files/libusb-0.1.12-nocpp.patch
deleted file mode 100644
index de1a8c7..0000000
--- a/dev-libs/libusb/files/libusb-0.1.12-nocpp.patch
+++ /dev/null
@@ -1,20 +0,0 @@
---- libusb-0.1.12/Makefile.am	2006-03-04 13:52:46.000000000 +1100
-+++ libusb-0.1.12/Makefile.am.new	2007-11-08 16:25:38.000000000 +1100
-@@ -4,7 +4,7 @@
- # gnu strictness chokes on README being autogenerated
- AUTOMAKE_OPTIONS = 1.4 foreign
- 
--SUBDIRS = . tests doc
-+SUBDIRS = . doc
- 
- AM_CFLAGS = -Werror
- 
-@@ -19,7 +19,7 @@
-              apidocs/footer.html apidocs/doxygen.css apidocs/doxygen.png libusb.pc.in
- EXTRA_libusb_la_SOURCE = linux.c linux.h bsd.c darwin.c
- 
--lib_LTLIBRARIES = libusb.la libusbpp.la
-+lib_LTLIBRARIES = libusb.la
- 
- pkgconfig_DATA = libusb.pc
- 
diff --git a/dev-libs/libusb/libusb-0.1.12-r7.ebuild b/dev-libs/libusb/libusb-0.1.12-r7.ebuild
deleted file mode 100644
index 577751c..0000000
--- a/dev-libs/libusb/libusb-0.1.12-r7.ebuild
+++ /dev/null
@@ -1,52 +0,0 @@
-# Copyright 1999-2012 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-libs/libusb/libusb-0.1.12-r7.ebuild,v 1.12 2012/01/09 06:53:36 ssuominen Exp $
-
-EAPI="3"
-
-inherit eutils libtool autotools toolchain-funcs
-
-DESCRIPTION="Userspace access to USB devices"
-HOMEPAGE="http://libusb.sourceforge.net/"
-SRC_URI="mirror://sourceforge/libusb/${P}.tar.gz"
-
-LICENSE="LGPL-2"
-SLOT="0"
-KEYWORDS="*"
-IUSE="debug doc +cxx static-libs"
-RESTRICT="test"
-
-RDEPEND="!dev-libs/libusb-compat"
-DEPEND="${RDEPEND}
-	doc? ( app-text/openjade
-	app-text/docbook-dsssl-stylesheets
-	app-text/docbook-sgml-utils
-	~app-text/docbook-sgml-dtd-4.2 )"
-
-src_prepare() {
-	sed -i -e 's:-Werror::' Makefile.am
-	sed -i 's:AC_LANG_CPLUSPLUS:AC_PROG_CXX:' configure.in #213800
-	epatch "${FILESDIR}"/${PV}-fbsd.patch
-	use cxx || epatch "${FILESDIR}"/${PN}-0.1.12-nocpp.patch
-	epatch "${FILESDIR}"/${PN}-0.1.12-no-infinite-bulk.patch
-	epatch "${FILESDIR}"/${PN}-0.1-ansi.patch # 273752
-	eautoreconf
-}
-
-src_configure() {
-	econf \
-		$(use_enable static-libs static) \
-		$(use_enable debug debug all) \
-		$(use_enable doc build-docs)
-}
-
-src_install() {
-	emake -j1 DESTDIR="${D}" install || die "make install failed"
-	dodoc AUTHORS NEWS README
-	use doc && dohtml doc/html/*.html
-
-	gen_usr_ldscript -a usb
-	use cxx || rm -f "${ED}"/usr/include/usbpp.h
-
-	rm -f "${ED}"/usr/lib*/libusb*.la
-}
diff --git a/dev-libs/libusb/libusb-1.0.18.ebuild b/dev-libs/libusb/libusb-1.0.18.ebuild
new file mode 100644
index 0000000..7a7e332
--- /dev/null
+++ b/dev-libs/libusb/libusb-1.0.18.ebuild
@@ -0,0 +1,71 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-libs/libusb/libusb-1.0.18.ebuild,v 1.12 2014/03/24 17:51:41 ssuominen Exp $
+
+EAPI=5
+inherit eutils toolchain-funcs multilib-minimal
+
+DESCRIPTION="Userspace access to USB devices"
+HOMEPAGE="http://libusb.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2"
+
+LICENSE="LGPL-2.1"
+SLOT="1"
+KEYWORDS="*"
+IUSE="debug doc examples static-libs test udev"
+
+RDEPEND="udev? ( >=virtual/udev-200[${MULTILIB_USEDEP}] )
+	abi_x86_32? (
+		!<=app-emulation/emul-linux-x86-baselibs-20130224-r7
+		!app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+	)"
+DEPEND="${RDEPEND}
+	doc? ( app-doc/doxygen )
+	!udev? ( virtual/os-headers )"
+
+multilib_src_configure() {
+	ECONF_SOURCE=${S} \
+	econf \
+		$(use_enable static-libs static) \
+		$(use_enable udev) \
+		$(use_enable debug debug-log) \
+		$(use_enable test tests-build)
+}
+
+multilib_src_compile() {
+	emake
+
+	if multilib_is_native_abi; then
+		use doc && emake -C doc docs
+	fi
+}
+
+multilib_src_test() {
+	emake check
+
+	# noinst_PROGRAMS from tests/Makefile.am
+	tests/stress || die
+}
+
+multilib_src_install() {
+	emake DESTDIR="${D}" install
+
+	if multilib_is_native_abi; then
+		gen_usr_ldscript -a usb-1.0
+
+		use doc && dohtml doc/html/*
+	fi
+}
+
+multilib_src_install_all() {
+	prune_libtool_files
+
+	dodoc AUTHORS ChangeLog NEWS PORTING README TODO
+
+	if use examples; then
+		insinto /usr/share/doc/${PF}/examples
+		doins examples/*.{c,h}
+		insinto /usr/share/doc/${PF}/examples/getopt
+		doins examples/getopt/*.{c,h}
+	fi
+}
diff --git a/dev-libs/libusb/libusb-1.0.9.ebuild b/dev-libs/libusb/libusb-1.0.9.ebuild
deleted file mode 100644
index b5a800e..0000000
--- a/dev-libs/libusb/libusb-1.0.9.ebuild
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright 1999-2012 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-libs/libusb/libusb-1.0.9.ebuild,v 1.9 2012/11/09 20:09:10 ryao Exp $
-
-EAPI=4
-
-DESCRIPTION="Userspace access to USB devices"
-HOMEPAGE="http://libusb.org/"
-SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2"
-
-LICENSE="LGPL-2.1"
-SLOT="1"
-KEYWORDS="*"
-IUSE="debug doc static-libs"
-
-RDEPEND="!dev-libs/libusbx:1"
-DEPEND="doc? ( app-doc/doxygen )"
-
-DOCS="AUTHORS NEWS PORTING README THANKS TODO"
-
-src_configure() {
-	econf \
-		$(use_enable static-libs static) \
-		$(use_enable debug debug-log)
-}
-
-src_compile() {
-	default
-
-	use doc && emake -C doc docs
-}
-
-src_install() {
-	default
-
-	if use doc; then
-		insinto /usr/share/doc/${PF}/examples
-		doins examples/*.c
-
-		dohtml doc/html/*
-	fi
-
-	rm -f "${ED}"/usr/lib*/lib*.la
-}
diff --git a/dev-libs/libusb/metadata.xml b/dev-libs/libusb/metadata.xml
index 659da0c..bff000f 100644
--- a/dev-libs/libusb/metadata.xml
+++ b/dev-libs/libusb/metadata.xml
@@ -2,4 +2,9 @@
 <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
 <pkgmetadata>
 	<herd>base-system</herd>
+	<herd>proxy-maintainers</herd>
+	<maintainer>
+		<email>peter@stuge.se</email>
+		<name>Peter Stuge</name>
+	</maintainer>
 </pkgmetadata>