# Arctic-base-kernel - the default kernel. Full hardware support.
#
# The configuration is the Gentoo distribution kernel's .config, which is
# well tested across a huge range of machines, plus an Arctic delta: no BTF or
# DWARF debug info (it costs hours of build time and hundreds of megabytes), no
# module signing (alpm verifies packages instead), and squashfs, overlayfs, loop
# and iso9660 built in-tree so the live image can mount itself.
name=Arctic-base-kernel
version=7.1.3
release=1
desc="Arctic Linux kernel, broad hardware support"
url="https://kernel.org/"
license="GPL-2.0-only"
depend="glibc"
makedepend="clang lld bmake"
provides="kernel"
source="https://cdn.kernel.org/pub/linux/kernel/v7.x/linux-$version.tar.xz
	arctic-base.config"
sha256="SKIP
	SKIP"
options="!strip"

build() {
	cd "linux-$version"
	cp ../arctic-base.config .config
	make olddefconfig
	make -j"$JOBS" bzImage modules
}

package() {
	cd "linux-$version"
	local kver
	kver=$(make -s kernelrelease)
	install -Dm644 arch/x86/boot/bzImage "$pkgdir/boot/vmlinuz-arctic-base"
	install -Dm644 .config "$pkgdir/boot/config-arctic-base"
	install -Dm644 System.map "$pkgdir/boot/System.map-arctic-base"
	make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 modules_install
	# Nothing in a package should point back at the build tree.
	rm -f "$pkgdir/usr/lib/modules/$kver/build" \
	      "$pkgdir/usr/lib/modules/$kver/source"
	echo "$kver" >"$pkgdir/usr/lib/modules/arctic-base.release"
}
