# Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit linux-mod eutils SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz" DESCRIPTION="KVM is a full virtualisation solution for Linux on hardware containing virtualization extensions (Intel VT or AMD-V)" HOMEPAGE="http://kvm.qumranet.com/kvmwiki" LICENSE="GPL-2" SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="" RESTRICT="mirror" MODULE_NAMES="kernel/kvm(extra:) kernel/kvm-intel(extra:) kernel/kvm-amd(extra:)" BUILD_TARGETS="kernel" src_unpack() { unpack ${A} cd "${S}" epatch ${FILESDIR}/kvm_use_bios_files_in_usr_share_kvm.patch epatch ${FILESDIR}/kvm_add-scripts-qemu-ifup.patch epatch ${FILESDIR}/kvm_use_etc_kvm_kvm-ifup.patch } src_compile() { if [ "$(gcc-major-version)" == "4" ]; then eerror "kvm requires gcc-3 in order to build and work correctly" eerror "please compile it switching to gcc-3." die "gcc 4 cannot build qemu" fi #fix make install to not install modules sed -i '/$(kcmd)/d' ${WORKDIR}/${P}/Makefile linux-mod_pkg_setup conf_opts="--prefix=/usr" ./configure ${conf_opts} || die "configure failed" #Check if kvm is NOT part of the kernel and compile the module if ! linux_chkconfig_present KVM; then linux-mod_src_compile ./configure ${conf_opts} #If it is we need to disable the build of the module else ./configure ${conf_opts} --with-patched-kernel || die "Configure failed" fi make user qemu || die "make failed" } pkg_preinst() { enewgroup kvm } src_install() { make install DESTDIR="${D}" || die if ! linux_chkconfig_present KVM; then linux-mod_src_install fi if use amd64; then mv ${D}/usr/bin/qemu-system-x86_64 ${D}/usr/bin/kvm-system-x86_64 else mv ${D}/usr/bin/qemu ${D}/usr/bin/kvm fi mv ${D}/usr/share/doc/qemu ${D}/usr/share/doc/kvm mv ${D}/usr/share/man/man1/qemu.1 ${D}/usr/share/man/man1/kvm.1 # rm -f ${D}/usr/bin/qemu-img # rm -f ${D}/usr/share/man/man1/qemu-img.1 insinto /etc/udev/rules.d/ doins ${WORKDIR}/${P}/scripts/65-kvm.rules insinto /etc/kvm/ doins ${WORKDIR}/${P}/scripts/qemu-ifup }