SUMMARY="Utilities for working with 'Das U-Boot'"
DESCRIPTION="This package includes the mkimage program, which allows generation
of U-Boot images in various formats."
HOMEPAGE="https://www.denx.de/wiki/U-Boot/Documentation/"
COPYRIGHT="2003 - 2021 U-Boot"
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="http://ftp.denx.de/pub/u-boot/u-boot-2021.10.tar.bz2"
CHECKSUM_SHA256="cde723e19262e646f2670d25e5ec4b1b368490de950d4e26275a988c36df0bd4"
SOURCE_DIR="u-boot-$portVersion"
PATCHES="u_boot_tools-$portVersion.patchset"

ARCHITECTURES="all ?x86_gcc2"

PROVIDES="
	u_boot_tools = $portVersion
	cmd:mkenvimage
	cmd:mkimage
	cmd:proftool
	cmd:netconsole
	cmd:jtagconsole
	cmd:img2srec
	cmd:ifwitool
	cmd:gen_eth_addr
	cmd:gen_ethaddr_crc
	cmd:fit_info
	cmd:fit_check_sign
	cmd:fdtgrep
	cmd:dumpimage
	"
REQUIRES="
	haiku
	lib:libcrypto$secondaryArchSuffix
	lib:libssl$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku_devel
	lib:libcrypto$secondaryArchSuffix
	lib:libssl$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	devel:libssl$secondaryArchSuffix
	cmd:awk
	cmd:cmp
	cmd:gcc
	cmd:make
	cmd:bison
	cmd:flex
	"

BUILD()
{
	cp include/image.h include/uimage.h
	
	make tools-only_defconfig

	#make tools-all
	make tools-only
}

INSTALL()
{
	mkdir -p $binDir
	cp tools/mkimage $binDir
	cp tools/mkenvimage $binDir
	cp tools/proftool $binDir
	cp tools/netconsole $binDir
	cp tools/jtagconsole $binDir
	cp tools/img2srec $binDir
	cp tools/ifwitool $binDir
	cp tools/gen_eth_addr $binDir
	cp tools/gen_ethaddr_crc $binDir
	cp tools/fit_info $binDir
	cp tools/fit_check_sign $binDir
	cp tools/fdtgrep $binDir
	cp tools/dumpimage $binDir
} 
