/[gentoo-x86]/app-emulation/qemu-kvm/qemu-kvm-1.0.1.ebuild
Gentoo

Contents of /app-emulation/qemu-kvm/qemu-kvm-1.0.1.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (hide annotations) (download)
Sat Jul 28 22:20:23 2012 UTC (9 months, 3 weeks ago) by cardoe
Branch: MAIN
Changes since 1.6: +5 -5 lines
sys-apps/seabios -> sys-firmware/seabios, sys-apps/vgabios -> sys-firmware/vgabios, sys-apps/sgabios -> sys-firmware/sgabios

(Portage version: 2.1.10.65/cvs/Linux x86_64)

1 cardoe 1.1 # Copyright 1999-2012 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3 cardoe 1.7 # $Header: /var/cvsroot/gentoo-x86/app-emulation/qemu-kvm/qemu-kvm-1.0.1.ebuild,v 1.6 2012/05/31 23:35:44 zmedico Exp $
4 cardoe 1.1
5     #BACKPORTS=1
6    
7     EAPI="4"
8    
9     if [[ ${PV} = *9999* ]]; then
10     EGIT_REPO_URI="git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git"
11 zmedico 1.6 inherit git-2
12 cardoe 1.1 fi
13    
14 zmedico 1.6 inherit eutils flag-o-matic linux-info toolchain-funcs multilib python user
15 cardoe 1.1
16     if [[ ${PV} = *9999* ]]; then
17     SRC_URI=""
18     KEYWORDS=""
19     else
20     SRC_URI="mirror://sourceforge/kvm/${PN}/${P}.tar.gz
21     ${BACKPORTS:+
22     http://dev.gentoo.org/~flameeyes/${PN}/${P}-backports-${BACKPORTS}.tar.bz2
23     http://dev.gentoo.org/~cardoe/distfiles/${P}-backports-${BACKPORTS}.tar.bz2}"
24 phajdan.jr 1.5 KEYWORDS="amd64 ~ppc ~ppc64 x86"
25 cardoe 1.1 fi
26    
27     DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
28     HOMEPAGE="http://www.linux-kvm.org"
29    
30     LICENSE="GPL-2"
31     SLOT="0"
32     # xen is disabled until the deps are fixed
33     IUSE="+aio alsa bluetooth brltty +curl debug fdt ncurses \
34     opengl pulseaudio qemu-ifup rbd sasl sdl smartcard spice static test
35     +threads tls usbredir vde +vhost-net xattr xen"
36    
37     COMMON_TARGETS="i386 x86_64 arm cris m68k microblaze mips mipsel ppc ppc64 sh4 sh4eb sparc sparc64"
38     IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} mips64 mips64el ppcemb"
39     IUSE_USER_TARGETS="${COMMON_TARGETS} alpha armeb ppc64abi32 sparc32plus"
40    
41     # Setup the default SoftMMU targets, while using the loops
42     # below to setup the other targets. x86_64 should be the only
43     # defaults on for qemu-kvm
44     IUSE="${IUSE} +qemu_softmmu_targets_x86_64"
45    
46     for target in ${IUSE_SOFTMMU_TARGETS}; do
47     if [ "x${target}" = "xx86_64" ]; then
48     continue
49     fi
50     IUSE="${IUSE} qemu_softmmu_targets_${target}"
51     done
52    
53     for target in ${IUSE_USER_TARGETS}; do
54     IUSE="${IUSE} qemu_user_targets_${target}"
55     done
56    
57     RDEPEND="
58     !app-emulation/kqemu
59     !app-emulation/qemu
60     !app-emulation/qemu-user
61     >=dev-libs/glib-2.0
62     media-libs/libpng
63     sys-apps/pciutils
64     >=sys-apps/util-linux-2.16.0
65     virtual/jpeg
66 cardoe 1.7 amd64? ( sys-firmware/seabios
67     sys-firmware/vgabios )
68     x86? ( sys-firmware/seabios
69     sys-firmware/vgabios )
70 cardoe 1.1 aio? ( dev-libs/libaio )
71     alsa? ( >=media-libs/alsa-lib-1.0.13 )
72     bluetooth? ( net-wireless/bluez )
73     brltty? ( app-accessibility/brltty )
74     curl? ( >=net-misc/curl-7.15.4 )
75     fdt? ( >=sys-apps/dtc-1.2.0 )
76     ncurses? ( sys-libs/ncurses )
77     opengl? ( virtual/opengl )
78     pulseaudio? ( media-sound/pulseaudio )
79     qemu-ifup? ( sys-apps/iproute2 net-misc/bridge-utils )
80     rbd? ( sys-cluster/ceph )
81     sasl? ( dev-libs/cyrus-sasl )
82     sdl? ( static? ( >=media-libs/libsdl-1.2.11[static-libs,X] )
83     !static? ( >=media-libs/libsdl-1.2.11[X] ) )
84     static? ( sys-libs/zlib[static-libs(+)] )
85     !static? ( sys-libs/zlib )
86     smartcard? ( dev-libs/nss )
87     spice? ( >=app-emulation/spice-0.9.0
88     >=app-emulation/spice-protocol-0.8.1 )
89     tls? ( net-libs/gnutls )
90     usbredir? ( sys-apps/usbredir )
91     vde? ( net-misc/vde )
92     xattr? ( sys-apps/attr )
93     xen? ( app-emulation/xen-tools )
94     "
95    
96     DEPEND="${RDEPEND}
97     app-text/texi2html
98 jdhore 1.3 virtual/pkgconfig
99 cardoe 1.1 >=sys-kernel/linux-headers-2.6.35
100     test? ( dev-libs/check )"
101    
102     STRIP_MASK="/usr/share/qemu/palcode-clipper"
103    
104     QA_PRESTRIPPED="
105     usr/share/qemu/openbios-ppc
106     usr/share/qemu/openbios-sparc64
107     usr/share/qemu/openbios-sparc32
108     usr/share/qemu/palcode-clipper"
109    
110     QA_WX_LOAD="${QA_PRESTRIPPED}
111     usr/bin/qemu-i386
112     usr/bin/qemu-x86_64
113     usr/bin/qemu-alpha
114     usr/bin/qemu-arm
115     usr/bin/qemu-cris
116     usr/bin/qemu-m68k
117     usr/bin/qemu-microblaze
118     usr/bin/qemu-mips
119     usr/bin/qemu-mipsel
120     usr/bin/qemu-ppc
121     usr/bin/qemu-ppc64
122     usr/bin/qemu-ppc64abi32
123     usr/bin/qemu-sh4
124     usr/bin/qemu-sh4eb
125     usr/bin/qemu-sparc
126     usr/bin/qemu-sparc64
127     usr/bin/qemu-armeb
128     usr/bin/qemu-sparc32plus"
129    
130     pkg_pretend() {
131     if ! use qemu_softmmu_targets_x86_64 && use amd64 ; then
132     eerror "You disabled default target QEMU_SOFTMMU_TARGETS=x86_64"
133     fi
134    
135     if ! use qemu_softmmu_targets_x86_64 && use x86 ; then
136     eerror "You disabled default target QEMU_SOFTMMU_TARGETS=x86_64"
137     fi
138    
139     if kernel_is lt 2 6 25; then
140     eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
141     eerror "Either upgrade your kernel"
142     else
143     if ! linux_config_exists; then
144     eerror "Unable to check your kernel for KVM support"
145     else
146     CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
147     ERROR_KVM="You must enable KVM in your kernel to continue"
148     ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
149     ERROR_KVM_AMD+=" your kernel configuration."
150     ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
151     ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
152     ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
153     ERROR_TUN+=" into your kernel or loaded as a module to use the"
154     ERROR_TUN+=" virtual network device if using -net tap."
155     ERROR_BRIDGE="You will also need support for 802.1d"
156     ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
157     use vhost-net && CHECK_CHECK+=" ~VHOST_NET"
158     ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
159     ERROR_VHOST_NET+=" support"
160    
161     if use amd64 || use x86 || use amd64-linux || use x86-linux; then
162     CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
163     fi
164    
165     # Now do the actual checks setup above
166     check_extra_config
167     fi
168     fi
169     }
170    
171     pkg_setup() {
172     python_set_active_version 2
173    
174 cardoe 1.2 enewgroup kvm 78
175 cardoe 1.1 }
176    
177     src_prepare() {
178     # prevent docs to get automatically installed
179     sed -i '/$(DESTDIR)$(docdir)/d' Makefile || die
180     # Alter target makefiles to accept CFLAGS set via flag-o
181     sed -i 's/^\(C\|OP_C\|HELPER_C\)FLAGS=/\1FLAGS+=/' \
182     Makefile Makefile.target || die
183     # append CFLAGS while linking
184     sed -i 's/$(LDFLAGS)/$(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS)/' rules.mak || die
185    
186     # remove part to make udev happy
187     sed -e 's~NAME="%k", ~~' -i kvm/scripts/65-kvm.rules || die
188    
189     # ${PN}-guest-hang-on-usb-add.patch was sent by Timothy Jones
190     # to the qemu-devel ml - bug 337988
191     epatch "${FILESDIR}/qemu-0.11.0-mips64-user-fix.patch"
192    
193 cardoe 1.2 # Fix compilation of the qemu-system-ppc component
194     epatch "${FILESDIR}"/${PN}-1.0-fix-qemu-system-ppc.patch
195    
196 cardoe 1.1 # drop '-g' by default as it tends to eat
197     # A LOT (~2GB) of ram for each job #355861
198     sed -e 's/CFLAGS="-g $CFLAGS"/CFLAGS="$CFLAGS"/g' \
199     -i configure || die
200    
201     [[ -n ${BACKPORTS} ]] && \
202     EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
203     epatch
204 cardoe 1.2
205     epatch_user
206 cardoe 1.1 }
207    
208     src_configure() {
209     local conf_opts audio_opts user_targets
210    
211     for target in ${IUSE_SOFTMMU_TARGETS} ; do
212     use "qemu_softmmu_targets_${target}" && \
213     softmmu_targets="${softmmu_targets} ${target}-softmmu"
214     done
215    
216     for target in ${IUSE_USER_TARGETS} ; do
217     use "qemu_user_targets_${target}" && \
218     user_targets="${user_targets} ${target}-linux-user"
219     done
220    
221     if [[ -z ${softmmu_targets} ]]; then
222     eerror "All SoftMMU targets are disabled. This is invalid for qemu-kvm"
223     die "At least 1 SoftMMU target must be enabled"
224     else
225     einfo "Building the following softmmu targets: ${softmmu_targets}"
226     fi
227    
228     if [[ -n ${user_targets} ]]; then
229     einfo "Building the following user targets: ${user_targets}"
230     conf_opts="${conf_opts} --enable-linux-user"
231     else
232     conf_opts="${conf_opts} --disable-linux-user"
233     fi
234    
235     # Fix QA issues. QEMU needs executable heaps and we need to mark it as such
236     conf_opts="${conf_opts} --extra-ldflags=-Wl,-z,execheap"
237    
238     # Add support for static builds
239     use static && conf_opts="${conf_opts} --static"
240    
241     # Support debug USE flag
242     use debug && conf_opts="${conf_opts} --enable-debug"
243    
244     # audio options
245     audio_opts="oss"
246     use alsa && audio_opts="alsa ${audio_opts}"
247     use pulseaudio && audio_opts="pa ${audio_opts}"
248     use sdl && audio_opts="sdl ${audio_opts}"
249    
250     ./configure --prefix=/usr \
251     --sysconfdir=/etc \
252     --disable-darwin-user \
253     --disable-bsd-user \
254     --disable-libiscsi \
255     --disable-strip \
256     --disable-werror \
257     --enable-kvm \
258     --enable-kvm-device-assignment \
259     --enable-kvm-pit \
260     --enable-pie \
261     --enable-nptl \
262     --enable-tcg-interpreter \
263     --enable-uuid \
264     --enable-vnc-jpeg \
265     --enable-vnc-png \
266     --python=python2 \
267     $(use_enable aio linux-aio) \
268     $(use_enable bluetooth bluez) \
269     $(use_enable brltty brlapi) \
270     $(use_enable curl) \
271     $(use_enable fdt) \
272     $(use_enable ncurses curses) \
273     $(use_enable opengl) \
274     $(use_enable rbd) \
275     $(use_enable sasl vnc-sasl) \
276     $(use_enable sdl) \
277     $(use_enable smartcard smartcard) \
278     $(use_enable smartcard smartcard-nss) \
279     $(use_enable spice) \
280     $(use_enable test check-utests) \
281     $(use_enable tls vnc-tls) \
282     $(use_enable threads vnc-thread) \
283     $(use_enable usbredir usb-redir) \
284     $(use_enable vde) \
285     $(use_enable vhost-net) \
286     $(use_enable xen) \
287     $(use_enable xattr attr) \
288     --audio-drv-list="${audio_opts}" \
289     --target-list="${softmmu_targets} ${user_targets}" \
290     --cc="$(tc-getCC)" \
291     --host-cc="$(tc-getBUILD_CC)" \
292     || die "configure failed"
293    
294     # this is for qemu upstream's threaded support which is
295     # in development and broken
296     # the kvm project has its own support for threaded IO
297     # which is always on and works
298     # --enable-io-thread \
299     }
300    
301     src_install() {
302     emake DESTDIR="${ED}" install || die "make install failed"
303    
304     if [[ -n ${softmmu_targets} ]]; then
305     insinto /lib/udev/rules.d/
306     doins kvm/scripts/65-kvm.rules || die
307    
308     if use qemu-ifup; then
309     insinto /etc/qemu/
310     insopts -m0755
311     doins kvm/scripts/qemu-ifup || die
312     fi
313    
314     if use qemu_softmmu_targets_x86_64 ; then
315     dobin "${FILESDIR}"/qemu-kvm
316     ewarn "The depreciated '/usr/bin/kvm' symlink is no longer installed"
317     ewarn "You should use '/usr/bin/qemu-kvm', you may need to edit"
318     ewarn "your libvirt configs or other wrappers for ${PN}"
319     else
320     elog "You disabled QEMU_SOFTMMU_TARGETS=x86_64, this disables install"
321     elog "of /usr/bin/qemu-kvm and /usr/bin/kvm"
322     fi
323     fi
324    
325     dodoc Changelog MAINTAINERS TODO pci-ids.txt || die
326     newdoc pc-bios/README README.pc-bios || die
327     dohtml qemu-doc.html qemu-tech.html || die
328    
329     # FIXME: Need to come up with a solution for non-x86 based systems
330     if use x86 || use amd64; then
331     # Remove SeaBIOS since we're using the SeaBIOS packaged one
332     rm "${ED}/usr/share/qemu/bios.bin"
333     dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
334    
335     # Remove vgabios since we're using the vgabios packaged one
336     rm "${ED}/usr/share/qemu/vgabios.bin"
337     rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
338     rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
339     rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
340     rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
341     dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
342     dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
343     dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
344     dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
345     dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
346     fi
347     }
348    
349     pkg_postinst() {
350    
351     if [[ -n ${softmmu_targets} ]]; then
352     elog "If you don't have kvm compiled into the kernel, make sure you have"
353     elog "the kernel module loaded before running kvm. The easiest way to"
354     elog "ensure that the kernel module is loaded is to load it on boot."
355     elog "For AMD CPUs the module is called 'kvm-amd'"
356     elog "For Intel CPUs the module is called 'kvm-intel'"
357     elog "Please review /etc/conf.d/modules for how to load these"
358     elog
359     elog "Make sure your user is in the 'kvm' group"
360     elog "Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
361     elog
362     elog "The ssl USE flag was renamed to tls, so adjust your USE flags."
363     elog "The nss USE flag was renamed to smartcard, so adjust your USE flags."
364     fi
365    
366     use qemu-ifup && \
367     ewarn "qemu-ifup is deprecated, be prepared for it to disappear next release"
368     }

  ViewVC Help
Powered by ViewVC 1.1.13