# Co-Maintainer: Oliver Smith <ollieparanoid@postmarketos.org>
# Co-Maintainer: Ferass El Hafidi <funderscore@postmarketos.org>
maintainer="Clayton Craft <clayton@craftyguy.net>"
pkgname=device-generic-x86_64
pkgdesc="Generic x86_64 system, with EFI"
pkgver=28
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="x86_64"
options="!check !archcheck"
depends="
	alsa-ucm-conf
	hwdata
	postmarketos-base
	systemd-boot
	systemd-boot-x86
	unl0kr-fbforcerefresh
"
makedepends="devicepkg-dev"
source="
	deviceinfo
	kernel-cmdline.conf
	modules-initfs
	30-gpu-i915-firmware.files
"
install="$pkgname.post-install $pkgname.post-upgrade"
subpackages="
	$pkgname-intel
	$pkgname-kernel-stable:kernel_stable
	$pkgname-kernel-lts:kernel_lts
	$pkgname-kernel-mainline:kernel_mainline
"
_pmb_recommends="
	firmware-b43xx
	fwupd
	linux-firmware
	oem-amd
	oem-intel
	oem-nvidia
"
provides="device-tablet-x64uefi=$pkgver-r$pkgrel device-tablet-x86uefi=$pkgver-r$pkgrel"

build() {
	devicepkg_build $startdir $pkgname
}

package() {
	devicepkg_package $startdir $pkgname
}

intel() {
	pkgdesc="Intel-specific configuration"
	install_if="$pkgname=$pkgver-r$pkgrel oem-intel"

	install -Dm644 "$srcdir"/30-gpu-i915-firmware.files \
		-t "$subpkgdir"/usr/share/mkinitfs/files/
}

kernel_stable() {
	pkgdesc="Stable kernel (recommended, best balance between stability and features)"
	depends="linux-postmarketos-stable"
	devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}

kernel_lts() {
	pkgdesc="Long-term maintenance kernel (most stability, not all security fixes & new features)"
	depends="linux-postmarketos-lts"
	devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}

kernel_mainline() {
	pkgdesc="Upstream development kernel (regular breakage, latest features)"
	depends="linux-postmarketos-mainline"
	devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}

sha512sums="
a88e80ef4cb33935bdc663c0b8be10e5be92aefcab3376c348c6dfe04c61c59e6a37520d9d658336aff54d5aefed310d21701bc9c48e39a35403565ad990c01f  deviceinfo
9449922b5167d5c54cfea3b9bb58c4fa3f50d1974464b897a1e6a618bbb80377ec1348fb145fa95f4ba58f645b7e50f1f89feefcaa90de18679a1d73ed92b154  kernel-cmdline.conf
c16ee86e223aafa940501245b4002e51dc607f1814e0e06dce5c7c1024f5d33b8ac5473611da37049afea095ea5978c4ad8875685346f95df79e71c68de22ff3  modules-initfs
25759ef9c8dd7bacff84ccf2896bc76f0bb5d20f214afa0e1b81219853c31ed02263870b8bed6195e679a19fff20f6da266cb95fd93a203bef8645c3deae920f  30-gpu-i915-firmware.files
"
