SUMMARY="An API wrapper for libusb"
DESCRIPTION="libusb is a C library that provides generic access to USB \
devices. It is intended to facilitate the communication with USB hardware.
libusb-compat is a wrapper library for software that use the 0.1 API."
HOMEPAGE="https://libusb.info/"
COPYRIGHT="2008 Daniel Drake"
LICENSE="GNU LGPL v2"
REVISION="1"
SOURCE_URI="https://github.com/libusb/libusb-compat-0.1/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="d9ca58ec05ba5a29646a7549b9c2c02475a7ed86637337a4ee35b5d559de6e0d"
SOURCE_DIR="libusb-compat-0.1-$portVersion"
PATCHES="libusb_compat-$portVersion.patchset"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	libusb_compat$secondaryArchSuffix = $portVersion
	lib:libusb$secondaryArchSuffix = $portVersion
	lib:libusb_0.1$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libusb_1.0$secondaryArchSuffix
	"

PROVIDES_devel="
	libusb_compat${secondaryArchSuffix}_devel = $portVersion
	cmd:libusb_config$secondaryArchSuffix = $portVersion
	devel:libusb$secondaryArchSuffix = $portVersion
	devel:libusb_0.1${secondaryArchSuffix} = $portVersion
	"
REQUIRES_devel="
	libusb_compat${secondaryArchSuffix} == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libusb_1.0$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoreconf
	cmd:automake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtool$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:sed
	"

BUILD()
{
	autoreconf -vfi
	runConfigure ./configure --enable-static=no
	make $jobArgs
}

INSTALL()
{
	make install

	rm $libDir/libusb*.la

	# set up the develop directory correctly
	prepareInstalledDevelLibs libusb-0.1 libusb
	fixPkgconfig

	# devel package
	packageEntries devel \
		$developDir \
		$binDir
}

TEST()
{
	make check
}
