# Build template for 'kernel-uml'.
. ${XBPS_SRCPKGDIR}/kernel/common-vars

pkgname=kernel-uml
build_style=custom-install
short_desc="Kernel ${version} for User Mode Linux"
long_desc="
 User-mode Linux (UML) is a port of the Linux kernel to its own system call
 interface. It provides a kind of virtual machine, which runs Linux as a user
 process under another Linux kernel. This is useful for kernel development,
 sandboxes, jails, experimentation, and many other things.

 This package contains the kernel itself, as an executable program, and the
 associated kernel modules."

Add_dependency run glibc
Add_dependency build perl ">=0"
Add_dependency build libpcap-devel
Add_dependency full uml-utilities

do_build()
{
	make LDFLAGS= ARCH=um defconfig && make LDFLAGS= ARCH=um ${makejobs}
}

do_install()
{
	install -D -m755 ${wrksrc}/linux ${DESTDIR}/usr/bin/linux
	make ARCH=um INSTALL_MOD_PATH=${DESTDIR}/usr/lib/uml modules_install
	rm -f ${DESTDIR}/usr/lib/uml/lib/modules/${version}/{build,source}
	mv ${DESTDIR}/usr/lib/uml/lib/modules ${DESTDIR}/usr/lib/uml
	rmdir ${DESTDIR}/usr/lib/uml/lib
}
