# Template file for 'ci20-uboot'
pkgname=ci20-uboot
version=v2013.10
revision=1
hostmakedepends="bc git uboot-mkimage"
short_desc="U-Boot for the MIPS Creator CI20"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2"
homepage="http://www.denx.de/wiki/U-Boot/WebHome"

archs="mispel*"

do_fetch() {
	git clone -b ci20-${version} git://github.com/MIPS/CI20_u-boot ${wrksrc}
	cd $wrksrc
	git reset --hard 25f5638f961c6bfcc64a1e02f742e60aa13fc1c6

	sed -i 's,ulong,unsigned long,g' include/image.h include/bootstage.h \
		tools/mkimage.h common/image.c common/image-fit.c tools/proftool.c
}
do_build() {
	unset CFLAGS CXXFLAGS LDFLAGS
	make distclean
	if [ -n "$CROSS_BUILD" ]; then
		make ARCH=mips CROSS_COMPILE=${XBPS_CROSS_TRIPLET}- ci20_mmc
		make ARCH=mips CROSS_COMPILE=${XBPS_CROSS_TRIPLET}- ${makejobs}
	else
		make ARCH=mips ci20_mmc
		make ARCH=mips ${makejobs}
	fi
}
do_install() {
	vinstall spl/u-boot-spl.bin 644 boot
	vinstall u-boot.img 644 boot
}
