# Reference: <https://postmarketos.org/devicepkg>
# Maintainer: Maxim Karasev <begs@disroot.org>
pkgname=device-xunlong-orangepi3
pkgdesc="Xunlong Orange Pi 3"
pkgver=0.1
pkgrel=1
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="
	linux-postmarketos-allwinner
	mesa-dri-gallium
	postmarketos-base
	u-boot-tools
	u-boot-sunxi
"
makedepends="devicepkg-dev"
subpackages="$pkgname-nonfree-firmware:nonfree_firmware"
source="
	deviceinfo
	uboot-script.cmd
"

build() {
	devicepkg_build $startdir $pkgname
	mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
		-n postmarketos -d "$srcdir"/uboot-script.cmd \
		"$srcdir"/boot.scr
}

package() {
	devicepkg_package $startdir $pkgname
	install -D -m644 "$srcdir"/boot.scr \
		"$pkgdir"/boot/boot.scr
}

nonfree_firmware() {
	pkgdesc="Wi-Fi and Bluetooth firmware"
	depends="firmware-xunlong-orangepi3"
	mkdir "$subpkgdir"
}

sha512sums="
8199d26c182de5ecb21f8dc63fbf2f3df76119d91f41a69644c8cc125f6a7ab50bd40666b441f0e6edd16c4f2f4c24db529b80f6141e0f0a900e2e74cac175ed  deviceinfo
90dab64c2b3c55756017b63fea18852a22cae6ee43abb71b1c019c00a77e140cc162d7736bba5c8c007d1f6fa32cb8901ec190a3e46aaa85c557e4907d0bb1c7  uboot-script.cmd
"
