# Template file for 'kirkwood-uboot'
pkgname=dockstar-uboot
version=4
revision=1
wrksrc="u-boot-R${version##*.}"
only_for_archs="armv5tel"
short_desc="(archlinuxarm) u-boot compiled for dockstar"
maintainer="Andrea Brancaleoni <abc@pompel.me>"
license="GPL-3"
homepage="https://github.com/archlinuxarm/u-boot"
distfiles="https://github.com/archlinuxarm/u-boot/archive/R$version.tar.gz http://archlinuxarm.org/os/armv5te/boot/dockstar/uboot-dockstar.env"
checksum="22492ec730f0e91e4f732d8793cea39fb5945386eb46e86f3d8446978361c551 ec6522fdb74a41bc2b6f301729c421c9600be1a479bf7932405b39d2f459ada7"
skip_extraction="uboot-dockstar.env"

do_configure() {
	make dockstar_config
}
do_build() {
	unset CFLAGS CXXFLAGS LDFLAGS
	if [ "$CROSS_BUILD" ]; then
		make CROSS_COMPILE=${XBPS_CROSS_TRIPLET}- u-boot.kwb
	else
		make u-boot.kwb
	fi
	dd if=u-boot.kwb of=uboot-dockstar.kwb bs=512k conv=sync
}
do_install() {
	local srcdir="$XBPS_SRCDISTDIR/$pkgname-$version"
	vinstall uboot-dockstar.kwb 755 boot
	vinstall ${srcdir}/uboot-dockstar.env 644 boot
}
