OLD | NEW |
(Empty) | |
| 1 # Copyright 1999-2010 Gentoo Foundation |
| 2 # Distributed under the terms of the GNU General Public License v2 |
| 3 # $Header: /var/cvsroot/gentoo-x86/app-emulation/qemu-kvm/qemu-kvm-0.12.3.ebuild
,v 1.1 2010/03/02 16:56:34 cardoe Exp $ |
| 4 |
| 5 EAPI="2" |
| 6 |
| 7 if [[ ${PV} = *9999* ]]; then |
| 8 EGIT_REPO_URI="git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git" |
| 9 GIT_ECLASS="git" |
| 10 fi |
| 11 |
| 12 inherit eutils flag-o-matic ${GIT_ECLASS} linux-info toolchain-funcs |
| 13 |
| 14 if [[ ${PV} = *9999* ]]; then |
| 15 SRC_URI="" |
| 16 KEYWORDS="" |
| 17 else |
| 18 SRC_URI="mirror://sourceforge/kvm/${PN}/${P}.tar.gz" |
| 19 KEYWORDS="amd64 ~ppc ~ppc64 ~x86" |
| 20 fi |
| 21 |
| 22 DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools" |
| 23 HOMEPAGE="http://www.linux-kvm.org" |
| 24 |
| 25 LICENSE="GPL-2" |
| 26 SLOT="0" |
| 27 # xen is disabled until the deps are fixed |
| 28 IUSE="+aio alsa bluetooth curl esd gnutls fdt hardened kvm-trace ncurses \ |
| 29 pulseaudio qemu-ifup sasl sdl static vde" |
| 30 |
| 31 COMMON_TARGETS="i386 x86_64 arm" |
| 32 IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS}" |
| 33 IUSE_USER_TARGETS="" |
| 34 |
| 35 for target in ${IUSE_SOFTMMU_TARGETS}; do |
| 36 IUSE="${IUSE} +qemu_softmmu_targets_${target}" |
| 37 done |
| 38 |
| 39 for target in ${IUSE_USER_TARGETS}; do |
| 40 IUSE="${IUSE} +qemu_user_targets_${target}" |
| 41 done |
| 42 |
| 43 RESTRICT="test" |
| 44 |
| 45 RDEPEND=" |
| 46 !app-emulation/kqemu |
| 47 !app-emulation/qemu |
| 48 !app-emulation/qemu-softmmu |
| 49 sys-apps/pciutils |
| 50 >=sys-apps/util-linux-2.16.0 |
| 51 sys-libs/zlib |
| 52 aio? ( dev-libs/libaio ) |
| 53 alsa? ( >=media-libs/alsa-lib-1.0.13 ) |
| 54 bluetooth? ( net-wireless/bluez ) |
| 55 curl? ( net-misc/curl ) |
| 56 esd? ( media-sound/esound ) |
| 57 fdt? ( sys-apps/dtc ) |
| 58 gnutls? ( net-libs/gnutls ) |
| 59 ncurses? ( sys-libs/ncurses ) |
| 60 pulseaudio? ( media-sound/pulseaudio ) |
| 61 qemu-ifup? ( sys-apps/iproute2 net-misc/bridge-utils ) |
| 62 sasl? ( dev-libs/cyrus-sasl ) |
| 63 sdl? ( >=media-libs/libsdl-1.2.11[X] ) |
| 64 vde? ( net-misc/vde ) |
| 65 " |
| 66 |
| 67 DEPEND="${RDEPEND} |
| 68 app-text/texi2html |
| 69 >=sys-kernel/linux-headers-2.6.29 |
| 70 gnutls? ( dev-util/pkgconfig )" |
| 71 |
| 72 kvm_kern_war() { |
| 73 eerror "Please enable KVM support in your kernel, found at:" |
| 74 eerror |
| 75 eerror " Virtualization" |
| 76 eerror " Kernel-based Virtual Machine (KVM) support" |
| 77 eerror |
| 78 } |
| 79 |
| 80 pkg_setup() { |
| 81 if kernel_is lt 2 6 25; then |
| 82 eerror "This version of KVM requres a host kernel of 2.6.25 or h
igher." |
| 83 eerror "Either upgrade your kernel" |
| 84 die "qemu-kvm version not compatible" |
| 85 else |
| 86 if ! linux_config_exists; then |
| 87 eerror "Unable to check your kernel for KVM support" |
| 88 kvm_kern_warn |
| 89 elif ! linux_chkconfig_present KVM; then |
| 90 kvm_kern_warn |
| 91 fi |
| 92 fi |
| 93 |
| 94 enewgroup kvm |
| 95 } |
| 96 |
| 97 src_prepare() { |
| 98 # prevent docs to get automatically installed |
| 99 sed -i '/$(DESTDIR)$(docdir)/d' Makefile || die |
| 100 # Alter target makefiles to accept CFLAGS set via flag-o |
| 101 sed -i 's/^\(C\|OP_C\|HELPER_C\)FLAGS=/\1FLAGS+=/' \ |
| 102 Makefile Makefile.target || die |
| 103 # append CFLAGS while linking |
| 104 sed -i 's/$(LDFLAGS)/$(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS)/' rules.mak ||
die |
| 105 |
| 106 # remove part to make udev happy |
| 107 sed -e 's~NAME="%k", ~~' -i kvm/scripts/65-kvm.rules || die |
| 108 } |
| 109 |
| 110 src_configure() { |
| 111 local conf_opts audio_opts softmmu_targets user_targets |
| 112 |
| 113 for target in ${IUSE_SOFTMMU_TARGETS} ; do |
| 114 use "qemu_softmmu_targets_${target}" && \ |
| 115 softmmu_targets="${softmmu_targets} ${target}-softmmu" |
| 116 done |
| 117 |
| 118 for target in ${IUSE_USER_TARGETS} ; do |
| 119 use "qemu_user_targets_${target}" && \ |
| 120 user_targets="${user_targets} ${target}-linux-user" |
| 121 done |
| 122 |
| 123 if [ ! -z "${softmmu_targets}" ]; then |
| 124 einfo "Building the following softmmu targets: ${softmmu_targets
}" |
| 125 fi |
| 126 |
| 127 if [ ! -z "${user_targets}" ]; then |
| 128 einfo "Building the following user targets: ${user_targets}" |
| 129 conf_opts="${conf_opts} --enable-linux-user" |
| 130 else |
| 131 conf_opts="${conf_opts} --disable-linux-user" |
| 132 fi |
| 133 |
| 134 # Fix QA issues. QEMU needs executable heaps and we need to mark it as s
uch |
| 135 conf_opts="${conf_opts} --extra-ldflags=-Wl,-z,execheap" |
| 136 |
| 137 # Add support for static builds |
| 138 use static && conf_opts="${conf_opts} --static" |
| 139 |
| 140 #config options |
| 141 conf_opts="${conf_opts} $(use_enable aio linux-aio)" |
| 142 use bluetooth || conf_opts="${conf_opts} --disable-bluez" |
| 143 conf_opts="${conf_opts} $(use_enable curl)" |
| 144 use gnutls || conf_opts="${conf_opts} --disable-vnc-tls" |
| 145 conf_opts="${conf_opts} $(use_enable fdt)" |
| 146 use hardened && conf_opts="${conf_opts} --enable-user-pie" |
| 147 use kvm-trace && conf_opts="${conf_opts} --with-kvm-trace" |
| 148 use ncurses || conf_opts="${conf_opts} --disable-curses" |
| 149 use sasl || conf_opts="${conf_opts} --disable-vnc-sasl" |
| 150 use sdl || conf_opts="${conf_opts} --disable-sdl" |
| 151 use vde || conf_opts="${conf_opts} --disable-vde" |
| 152 # conf_opts="${conf_opts} $(use_enable xen)" |
| 153 conf_opts="${conf_opts} --disable-xen" |
| 154 conf_opts="${conf_opts} --disable-darwin-user --disable-bsd-user" |
| 155 |
| 156 # audio options |
| 157 audio_opts="oss" |
| 158 use alsa && audio_opts="alsa ${audio_opts}" |
| 159 use esd && audio_opts="esd ${audio_opts}" |
| 160 use pulseaudio && audio_opts="pa ${audio_opts}" |
| 161 use sdl && audio_opts="sdl ${audio_opts}" |
| 162 ./configure --prefix=/usr \ |
| 163 --disable-strip \ |
| 164 --enable-kvm \ |
| 165 --enable-nptl \ |
| 166 --enable-uuid \ |
| 167 ${conf_opts} \ |
| 168 --audio-drv-list="${audio_opts}" \ |
| 169 --target-list="${softmmu_targets} ${user_targets}" \ |
| 170 --cc=$(tc-getCC) \ |
| 171 --host-cc=$(tc-getBUILD_CC) \ |
| 172 || die "configure failed" |
| 173 |
| 174 # this is for qemu upstream's threaded support which is |
| 175 # in development and broken |
| 176 # the kvm project has its own support for threaded IO |
| 177 # which is always on and works |
| 178 # --enable-io-thread \ |
| 179 } |
| 180 |
| 181 src_install() { |
| 182 emake DESTDIR="${D}" install || die "make install failed" |
| 183 |
| 184 insinto /etc/udev/rules.d/ |
| 185 doins kvm/scripts/65-kvm.rules || die |
| 186 |
| 187 if use qemu-ifup; then |
| 188 insinto /etc/qemu/ |
| 189 insopts -m0755 |
| 190 doins kvm/scripts/qemu-ifup || die |
| 191 fi |
| 192 |
| 193 dodoc Changelog MAINTAINERS TODO pci-ids.txt || die |
| 194 newdoc pc-bios/README README.pc-bios || die |
| 195 dohtml qemu-doc.html qemu-tech.html || die |
| 196 |
| 197 dobin "${FILESDIR}"/qemu-kvm |
| 198 dosym /usr/bin/qemu-kvm /usr/bin/kvm |
| 199 } |
| 200 |
| 201 pkg_postinst() { |
| 202 elog "If you don't have kvm compiled into the kernel, make sure you have
" |
| 203 elog "the kernel module loaded before running kvm. The easiest way to" |
| 204 elog "ensure that the kernel module is loaded is to load it on boot." |
| 205 elog "For AMD CPUs the module is called 'kvm-amd'" |
| 206 elog "For Intel CPUs the module is called 'kvm-intel'" |
| 207 elog "Please review /etc/conf.d/modules for how to load these" |
| 208 elog |
| 209 elog "Make sure your user is in the 'kvm' group" |
| 210 elog "Just run 'gpasswd -a <USER> kvm', then have <USER> re-login." |
| 211 elog |
| 212 elog "You will need the Universal TUN/TAP driver compiled into your" |
| 213 elog "kernel or loaded as a module to use the virtual network device" |
| 214 elog "if using -net tap. You will also need support for 802.1d" |
| 215 elog "Ethernet Bridging and a configured bridge if using the provided" |
| 216 elog "kvm-ifup script from /etc/kvm." |
| 217 echo |
| 218 } |
OLD | NEW |