# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-tablet-x64uefi
pkgdesc="Various tablets with atom CPU"
pkgver=0.2
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="x86_64"
# pmb:strict: avoid grub-related install error during build with pmbootstrap
options="!check !archcheck pmb:strict"
depends="postmarketos-base linux-lts mesa-dri-swrast"
makedepends="devicepkg-dev grub grub-efi"
source="
	deviceinfo
	grub.cfg
	grub_early.cfg
"

build() {
	devicepkg_build $startdir $pkgname

	grub-mkimage \
		--config="$srcdir/grub_early.cfg" \
		--prefix="" \
		--output="bootx64.efi" \
		--format="x86_64-efi" \
		--compression="xz" \
		\
		all_video \
		cat \
		configfile \
		disk \
		echo \
		efi_gop \
		fat \
		gzio \
		help \
		iso9660 \
		linux \
		ls \
		normal \
		part_gpt \
		part_msdos \
		search \
		search_label \
		test \
		true
}

package() {
	devicepkg_package $startdir $pkgname

	install -Dm644 "$srcdir"/grub.cfg \
		"$pkgdir"/boot/grub/grub.cfg
	install -Dm644 "$srcdir"/bootx64.efi \
		"$pkgdir"/boot/EFI/Boot/bootx64.efi
}

sha512sums="
49bde5bcf1120a3a93131eb5285c0a4589260d53902ca76ce7205878e187d7c26c4b275c7f2b6f09f11e019042601e6d3cefd938392f0a4386f839923ed37356  deviceinfo
f98771a0e34326557626522ed3a4cbdb7e30b4dd4d288f4a391c4c68055bd5eab39a6bea9f72f63d6b76933ac11689ce1da2c96a83e1048e4b00e5003e1c25aa  grub.cfg
0f9357d4eea089628fbceb1e3e96d21a3f4329aeb6743158a6f877f967ef274506404eba949d5f01b7e1adea149f9a3aef992a5e8cd4181f93ab00909b1c5ecd  grub_early.cfg
"
