diff options
Diffstat (limited to 'app-emulation/kvm/kvm-53.ebuild')
-rw-r--r-- | app-emulation/kvm/kvm-53.ebuild | 173 |
1 files changed, 173 insertions, 0 deletions
diff --git a/app-emulation/kvm/kvm-53.ebuild b/app-emulation/kvm/kvm-53.ebuild new file mode 100644 index 0000000..58bf5e6 --- /dev/null +++ b/app-emulation/kvm/kvm-53.ebuild @@ -0,0 +1,173 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: 2007/10/02 19:00:00 philantrop Exp $ + +inherit eutils linux-mod + +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" +SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="-* ~amd64 ~x86" +IUSE="alsa gcc4 gnutls kvm qemu sdl" + +DEPEND="sdl? ( >=media-libs/libsdl-1.2.11 ) + alsa? ( >=media-libs/alsa-lib-1.0.13 ) + !gcc4? ( =sys-devel/gcc-3.4.6-r2 ) + gnutls? ( net-libs/gnutls ) + app-text/texi2html + >=sys-fs/e2fsprogs-1.39" + +RDEPEND="${DEPEND} + sys-apps/usermode-utilities + qemu? ( app-emulation/qemu-softmmu ) + !qemu? ( !app-emulation/qemu-softmmu ) + dev-lang/python" + +RESTRICT="strip" + +BUILD_TARGETS="all" + +QA_TEXTRELS="usr/bin/kvm" +QA_EXECSTACK="usr/share/kvm/openbios-sparc32" +QA_WX_LOAD="usr/share/kvm/openbios-sparc32" + +pkg_setup() { + if kernel_is lt 2 6 22 && ! use kvm; then + eerror "the module in your kernel requires an older version of" + eerror "kvm as shown in :" + eerror " http://kvm.qumranet.com/kvmwiki/Downloads" + die "kvm module not compatible, downgrade kvm or USE='kvm'" + fi + + # Don't continue if the KVM modules can't be found + if ! linux_chkconfig_present KVM && ! use kvm; then + eerror "kvm module not found on your kernel" + eerror "USE='kvm' or enable KVM and the kvm module for your CPU" + die "kvm module missing in kernel" + fi + + MODULE_NAMES="kvm(misc:${S}/kernel) + kvm-intel(misc:${S}/kernel) + kvm-amd(misc:${S}/kernel)" + + if use kvm; then + linux-mod_pkg_setup + else + ewarn "Using the kernel-provided module." + ewarn "Some features may only be available in newer releases." + fi +} + +src_unpack() { + unpack ${A} + cd "${S}" + epatch "${FILESDIR}/kvm-47-configure-qemu.patch" + epatch "${FILESDIR}/kvm-45-qemu-configure.patch" + epatch "${FILESDIR}/kvm-45-qemu-kvm.patch" + epatch "${FILESDIR}/kvm-45-qemu-kvm-doc.patch" + epatch "${FILESDIR}/kvm-43-qemu-kvm-cmdline.patch" + epatch "${FILESDIR}/kvm-48-kvm.patch" + epatch "${FILESDIR}/kvm-43-qemu-ifup.patch" + epatch "${FILESDIR}/kvm-50-libkvm-no-kernel.patch" + epatch "${FILESDIR}/kvm-50-qemu-bios-no-sparc.patch" + epatch "${FILESDIR}/kvm-51-qemu-ramaddr.patch" + epatch "${FILESDIR}/kvm-53-qemu-checkext-inc.patch" + epatch "${FILESDIR}/kvm-53-qemu-exec-fmt.patch" + epatch "${FILESDIR}/kvm-53-qemu-ramalloc-fmt.patch" + + if use qemu; then + epatch "${FILESDIR}/kvm-45-qemu-no-img.patch" + fi + + if use gcc4; then + epatch "${FILESDIR}/kvm-45-qemu-gcc4.patch" + else + epatch "${FILESDIR}/kvm-47-qemu-gcc3.patch" + fi +} + +src_compile() { + # fix make install to not install modules + sed -i -e '/$(kcmd)/d' "${WORKDIR}/${P}/Makefile" + + conf_opts="--prefix=/usr" + + if use alsa; then + conf_opts="$conf_opts --enable-alsa" + fi + + if ! use gnutls; then + conf_opts="$conf_opts --disable-vnc-tls" + fi + + if ! use sdl; then + conf_opts="$conf_opts --disable-gfx-check --disable-sdl" + fi + + if use gcc4; then + conf_opts="$conf_opts --disable-gcc-check" + fi + + # Hand-crafted configure script. econf doesn't work. + ./configure ${conf_opts} || die "./configure failed" + + emake user qemu || die "emake failed" + + if use kvm; then + linux-mod_src_compile + fi +} + +src_install() { + # fix make install to not install modules + sed -i -e '/$(kcmd)/d' "${WORKDIR}/${P}/Makefile" + + if use kvm; then + linux-mod_src_install + fi + + emake DESTDIR="${D}" install || die "make install failed" + + exeinto /etc/kvm/utils/ + doexe "${S}/kvm" "${S}/kvm_stat" + mv "${D}/usr/share/man/man1/qemu.1" "${D}/usr/share/man/man1/kvm.1" + + insinto /etc/udev/rules.d/ + doins "${WORKDIR}/${P}/scripts/65-kvm.rules" + + insinto /etc/kvm/ + insopts -m0755 + doins "${WORKDIR}/${P}/scripts/qemu-ifup" + doins "${WORKDIR}/${P}/config.mak" +} + +pkg_postinst() { + if use kvm; then + linux-mod_pkg_postinst + fi + enewgroup kvm + + elog "If you don't have kvm compiled into the kernel, make sure you have the kernel" + elog "module loaded before running kvm. The easiest way to ensure that the kernel" + elog "module is loaded is to load it on boot:" + elog "For AMD CPUs:" + elog "echo kvm-amd >> /etc/modules.autoload.d/kernel-2.6" + elog "For Intel CPUs:" + elog "echo kvm-intel >> /etc/modules.autoload.d/kernel-2.6" + echo + elog "Make sure your user is in the 'kvm' group" + elog "Just run 'gpasswd -a <USER> kvm', then have <USER> re-login." + echo + elog "If qemu complains about not having a 1024hz timer, run this:" + elog "echo dev.rtc.max-user-freq=1024 >> /etc/sysctl.conf" + echo + elog "If you want network support in the guest OS, you'll need to make" + elog "sure you compile in support for 802.1d Ethernet Bridging in the" + elog "kernel, set up a bridge network interface and make sure you" + elog "compile Universal TUN/TAP device driver support as a kernel module" + elog "and make it load on boot:" + elog "echo tun >> /etc/modules.autoload.d/kernel-2.6" +} |