SUMMARY="A Device Firmware Update based USB programmer for Atmel chips"
DESCRIPTION="
dfu-programmer is an implementation of the Device Firmware Upgrade class
USB driver that enables firmware upgrades for various USB enabled (with the
correct bootloader) Atmel chips.  This program was created because the
Atmel "FLIP" program for flashing devices does not support flashing via USB
on Linux, and because standard DFU loaders do not work for Atmel's chips.

Check out the Atmel website for more information.  They are kind enough to
provide generally correct specifications this implementation is based on.

The project website is http://dfu-programmer.sourceforge.net and you can
use that to check for updates.
"
HOMEPAGE="http://dfu-programmer.sourceforge.net"
LICENSE="
	GNU GPL v2
"
COPYRIGHT="
    Weston Schmidt <weston_schmidt@alumni.purdue.edu>
"
SOURCE_URI="http://downloads.sourceforge.net/project/dfu-programmer/dfu-programmer/0.6.2/dfu-programmer-0.6.2.tar.gz" 
SOURCE_DIR="dfu-programmer-0.6.2"
CHECKSUM_SHA256="0120966a424dd98124962055750e90cbd6c7b6b0fbf5b187bf435daa0a24af65"
REVISION="1"
ARCHITECTURES="x86 x86_64"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	# x86_gcc2 is fine as primary target architecture as long as we're building
	# for a different secondary architecture.
	ARCHITECTURES="$ARCHITECTURES x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"

PATCHES="dfu-programmer-0.6.2.patch"

PROVIDES="
	dfu_programmer = $portVersion
	cmd:dfu_programmer$secondaryArchSuffix = $portVersion
"

REQUIRES="
	haiku$secondaryArchSuffix
	lib:libusb_1.0$secondaryArchSuffix
"

BUILD_REQUIRES="
	devel:libusb_1.0$secondaryArchSuffix
"

BUILD_PREREQUIRES="
	haiku${secondaryArchSuffix}_devel
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:automake
	cmd:autoconf
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
"

BUILD()
{
	export PKG_CONFIG_LIBDIR=/system/develop/lib/x86/pkgconfig/
	sh ./bootstrap.sh
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install
}
