# Template file for 'kernel-libc-headers'
pkgname=kernel-libc-headers
version=6.14
revision=1
bootstrap=yes
short_desc="Linux API headers for userland development"
maintainer="Érico Nogueira <ericonr@disroot.org>"
license="GPL-2.0-only"
homepage="http://www.kernel.org"
distfiles="${KERNEL_SITE}/kernel/v${version%%.*}.x/linux-${version}.tar.xz"
checksum=a294b683e7b161bb0517bb32ec7ed1d2ea7603dfbabad135170ed12d00c47670

if [ "$CHROOT_READY" ]; then
	hostmakedepends="perl"
fi

case "$XBPS_TARGET_MACHINE" in
	i686*|x86_64*) _arch="x86";;
	arm*) _arch="arm";;
	aarch64*) _arch="arm64";;
	mips*) _arch="mips";;
	ppc*) _arch="powerpc";;
	riscv*) _arch="riscv" ;;
	*) msg_error "$pkgname: unknown architecture.\n";;
esac

do_build() {
	make mrproper
	make ARCH="${_arch}" headers
}

do_install() {
	# the make header_install depends on rsync so just do the same thing manuall.
	vcopy usr/include usr
	find "${DESTDIR}/usr/include" -type f ! -name '*.h' -delete
}
