# Template file for 'asahi-uboot'
pkgname=asahi-uboot
version=2026.04+2
revision=1
archs="aarch64*"
hostmakedepends="bison flex which python3 swig python3-devel
 python3-setuptools python3-pyelftools bc dtc openssl-devel libuuid-devel
 gnutls-devel"
depends="m1n1"
checkdepends="python3-pytest dtc-devel python3-filelock"
short_desc="Das U-Boot for Apple Silicon Macs"
maintainer="dkwo <npiazza@disroot.org>, Will Springer <skirmisher@protonmail.com>"
license="GPL-2.0-or-later, MIT"
homepage="https://asahilinux.org"
distfiles="https://github.com/AsahiLinux/u-boot/archive/refs/tags/asahi-v${version/+/-}.tar.gz"
checksum=b3cdcc467afbf6737ad7c87d174daa8eb0dcc212feb275ee56c406c1e084768c
make_check=no # missing python3-libfdt ?

if [ "${CROSS_BUILD}" ]; then
	export CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-
fi

do_configure() {
	make ${makejobs} apple_m1_defconfig
}

do_build() {
	make ${makejobs} EXTRAVERSION=-${revision}
}

do_install() {
	vinstall u-boot-nodtb.bin 0644 usr/lib/asahi-boot
}

post_install() {
	vlicense Licenses/Exceptions
	vlicense Licenses/OFL.txt
	vlicense Licenses/README
	vlicense Licenses/bsd-2-clause.txt
	vlicense Licenses/bsd-3-clause.txt
	vlicense Licenses/eCos-2.0.txt
	vlicense Licenses/gpl-2.0.txt
	vlicense Licenses/ibm-pibs.txt
	vlicense Licenses/isc.txt
	vlicense Licenses/lgpl-2.0.txt
	vlicense Licenses/lgpl-2.1.txt
	vlicense Licenses/r8a779x_usb3.txt
	vlicense Licenses/x11.txt
}
