# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libusb
pkgver=1.0.21
_ver=${pkgver/_/-}
pkgrel=0
pkgdesc="Library to enable user space application programs to communicate with USB devices"
url="http://libusb.info/"
arch="all"
license="LGPL-2.0-or-later"
subpackages="$pkgname-dev"
replaces="libusbx"
makedepends="linux-headers"
source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.bz2
	"

_builddir="$srcdir"/$pkgname-$_ver
prepare() {
	local i
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

build() {
	cd "$_builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--disable-udev \
		|| return 1
	make -j1 || return 1
}

package() {
	cd "$_builddir"
	make DESTDIR="$pkgdir" install || return 1
}
md5sums="1da9ea3c27b3858fa85c5f4466003e44  libusb-1.0.21.tar.bz2"
sha256sums="7dce9cce9a81194b7065ee912bcd55eeffebab694ea403ffb91b67db66b1824b  libusb-1.0.21.tar.bz2"
sha512sums="015ca07bdb559aa40af5db1302ab0b1c8a30d593699fe2f3c9f45162673dc7b608cecc58d60fde8f3bde2a68370794a045e8efa48fc55402eece11261e525762  libusb-1.0.21.tar.bz2"
