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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (show annotations) (download)
Tue Oct 9 20:28:30 2012 UTC (23 months, 1 week ago) by cardoe
Branch: MAIN
CVS Tags: HEAD
Changes since 1.7: +1 -1 lines
FILE REMOVED
Moved app-emulation/qemu-kvm to app-emulation/qemu.

1 # Copyright 1999-2012 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-1.0.1-r1.ebuild,v 1.7 2012/08/13 00:59:46 cardoe Exp $
4
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 inherit git-2
12 fi
13
14 inherit eutils flag-o-matic linux-info toolchain-funcs multilib python user
15
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 KEYWORDS="amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
25 fi
26
27 DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
28 HOMEPAGE="http://www.linux-kvm.org"
29
30 LICENSE="GPL-2 LGPL-2 BSD-2"
31 SLOT="0"
32 # xen is disabled until the deps are fixed
33 IUSE="+aio alsa bluetooth brltty +curl debug fdt kernel_linux \
34 kernel_FreeBSD ncurses opengl pulseaudio qemu-ifup rbd sasl sdl \
35 smartcard spice static test +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 virtual/jpeg
65 amd64? ( sys-firmware/seabios
66 sys-firmware/vgabios )
67 x86? ( sys-firmware/seabios
68 sys-firmware/vgabios )
69 aio? ( dev-libs/libaio )
70 alsa? ( >=media-libs/alsa-lib-1.0.13 )
71 bluetooth? ( net-wireless/bluez )
72 brltty? ( app-accessibility/brltty )
73 curl? ( >=net-misc/curl-7.15.4 )
74 fdt? ( >=sys-apps/dtc-1.2.0 )
75 kernel_linux? ( >=sys-apps/util-linux-2.16.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 virtual/pkgconfig
99 kernel_linux? ( >=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 use kernel_linux && 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 elif use kernel_linux; then
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 enewgroup kvm 78
175 }
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 # Fix compilation of the qemu-system-ppc component
194 epatch "${FILESDIR}"/${PN}-1.0-fix-qemu-system-ppc.patch
195
196 # 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 # Quick fix for the bad version number
202 epatch "${FILESDIR}"/${P}-VERSION.patch
203
204 # Patch the use of sys/sysctl.h on FreeBSD
205 epatch "${FILESDIR}"/${P}-freebsd-sysctl-header.patch
206
207 [[ -n ${BACKPORTS} ]] && \
208 EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
209 epatch
210
211 epatch_user
212 }
213
214 src_configure() {
215 local conf_opts audio_opts user_targets
216
217 for target in ${IUSE_SOFTMMU_TARGETS} ; do
218 use "qemu_softmmu_targets_${target}" && \
219 softmmu_targets="${softmmu_targets} ${target}-softmmu"
220 done
221
222 for target in ${IUSE_USER_TARGETS} ; do
223 use "qemu_user_targets_${target}" && \
224 user_targets="${user_targets} ${target}-linux-user"
225 done
226
227 if [[ -z ${softmmu_targets} ]]; then
228 eerror "All SoftMMU targets are disabled. This is invalid for qemu-kvm"
229 die "At least 1 SoftMMU target must be enabled"
230 else
231 einfo "Building the following softmmu targets: ${softmmu_targets}"
232 fi
233
234 if [[ -n ${user_targets} ]]; then
235 einfo "Building the following user targets: ${user_targets}"
236 conf_opts="${conf_opts} --enable-linux-user"
237 else
238 conf_opts="${conf_opts} --disable-linux-user"
239 fi
240
241 # Fix QA issues. QEMU needs executable heaps and we need to mark it as such
242 conf_opts="${conf_opts} --extra-ldflags=-Wl,-z,execheap"
243
244 # Add support for static builds
245 use static && conf_opts="${conf_opts} --static"
246
247 # Support debug USE flag
248 use debug && conf_opts="${conf_opts} --enable-debug"
249
250 # audio options
251 audio_opts="oss"
252 use alsa && audio_opts="alsa ${audio_opts}"
253 use pulseaudio && audio_opts="pa ${audio_opts}"
254 use sdl && audio_opts="sdl ${audio_opts}"
255
256 # conditionally making UUID work on Linux only is wrong
257 # but the Gentoo/FreeBSD guys need to figure out what
258 # provides libuuid on their platform
259 ./configure --prefix=/usr \
260 --sysconfdir=/etc \
261 --disable-darwin-user \
262 --disable-bsd-user \
263 --disable-libiscsi \
264 --disable-strip \
265 --disable-werror \
266 --enable-pie \
267 --enable-tcg-interpreter \
268 --enable-vnc-jpeg \
269 --enable-vnc-png \
270 --python=python2 \
271 $(use_enable aio linux-aio) \
272 $(use_enable bluetooth bluez) \
273 $(use_enable brltty brlapi) \
274 $(use_enable curl) \
275 $(use_enable fdt) \
276 $(use_enable kernel_linux kvm) \
277 $(use_enable kernel_linux kvm-device-assignment) \
278 $(use_enable kernel_linux kvm-pit) \
279 $(use_enable kernel_linux nptl) \
280 $(use_enable kernel_linux uuid) \
281 $(use_enable ncurses curses) \
282 $(use_enable opengl) \
283 $(use_enable rbd) \
284 $(use_enable sasl vnc-sasl) \
285 $(use_enable sdl) \
286 $(use_enable smartcard smartcard) \
287 $(use_enable smartcard smartcard-nss) \
288 $(use_enable spice) \
289 $(use_enable test check-utests) \
290 $(use_enable tls vnc-tls) \
291 $(use_enable threads vnc-thread) \
292 $(use_enable usbredir usb-redir) \
293 $(use_enable vde) \
294 $(use_enable vhost-net) \
295 $(use_enable xen) \
296 $(use_enable xattr attr) \
297 --audio-drv-list="${audio_opts}" \
298 --target-list="${softmmu_targets} ${user_targets}" \
299 --cc="$(tc-getCC)" \
300 --host-cc="$(tc-getBUILD_CC)" \
301 || die "configure failed"
302
303 # this is for qemu upstream's threaded support which is
304 # in development and broken
305 # the kvm project has its own support for threaded IO
306 # which is always on and works
307 # --enable-io-thread \
308
309 # FreeBSD's kernel does not support QEMU assigning/grabbing
310 # host USB devices yet
311 use kernel_FreeBSD && \
312 sed -E -e "s|^(HOST_USB=)bsd|\1stub|" -i "${S}"/config-host.mak
313 }
314
315 src_install() {
316 emake DESTDIR="${ED}" install || die "make install failed"
317
318 if [[ -n ${softmmu_targets} ]]; then
319 insinto /lib/udev/rules.d/
320 doins kvm/scripts/65-kvm.rules || die
321
322 if use qemu-ifup; then
323 insinto /etc/qemu/
324 insopts -m0755
325 doins kvm/scripts/qemu-ifup || die
326 fi
327
328 if use qemu_softmmu_targets_x86_64 ; then
329 dobin "${FILESDIR}"/qemu-kvm
330 ewarn "The depreciated '/usr/bin/kvm' symlink is no longer installed"
331 ewarn "You should use '/usr/bin/qemu-kvm', you may need to edit"
332 ewarn "your libvirt configs or other wrappers for ${PN}"
333 else
334 elog "You disabled QEMU_SOFTMMU_TARGETS=x86_64, this disables install"
335 elog "of /usr/bin/qemu-kvm and /usr/bin/kvm"
336 fi
337 fi
338
339 dodoc Changelog MAINTAINERS TODO pci-ids.txt || die
340 newdoc pc-bios/README README.pc-bios || die
341 dohtml qemu-doc.html qemu-tech.html || die
342
343 # FIXME: Need to come up with a solution for non-x86 based systems
344 if use x86 || use amd64; then
345 # Remove SeaBIOS since we're using the SeaBIOS packaged one
346 rm "${ED}/usr/share/qemu/bios.bin"
347 dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
348
349 # Remove vgabios since we're using the vgabios packaged one
350 rm "${ED}/usr/share/qemu/vgabios.bin"
351 rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
352 rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
353 rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
354 rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
355 dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
356 dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
357 dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
358 dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
359 dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
360 fi
361 }
362
363 pkg_postinst() {
364
365 if [[ -n ${softmmu_targets} ]]; then
366 elog "If you don't have kvm compiled into the kernel, make sure you have"
367 elog "the kernel module loaded before running kvm. The easiest way to"
368 elog "ensure that the kernel module is loaded is to load it on boot."
369 elog "For AMD CPUs the module is called 'kvm-amd'"
370 elog "For Intel CPUs the module is called 'kvm-intel'"
371 elog "Please review /etc/conf.d/modules for how to load these"
372 elog
373 elog "Make sure your user is in the 'kvm' group"
374 elog "Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
375 elog
376 elog "The ssl USE flag was renamed to tls, so adjust your USE flags."
377 elog "The nss USE flag was renamed to smartcard, so adjust your USE flags."
378 fi
379
380 use qemu-ifup && \
381 ewarn "qemu-ifup is deprecated, be prepared for it to disappear next release"
382 }

  ViewVC Help
Powered by ViewVC 1.1.20