SUMMARY="libFTDI is an open source library to talk to FTDI chips"
DESCRIPTION="
libFTDI is an open source library to talk to FTDI chips: FT232BM, FT245BM, \
FT2232C, FT2232D, FT245R and FT232H including the popular bitbang mode. The \
library is linked with your program in userspace, no kernel driver required.
libFTDI works perfectly with Linux, Windows, MacOS X and BSD variants thanks to \
libusb.
"
HOMEPAGE="http://www.intra2net.com/en/developer/libftdi/index.php"
SRC_URI="http://www.intra2net.com/en/developer/libftdi/download/libftdi1-1.0.tar.bz2"
CHECKSUM_SHA256="7290fd38208d8c00d25ed13ce172aaa0403b37148080e4a33a99837022d2b321"
LICENSE="
	GNU LGPL v2.1
	GNU GPL v2
	"
COPYRIGHT="2003-2013 Intra2net AG and the libftdi developers"
REVISION="1"
ARCHITECTURES="x86 x86_gcc2"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"
SOURCE_DIR="libftdi1-$portVersion"
PATCHES="libftdi-1.0.patch"

PROVIDES="
	libftdi1$secondaryArchSuffix = $portVersion
	lib:libftdi1$secondaryArchSuffix = $portVersion
	lib:libftdipp1$secondaryArchSuffix = $portVersion
	cmd:ftdi_eeprom$secondaryArchSuffix
	cmd:libftdi1_config$secondaryArchSuffix
	"

REQUIRES="
	haiku$secondaryArchSuffix >= $haikuVersion
	lib:libconfuse$secondaryArchSuffix >= 2.5
	libusb$secondaryArchSuffix >= 1.0
	boost$secondaryArchSuffix
	"

BUILD_REQUIRES="
        haiku${secondaryArchSuffix}_devel >= $haikuVersion
	libconfuse${secondaryArchSuffix}_devel >= 2.5
	libusb${secondaryArchSuffix}_devel
	boost_devel$secondaryArchSuffix
	"

BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:cmake
	cmd:make
	"

BUILD()
{
	rm -rf build
	mkdir build
	cd build
	cmake -DCMAKE_INSTALL_PREFIX:PATH=$prefix \
		-DLIBUSB_INCLUDE_DIR=/system/$relativeIncludeDir/libusb-1.0 \
		-DConfuse_INCLUDE_DIRS=/system/$relativeIncludeDir \
		-DConfuse_LIBRARY_DIRS=/system/$relativeDevelopLibDir \
		-DConfuse_LIBRARIES="libconfuse.so" \
		-DConfuse_FOUND=TRUE \
		-DLIBUSB="libusb-1.0.so" \
		-DLIB_SUFFIX=$secondaryArchSubDir \
		-DBIN_SUFFIX=$secondaryArchSubDir \
		-DINC_SUFFIX=$secondaryArchSubDir \
		..
	make
}

INSTALL()
{
	cd build
	make install
	prepareInstalledDevelLib libftdi1
	prepareInstalledDevelLib libftdipp1
	fixPkgconfig
	packageEntries devel $developDir
}

PROVIDES_devel="
	libftdi1${secondaryArchSuffix}_devel = $portVersion
	devel:libftdi1$secondaryArchSuffix = $portVersion
	devel:libftdipp1$secondaryArchSuffix = $portVersion
	"

REQUIRES_devel="
	lib:libftdi1$secondaryArchSuffix == $portVersion base
	"
