# Kernel config based on: arch/arm64/configs/lineage_flounder_defconfig

pkgname="linux-htc-flounder"
pkgver=3.10.103
pkgrel=2
pkgdesc="Google Nexus 9 kernel fork"
arch="aarch64"
_carch="arm64"
_flavor="htc-flounder"
url="https://kernel.org"
license="GPL2"
options="!strip !check !tracedeps"
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev devicepkg-dev gcc6"

# Compiler: this kernel was only tested with GCC6. Feel free to make a merge
# request if you find out that it is booting working with newer GCCs as
# well. See <https://postmarketos.org/vendorkernel> for instructions.
if [ "${CC:0:5}" != "gcc6-" ]; then
	CC="gcc6-$CC"
	HOSTCC="gcc6-gcc"
	CROSS_COMPILE="gcc6-$CROSS_COMPILE"
fi

# Source
_repository="android_kernel_htc_flounder"
_commit="a8f66d78789d66906c886fd6818fb648d0a84a2a"
_config="config-$_flavor.$arch"
source="
	$pkgname-$_commit.tar.gz::https://github.com/LineageOS/$_repository/archive/$_commit.tar.gz
	$_config
	compiler-gcc6.h
"
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="b9ee4b14b0466e0b19d869810ceb852dd70399a90cdb081b902177685b87d242e11284bb0f619ea103b30ef5544f06a88c0131d028024ad8aa45809697e070fa  linux-htc-flounder-a8f66d78789d66906c886fd6818fb648d0a84a2a.tar.gz
e5a0b2c37ee5fa7dc6b66bbe2addf7f5c76f873a72ffbf9f7b8526efe3dc1f88bea7df47f6a34c36120005253a6926975733f6709e2947fb2d2f57d74c964804  config-htc-flounder.aarch64
d80980e9474c82ba0ef1a6903b434d8bd1b092c40367ba543e72d2c119301c8b2d05265740e4104ca1ac5d15f6c4aa49e8776cb44264a9a28dc551e0d1850dcc  compiler-gcc6.h"
