# Maintainer: Luca Weiss <luca@lucaweiss.eu>
pkgname=libusbgx
pkgver=0.2.0
pkgrel=2
pkgdesc="C library encapsulating the Linux kernel USB gadget configfs userspace API functionality"
url="https://github.com/linux-usb-gadgets/libusbgx"
arch="all"
license="LGPL-2.1-or-later"
depends_dev="
	bsd-compat-headers
	"
makedepends="
	$depends_dev
	autoconf
	automake
	libconfig-dev
	libtool
	linux-headers
	"
subpackages="$pkgname-static $pkgname-dev $pkgname-tools"
source="https://github.com/linux-usb-gadgets/libusbgx/archive/refs/tags/libusbgx-v$pkgver.tar.gz
	sysmacros.patch
	"
builddir="$srcdir/libusbgx-libusbgx-v$pkgver"
options="!check" # tests don't build

prepare() {
	default_prepare
	autoreconf -fi
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var
	make
}

package() {
	make DESTDIR="$pkgdir" install
}

tools() {
	pkgdesc="$pkgdesc (tools)"
	amove usr/bin
}

sha512sums="
616457b0675099bd68d8cc8d42bcbd6cbe362177967264a547c2e82e8d3c13d8a3e8348244a4cfd8b4a82e1cf08b49336c5b5f352e2cc3163f452319a899cf28  libusbgx-v0.2.0.tar.gz
53afb8ec402f331bdb19a685397dfec6db9c81baeb51670ac7e645b537c4a948662602f603848c538e432a15d85426a7cd68f86139662bd374cd21d331ca7307  sysmacros.patch
"