# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-tolino-shine2hd
pkgdesc="Tolino Shine 2 HD"
pkgver=0.4
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="armv7"
options="!check !archcheck"
depends="
	kobo-epdc-extractor
	linux-kobo-clara-mainline
	perl
	postmarketos-base
	u-boot-tolino-shine2hd
	u-boot-tools
"
makedepends="devicepkg-dev"
subpackages="$pkgname-nonfree-firmware:nonfree_firmware"

source="
	deviceinfo
	uboot-script.cmd
"

build() {
	devicepkg_build $startdir $pkgname
}

package() {
	devicepkg_package $startdir $pkgname
	mkimage -A arm -O linux -T script -n postmarketOS \
		-d "$srcdir/uboot-script.cmd" "$srcdir/boot.scr"
	install -Dm644 "$srcdir/boot.scr" "$pkgdir/boot/boot.scr"
}

nonfree_firmware() {
	pkgdesc="Wifi firmware"
	depends="linux-firmware-brcm"
	mkdir "$subpkgdir"
}

sha512sums="
525a4cd444cc450b3ea62ade25ba9f807f603a0f2a551e4ae40cc9065d82339ccdf9fd0d0f0625a066a3b83c441d7b5dc24cdd384b7cf5d9cfd8369627768f47  deviceinfo
3b5c33ffa9b81d55451fd4fa0c9ed69149304b88fb85752cead4d34b5467112029cc4883a91e7daa38f8cba55d90a814711b2c55a8d462d115b62f752ce311b7  uboot-script.cmd
"
