# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm/configs/lineage_fame_defconfig

pkgname=linux-nokia-fame
pkgver=3.4.0
pkgrel=0
pkgdesc="Nokia Lumia 520 kernel fork"
arch="armv7"
_carch="arm"
_flavor="nokia-fame"
url="https://kernel.org"
license="GPL-2.0-only"
options="!strip !check !tracedeps pmb:cross-native"
makedepends="
	bash
	bc
	bison
	devicepkg-dev
	flex
	openssl-dev
	perl
"

# Source
_repository="android_kernel_nokia_msm8x27"
_commit="c76fa190cc0d20a9d803ce9bdb59eab0de67a64a"
_config="config-$_flavor.$arch"
source="
	$pkgname-$_commit.tar.gz::https://github.com/Android4Lumia/android_kernel_nokia_msm8x27/archive/$_commit.tar.gz
	$_config
	gcc7-give-up-on-ilog2-const-optimizations.patch
	gcc8-fix-put-user.patch
	gcc10-extern_YYLOC_global_declaration.patch
	kernel-use-the-gnu89-standard-explicitly.patch
	linux3.4-vfs-Fix-proc-tid-fdinfo-fd-file-handling.patch
"
builddir="$srcdir/$_repository-$_commit"
_outdir="out"

prepare() {
	default_prepare
	. downstreamkernel_prepare
}

build() {
	unset LDFLAGS
	make O="$_outdir" ARCH="$_carch" CC="${CC:-gcc}" \
		KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS"
}

package() {
	downstreamkernel_package "$builddir" "$pkgdir" "$_carch" \
		"$_flavor" "$_outdir"
}

sha512sums="
7b09ae324b285b659a0b78755a559a814fabdc40857e0957fa4b637ed4b26b9d25b5a936d5231d5492956f6bd6a84739e5ab6402c8c0065d2b5963d0fe0bf6d8  linux-nokia-fame-c76fa190cc0d20a9d803ce9bdb59eab0de67a64a.tar.gz
f8dcfd0715ee8eda512f6fe0851f2c9eb0e05fb89e9b18018f329db650b91a927102fc68d25a30aa164b28ddd80fa21f2af6e5fc4d2863873bccffcbd3abaa64  config-nokia-fame.armv7
77eba606a71eafb36c32e9c5fe5e77f5e4746caac292440d9fb720763d766074a964db1c12bc76fe583c5d1a5c864219c59941f5e53adad182dbc70bf2bc14a7  gcc7-give-up-on-ilog2-const-optimizations.patch
197d40a214ada87fcb2dfc0ae4911704b9a93354b75179cd6b4aadbb627a37ec262cf516921c84a8b1806809b70a7b440cdc8310a4a55fca5d2c0baa988e3967  gcc8-fix-put-user.patch
2b48f1bf0e3f70703d2cdafc47d5e615cc7c56c70bec56b2e3297d3fa4a7a1321d649a8679614553dde8fe52ff1051dae38d5990e3744c9ca986d92187dcdbeb  gcc10-extern_YYLOC_global_declaration.patch
ad0182a483791fc88e058838bc331b2f04a75ba291e763767babdb815efadfc3b4fda97e69e2e3f00a426cabea088e35297a92bd287592597d1e309be68ee92c  kernel-use-the-gnu89-standard-explicitly.patch
5e81c20b0b30c1ab09bd59f1e1b77fcce945a27de8144c68617ddc5e8f10e1f6fa8b1e4cd5d63e43511d61dace46fb26b14a6227a667b9718d44c8b81dbe6100  linux3.4-vfs-Fix-proc-tid-fdinfo-fd-file-handling.patch
"
