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

pkgname=linux-sony-honami
pkgver=3.10.84
pkgrel=5
pkgdesc="Sony Xperia Z1 kernel fork"
arch="armv7"
_carch="arm"
_flavor="sony-honami"
url="https://github.com/sonyxperiadev/kernel"
license="GPL-2.0-only"
options="!strip !check !tracedeps pmb:cross-native"
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev devicepkg-dev"

# Source
_repository="kernel"
_commit="d78970c1afd9fad52cb4402c7bcb9701e8a06d41"
_config="config-$_flavor.$arch"
source="
	$pkgname-$_commit.tar.gz::https://github.com/sonyxperiadev/$_repository/archive/$_commit.tar.gz
	$_config
	gcc7-give-up-on-ilog2-const-optimizations.patch
	gcc8-fix-put-user.patch
	gcc10-extern_YYLOC_global_declaration.patch
"
builddir="$srcdir/$_repository-$_commit"

prepare() {
	default_prepare
	. downstreamkernel_prepare
}

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

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

sha512sums="b76641c07489712d393f1d318b0d4138e5c7126d4b78cfc23bcde07911cba185d3872e886f69197bd3912e8b4c646b74fb6992dee0ce3829d2995531ac4f257e  linux-sony-honami-d78970c1afd9fad52cb4402c7bcb9701e8a06d41.tar.gz
631b118006bc4c5fb47dae2266e5e54238d1582c89327522bbd52829c9c59ea1f5d0e81d65b91a85cde98082134959cf319be4d91fd1bbc4f01be4c0457252cd  config-sony-honami.armv7
77eba606a71eafb36c32e9c5fe5e77f5e4746caac292440d9fb720763d766074a964db1c12bc76fe583c5d1a5c864219c59941f5e53adad182dbc70bf2bc14a7  gcc7-give-up-on-ilog2-const-optimizations.patch
197d40a214ada87fcb2dfc0ae4911704b9a93354b75179cd6b4aadbb627a37ec262cf516921c84a8b1806809b70a7b440cdc8310a4a55fca5d2c0baa988e3967  gcc8-fix-put-user.patch
2b48f1bf0e3f70703d2cdafc47d5e615cc7c56c70bec56b2e3297d3fa4a7a1321d649a8679614553dde8fe52ff1051dae38d5990e3744c9ca986d92187dcdbeb  gcc10-extern_YYLOC_global_declaration.patch"
