Gentoo Archives: gentoo-commits

From: Matthias Maier <tamiko@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/
Date: Mon, 05 Sep 2016 05:30:19
Message-Id: 1473053400.01e6cb9bcad3046a7223e31c4b533485d6ca0877.tamiko@gentoo
1 commit: 01e6cb9bcad3046a7223e31c4b533485d6ca0877
2 Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
3 AuthorDate: Mon Sep 5 03:58:05 2016 +0000
4 Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
5 CommitDate: Mon Sep 5 05:30:00 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=01e6cb9b
7
8 app-emulation/qemu: remove vulnerable 2.5.0
9
10 Package-Manager: portage-2.2.28
11
12 app-emulation/qemu/Manifest | 1 -
13 app-emulation/qemu/qemu-2.5.0-r2.ebuild | 694 -------------------------------
14 app-emulation/qemu/qemu-2.5.0-r3.ebuild | 699 --------------------------------
15 3 files changed, 1394 deletions(-)
16
17 diff --git a/app-emulation/qemu/Manifest b/app-emulation/qemu/Manifest
18 index 70db408..5ae41f8 100644
19 --- a/app-emulation/qemu/Manifest
20 +++ b/app-emulation/qemu/Manifest
21 @@ -1,3 +1,2 @@
22 -DIST qemu-2.5.0.tar.bz2 25464996 SHA256 3443887401619fe33bfa5d900a4f2d6a79425ae2b7e43d5b8c36eb7a683772d4 SHA512 12153f94cc7f834fd6a85f25690c36f2331d88d414426fb8b9ac20a34e6f9222b1eda30b727674af583580fae90dfd6d0614a905dce1567d94cd049d426b9dd3 WHIRLPOOL 8f5717989d8d234ecf1763ee386b2e1f20c3b17918de130c6dae255e4523a230b2b01a759eba25e4b9f604c680d9b868c56f58bd71b7c6c2c22a2e46804435ef
23 DIST qemu-2.5.1.tar.bz2 25464539 SHA256 028752c33bb786abbfe496ba57315dc5a7d0a33b5a7a767f6d7a29020c525d2c SHA512 66959ad6a2a89f23c5daba245c76f71ddc03a33a1167bca639a042ebbf7329b2e698cd2c0e65c22a9874563a34256a48386aa9df6475b06d38db74187e3e3b3f WHIRLPOOL 32525271574692d56b7794dc63606659f46e6ae19a56dee31b3cec33dab9c4eb74147a65db4940229492d8680f38c2d05bc2a8fbcb4b6887b0c1cbe5fbbe44cf
24 DIST qemu-2.6.0.tar.bz2 25755267 SHA256 c9ac4a651b273233d21b8bec32e30507cb9cce7900841febc330956a1a8434ec SHA512 0d17075e52f7688cc05776ad7a76509d1f22ae8eda896fddb06c1fd6dea6da485422c8efb3ba118b054d9a413b7b02baba656a9131658dabdb71def50c92b215 WHIRLPOOL f9373bf66f67301787e7510ac161b0072ba7c7bc067e10215fb97a52524adaba0fcbc79a4c0cefac9c6e2b4e07380eb9d10f65ed6ce6867e43843043684231ed
25
26 diff --git a/app-emulation/qemu/qemu-2.5.0-r2.ebuild b/app-emulation/qemu/qemu-2.5.0-r2.ebuild
27 deleted file mode 100644
28 index 222d558..00000000
29 --- a/app-emulation/qemu/qemu-2.5.0-r2.ebuild
30 +++ /dev/null
31 @@ -1,694 +0,0 @@
32 -# Copyright 1999-2016 Gentoo Foundation
33 -# Distributed under the terms of the GNU General Public License v2
34 -# $Id$
35 -
36 -EAPI=5
37 -
38 -PYTHON_COMPAT=( python2_7 )
39 -PYTHON_REQ_USE="ncurses,readline"
40 -
41 -PLOCALES="de_DE fr_FR hu it tr zh_CN"
42 -
43 -inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
44 - user udev fcaps readme.gentoo pax-utils l10n
45 -
46 -BACKPORTS=
47 -
48 -if [[ ${PV} = *9999* ]]; then
49 - EGIT_REPO_URI="git://git.qemu.org/qemu.git"
50 - inherit git-2
51 - SRC_URI=""
52 -else
53 - SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
54 - ${BACKPORTS:+
55 - https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
56 - KEYWORDS="amd64 ~arm64 ~ppc ~ppc64 x86 ~x86-fbsd"
57 -fi
58 -
59 -DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
60 -HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
61 -
62 -LICENSE="GPL-2 LGPL-2 BSD-2"
63 -SLOT="0"
64 -IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
65 -gnutls gtk gtk2 infiniband iscsi +jpeg \
66 -kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
67 -+png pulseaudio python \
68 -rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
69 -static-user systemtap tci test +threads usb usbredir +uuid vde +vhost-net \
70 -virgl virtfs +vnc vte xattr xen xfs"
71 -
72 -COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
73 -mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
74 -x86_64"
75 -IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
76 -IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus tilegx"
77 -
78 -use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
79 -use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
80 -IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
81 -
82 -# Allow no targets to be built so that people can get a tools-only build.
83 -# Block USE flag configurations known to not work.
84 -REQUIRED_USE="${PYTHON_REQUIRED_USE}
85 - gtk2? ( gtk )
86 - qemu_softmmu_targets_arm? ( fdt )
87 - qemu_softmmu_targets_microblaze? ( fdt )
88 - qemu_softmmu_targets_ppc? ( fdt )
89 - qemu_softmmu_targets_ppc64? ( fdt )
90 - sdl2? ( sdl )
91 - static? ( static-softmmu static-user )
92 - static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
93 - virtfs? ( xattr )
94 - vte? ( gtk )"
95 -
96 -# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
97 -#
98 -# The attr lib isn't always linked in (although the USE flag is always
99 -# respected). This is because qemu supports using the C library's API
100 -# when available rather than always using the extranl library.
101 -#
102 -# Older versions of gnutls are supported, but it's simpler to just require
103 -# the latest versions. This is also why we require nettle.
104 -COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
105 - sys-libs/zlib[static-libs(+)]
106 - xattr? ( sys-apps/attr[static-libs(+)] )"
107 -SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
108 - >=x11-libs/pixman-0.28.0[static-libs(+)]
109 - accessibility? ( app-accessibility/brltty[static-libs(+)] )
110 - aio? ( dev-libs/libaio[static-libs(+)] )
111 - alsa? ( >=media-libs/alsa-lib-1.0.13 )
112 - bluetooth? ( net-wireless/bluez )
113 - caps? ( sys-libs/libcap-ng[static-libs(+)] )
114 - curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
115 - fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
116 - glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
117 - gnutls? (
118 - dev-libs/nettle[static-libs(+)]
119 - >=net-libs/gnutls-3.0[static-libs(+)]
120 - )
121 - gtk? (
122 - gtk2? (
123 - x11-libs/gtk+:2
124 - vte? ( x11-libs/vte:0 )
125 - )
126 - !gtk2? (
127 - x11-libs/gtk+:3
128 - vte? ( x11-libs/vte:2.90 )
129 - )
130 - )
131 - infiniband? ( sys-fabric/librdmacm:=[static-libs(+)] )
132 - iscsi? ( net-libs/libiscsi )
133 - jpeg? ( virtual/jpeg:0=[static-libs(+)] )
134 - lzo? ( dev-libs/lzo:2[static-libs(+)] )
135 - ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
136 - nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
137 - numa? ( sys-process/numactl[static-libs(+)] )
138 - opengl? (
139 - virtual/opengl
140 - media-libs/libepoxy[static-libs(+)]
141 - media-libs/mesa[static-libs(+)]
142 - media-libs/mesa[egl,gles2]
143 - )
144 - png? ( media-libs/libpng:0=[static-libs(+)] )
145 - pulseaudio? ( media-sound/pulseaudio )
146 - rbd? ( sys-cluster/ceph[static-libs(+)] )
147 - sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
148 - sdl? (
149 - !sdl2? (
150 - media-libs/libsdl[X]
151 - >=media-libs/libsdl-1.2.11[static-libs(+)]
152 - )
153 - sdl2? (
154 - media-libs/libsdl2[X]
155 - media-libs/libsdl2[static-libs(+)]
156 - )
157 - )
158 - seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
159 - smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
160 - snappy? ( app-arch/snappy[static-libs(+)] )
161 - spice? (
162 - >=app-emulation/spice-protocol-0.12.3
163 - >=app-emulation/spice-0.12.0[static-libs(+)]
164 - )
165 - ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
166 - usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
167 - usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
168 - uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
169 - vde? ( net-misc/vde[static-libs(+)] )
170 - virgl? ( media-libs/virglrenderer[static-libs(+)] )
171 - virtfs? ( sys-libs/libcap )
172 - xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
173 -USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
174 -X86_FIRMWARE_DEPEND="
175 - >=sys-firmware/ipxe-1.0.0_p20130624
176 - pin-upstream-blobs? (
177 - ~sys-firmware/seabios-1.8.2
178 - ~sys-firmware/sgabios-0.1_pre8
179 - ~sys-firmware/vgabios-0.7a
180 - )
181 - !pin-upstream-blobs? (
182 - sys-firmware/seabios
183 - sys-firmware/sgabios
184 - sys-firmware/vgabios
185 - )"
186 -CDEPEND="
187 - !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
188 - !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
189 - qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
190 - qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
191 - python? ( ${PYTHON_DEPS} )
192 - systemtap? ( dev-util/systemtap )
193 - xen? ( app-emulation/xen-tools:= )"
194 -DEPEND="${CDEPEND}
195 - dev-lang/perl
196 - =dev-lang/python-2*
197 - sys-apps/texinfo
198 - virtual/pkgconfig
199 - kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
200 - gtk? ( nls? ( sys-devel/gettext ) )
201 - static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
202 - static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
203 - test? (
204 - dev-libs/glib[utils]
205 - sys-devel/bc
206 - )"
207 -RDEPEND="${CDEPEND}
208 - selinux? ( sec-policy/selinux-qemu )
209 -"
210 -
211 -STRIP_MASK="/usr/share/qemu/palcode-clipper"
212 -
213 -QA_PREBUILT="
214 - usr/share/qemu/openbios-ppc
215 - usr/share/qemu/openbios-sparc64
216 - usr/share/qemu/openbios-sparc32
217 - usr/share/qemu/palcode-clipper
218 - usr/share/qemu/s390-ccw.img
219 - usr/share/qemu/u-boot.e500
220 -"
221 -
222 -QA_WX_LOAD="usr/bin/qemu-i386
223 - usr/bin/qemu-x86_64
224 - usr/bin/qemu-alpha
225 - usr/bin/qemu-arm
226 - usr/bin/qemu-cris
227 - usr/bin/qemu-m68k
228 - usr/bin/qemu-microblaze
229 - usr/bin/qemu-microblazeel
230 - usr/bin/qemu-mips
231 - usr/bin/qemu-mipsel
232 - usr/bin/qemu-or32
233 - usr/bin/qemu-ppc
234 - usr/bin/qemu-ppc64
235 - usr/bin/qemu-ppc64abi32
236 - usr/bin/qemu-sh4
237 - usr/bin/qemu-sh4eb
238 - usr/bin/qemu-sparc
239 - usr/bin/qemu-sparc64
240 - usr/bin/qemu-armeb
241 - usr/bin/qemu-sparc32plus
242 - usr/bin/qemu-s390x
243 - usr/bin/qemu-unicore32"
244 -
245 -DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
246 -you have the kernel module loaded before running kvm. The easiest way to
247 -ensure that the kernel module is loaded is to load it on boot.\n
248 -For AMD CPUs the module is called 'kvm-amd'\n
249 -For Intel CPUs the module is called 'kvm-intel'\n
250 -Please review /etc/conf.d/modules for how to load these\n\n
251 -Make sure your user is in the 'kvm' group\n
252 -Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
253 -
254 -qemu_support_kvm() {
255 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
256 - use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
257 - use qemu_softmmu_targets_s390x; then
258 - return 0
259 - fi
260 -
261 - return 1
262 -}
263 -
264 -pkg_pretend() {
265 - if use kernel_linux && kernel_is lt 2 6 25; then
266 - eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
267 - elif use kernel_linux; then
268 - if ! linux_config_exists; then
269 - eerror "Unable to check your kernel for KVM support"
270 - else
271 - CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
272 - ERROR_KVM="You must enable KVM in your kernel to continue"
273 - ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
274 - ERROR_KVM_AMD+=" your kernel configuration."
275 - ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
276 - ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
277 - ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
278 - ERROR_TUN+=" into your kernel or loaded as a module to use the"
279 - ERROR_TUN+=" virtual network device if using -net tap."
280 - ERROR_BRIDGE="You will also need support for 802.1d"
281 - ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
282 - use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
283 - ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
284 - ERROR_VHOST_NET+=" support"
285 -
286 - if use amd64 || use x86 || use amd64-linux || use x86-linux; then
287 - CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
288 - fi
289 -
290 - use python && CONFIG_CHECK+=" ~DEBUG_FS"
291 - ERROR_DEBUG_FS="debugFS support required for kvm_stat"
292 -
293 - # Now do the actual checks setup above
294 - check_extra_config
295 - fi
296 - fi
297 -
298 - if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
299 - eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
300 - eerror "instances are still pointing to it. Please update your"
301 - eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
302 - eerror "and the right system binary (e.g. qemu-system-x86_64)."
303 - die "update your virt configs to not use qemu-kvm"
304 - fi
305 -}
306 -
307 -pkg_setup() {
308 - enewgroup kvm 78
309 -}
310 -
311 -# Sanity check to make sure target lists are kept up-to-date.
312 -check_targets() {
313 - local var=$1 mak=$2
314 - local detected sorted
315 -
316 - pushd "${S}"/default-configs >/dev/null || die
317 -
318 - # Force C locale until glibc is updated. #564936
319 - detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
320 - sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
321 - if [[ ${sorted} != "${detected}" ]] ; then
322 - eerror "The ebuild needs to be kept in sync."
323 - eerror "${var}: ${sorted}"
324 - eerror "$(printf '%-*s' ${#var} configure): ${detected}"
325 - die "sync ${var} to the list of targets"
326 - fi
327 -
328 - popd >/dev/null
329 -}
330 -
331 -handle_locales() {
332 - # Make sure locale list is kept up-to-date.
333 - local detected sorted
334 - detected=$(echo $(cd po && printf '%s\n' *.po | grep -v messages.po | sed 's:.po$::' | sort -u))
335 - sorted=$(echo $(printf '%s\n' ${PLOCALES} | sort -u))
336 - if [[ ${sorted} != "${detected}" ]] ; then
337 - eerror "The ebuild needs to be kept in sync."
338 - eerror "PLOCALES: ${sorted}"
339 - eerror " po/*.po: ${detected}"
340 - die "sync PLOCALES"
341 - fi
342 -
343 - # Deal with selective install of locales.
344 - if use nls ; then
345 - # Delete locales the user does not want. #577814
346 - rm_loc() { rm po/$1.po || die; }
347 - l10n_for_each_disabled_locale_do rm_loc
348 - else
349 - # Cheap hack to disable gettext .mo generation.
350 - rm -f po/*.po
351 - fi
352 -}
353 -
354 -src_prepare() {
355 - check_targets IUSE_SOFTMMU_TARGETS softmmu
356 - check_targets IUSE_USER_TARGETS linux-user
357 -
358 - # Alter target makefiles to accept CFLAGS set via flag-o
359 - sed -i -r \
360 - -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
361 - Makefile Makefile.target || die
362 -
363 - epatch "${FILESDIR}"/qemu-2.5.0-cflags.patch
364 - [[ -n ${BACKPORTS} ]] && \
365 - EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
366 - epatch
367 -
368 - epatch "${FILESDIR}"/${P}-CVE-2015-8567.patch #567868
369 - epatch "${FILESDIR}"/${P}-CVE-2015-8558.patch #568246
370 - epatch "${FILESDIR}"/${P}-CVE-2015-8701.patch #570110
371 - epatch "${FILESDIR}"/${P}-CVE-2015-8743.patch #570988
372 - epatch "${FILESDIR}"/${P}-CVE-2016-1568.patch #571566
373 - epatch "${FILESDIR}"/${P}-CVE-2015-8613.patch #569118
374 - epatch "${FILESDIR}"/${P}-CVE-2015-8619.patch #569300
375 - epatch "${FILESDIR}"/${P}-CVE-2016-1714.patch #571560
376 - epatch "${FILESDIR}"/${P}-CVE-2016-1922.patch #572082
377 - epatch "${FILESDIR}"/${P}-CVE-2016-1981.patch #572412
378 - epatch "${FILESDIR}"/${P}-usb-ehci-oob.patch #572454
379 - epatch "${FILESDIR}"/${P}-CVE-2016-2197.patch #573280
380 - epatch "${FILESDIR}"/${P}-CVE-2016-2198.patch #573314
381 - epatch "${FILESDIR}"/${P}-CVE-2016-2392.patch #574902
382 - epatch "${FILESDIR}"/${P}-usb-ndis-int-overflow.patch #575492
383 - epatch "${FILESDIR}"/${P}-rng-stack-corrupt-{0,1,2,3}.patch #576420
384 - epatch "${FILESDIR}"/${P}-sysmacros.patch
385 -
386 - # Fix ld and objcopy being called directly
387 - tc-export AR LD OBJCOPY
388 -
389 - # Verbose builds
390 - MAKEOPTS+=" V=1"
391 -
392 - epatch_user
393 -
394 - # Run after we've applied all patches.
395 - handle_locales
396 -}
397 -
398 -##
399 -# configures qemu based on the build directory and the build type
400 -# we are using.
401 -#
402 -qemu_src_configure() {
403 - debug-print-function ${FUNCNAME} "$@"
404 -
405 - local buildtype=$1
406 - local builddir="${S}/${buildtype}-build"
407 - local static_flag="static-${buildtype}"
408 -
409 - mkdir "${builddir}"
410 -
411 - local conf_opts=(
412 - --prefix=/usr
413 - --sysconfdir=/etc
414 - --libdir=/usr/$(get_libdir)
415 - --docdir=/usr/share/doc/${PF}/html
416 - --disable-bsd-user
417 - --disable-guest-agent
418 - --disable-strip
419 - --disable-werror
420 - # We support gnutls/nettle for crypto operations. It is possible
421 - # to use gcrypt when gnutls/nettle are disabled (but not when they
422 - # are enabled), but it's not really worth the hassle. Disable it
423 - # all the time to avoid automatically detecting it. #568856
424 - --disable-gcrypt
425 - --python="${PYTHON}"
426 - --cc="$(tc-getCC)"
427 - --cxx="$(tc-getCXX)"
428 - --host-cc="$(tc-getBUILD_CC)"
429 - $(use_enable debug debug-info)
430 - $(use_enable debug debug-tcg)
431 - --enable-docs
432 - $(use_enable tci tcg-interpreter)
433 - $(use_enable xattr attr)
434 - )
435 -
436 - # Disable options not used by user targets as the default configure
437 - # options will autoprobe and try to link in a bunch of unused junk.
438 - conf_softmmu() {
439 - if [[ ${buildtype} == "user" ]] ; then
440 - echo "--disable-${2:-$1}"
441 - else
442 - use_enable "$@"
443 - fi
444 - }
445 - conf_opts+=(
446 - $(conf_softmmu accessibility brlapi)
447 - $(conf_softmmu aio linux-aio)
448 - $(conf_softmmu bluetooth bluez)
449 - $(conf_softmmu caps cap-ng)
450 - $(conf_softmmu curl)
451 - $(conf_softmmu fdt)
452 - $(conf_softmmu glusterfs)
453 - $(conf_softmmu gnutls)
454 - $(conf_softmmu gnutls nettle)
455 - $(conf_softmmu gtk)
456 - $(conf_softmmu infiniband rdma)
457 - $(conf_softmmu iscsi libiscsi)
458 - $(conf_softmmu jpeg vnc-jpeg)
459 - $(conf_softmmu kernel_linux kvm)
460 - $(conf_softmmu lzo)
461 - $(conf_softmmu ncurses curses)
462 - $(conf_softmmu nfs libnfs)
463 - $(conf_softmmu numa)
464 - $(conf_softmmu opengl)
465 - $(conf_softmmu png vnc-png)
466 - $(conf_softmmu rbd)
467 - $(conf_softmmu sasl vnc-sasl)
468 - $(conf_softmmu sdl)
469 - $(conf_softmmu seccomp)
470 - $(conf_softmmu smartcard)
471 - $(conf_softmmu snappy)
472 - $(conf_softmmu spice)
473 - $(conf_softmmu ssh libssh2)
474 - $(conf_softmmu usb libusb)
475 - $(conf_softmmu usbredir usb-redir)
476 - $(conf_softmmu uuid)
477 - $(conf_softmmu vde)
478 - $(conf_softmmu vhost-net)
479 - $(conf_softmmu virgl virglrenderer)
480 - $(conf_softmmu virtfs)
481 - $(conf_softmmu vnc)
482 - $(conf_softmmu vte)
483 - $(conf_softmmu xen)
484 - $(conf_softmmu xen xen-pci-passthrough)
485 - $(conf_softmmu xfs xfsctl)
486 - )
487 -
488 - case ${buildtype} in
489 - user)
490 - conf_opts+=(
491 - --enable-linux-user
492 - --disable-system
493 - --disable-blobs
494 - --disable-tools
495 - )
496 - ;;
497 - softmmu)
498 - # audio options
499 - local audio_opts="oss"
500 - use alsa && audio_opts="alsa,${audio_opts}"
501 - use sdl && audio_opts="sdl,${audio_opts}"
502 - use pulseaudio && audio_opts="pa,${audio_opts}"
503 -
504 - conf_opts+=(
505 - --disable-linux-user
506 - --enable-system
507 - --with-system-pixman
508 - --audio-drv-list="${audio_opts}"
509 - )
510 - use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
511 - use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
512 - ;;
513 - tools)
514 - conf_opts+=(
515 - --disable-linux-user
516 - --disable-system
517 - --disable-blobs
518 - )
519 - static_flag="static"
520 - ;;
521 - esac
522 -
523 - local targets="${buildtype}_targets"
524 - [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
525 -
526 - # Add support for SystemTAP
527 - use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
528 -
529 - # We always want to attempt to build with PIE support as it results
530 - # in a more secure binary. But it doesn't work with static or if
531 - # the current GCC doesn't have PIE support.
532 - if use ${static_flag}; then
533 - conf_opts+=( --static --disable-pie )
534 - else
535 - gcc-specs-pie && conf_opts+=( --enable-pie )
536 - fi
537 -
538 - echo "../configure ${conf_opts[*]}"
539 - cd "${builddir}"
540 - ../configure "${conf_opts[@]}" || die "configure failed"
541 -
542 - # FreeBSD's kernel does not support QEMU assigning/grabbing
543 - # host USB devices yet
544 - use kernel_FreeBSD && \
545 - sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
546 -}
547 -
548 -src_configure() {
549 - local target
550 -
551 - python_setup
552 -
553 - softmmu_targets= softmmu_bins=()
554 - user_targets= user_bins=()
555 -
556 - for target in ${IUSE_SOFTMMU_TARGETS} ; do
557 - if use "qemu_softmmu_targets_${target}"; then
558 - softmmu_targets+=",${target}-softmmu"
559 - softmmu_bins+=( "qemu-system-${target}" )
560 - fi
561 - done
562 -
563 - for target in ${IUSE_USER_TARGETS} ; do
564 - if use "qemu_user_targets_${target}"; then
565 - user_targets+=",${target}-linux-user"
566 - user_bins+=( "qemu-${target}" )
567 - fi
568 - done
569 -
570 - softmmu_targets=${softmmu_targets#,}
571 - user_targets=${user_targets#,}
572 -
573 - [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
574 - [[ -n ${user_targets} ]] && qemu_src_configure "user"
575 - [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
576 -}
577 -
578 -src_compile() {
579 - if [[ -n ${user_targets} ]]; then
580 - cd "${S}/user-build"
581 - default
582 - fi
583 -
584 - if [[ -n ${softmmu_targets} ]]; then
585 - cd "${S}/softmmu-build"
586 - default
587 - fi
588 -
589 - if [[ -z ${softmmu_targets}${user_targets} ]]; then
590 - cd "${S}/tools-build"
591 - default
592 - fi
593 -}
594 -
595 -src_test() {
596 - if [[ -n ${softmmu_targets} ]]; then
597 - cd "${S}/softmmu-build"
598 - pax-mark m */qemu-system-* #515550
599 - emake -j1 check
600 - emake -j1 check-report.html
601 - fi
602 -}
603 -
604 -qemu_python_install() {
605 - python_domodule "${S}/scripts/qmp/qmp.py"
606 -
607 - python_doscript "${S}/scripts/kvm/kvm_stat"
608 - python_doscript "${S}/scripts/kvm/vmxcap"
609 - python_doscript "${S}/scripts/qmp/qmp-shell"
610 - python_doscript "${S}/scripts/qmp/qemu-ga-client"
611 -}
612 -
613 -src_install() {
614 - if [[ -n ${user_targets} ]]; then
615 - cd "${S}/user-build"
616 - emake DESTDIR="${ED}" install
617 -
618 - # Install binfmt handler init script for user targets
619 - newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
620 - fi
621 -
622 - if [[ -n ${softmmu_targets} ]]; then
623 - cd "${S}/softmmu-build"
624 - emake DESTDIR="${ED}" install
625 -
626 - # This might not exist if the test failed. #512010
627 - [[ -e check-report.html ]] && dohtml check-report.html
628 -
629 - if use kernel_linux; then
630 - udev_dorules "${FILESDIR}"/65-kvm.rules
631 - fi
632 -
633 - if use python; then
634 - python_foreach_impl qemu_python_install
635 - fi
636 - fi
637 -
638 - if [[ -z ${softmmu_targets}${user_targets} ]]; then
639 - cd "${S}/tools-build"
640 - emake DESTDIR="${ED}" install
641 - fi
642 -
643 - # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
644 - pushd "${ED}"/usr/bin >/dev/null
645 - pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
646 - popd >/dev/null
647 -
648 - # Install config file example for qemu-bridge-helper
649 - insinto "/etc/qemu"
650 - doins "${FILESDIR}/bridge.conf"
651 -
652 - # Remove the docdir placed qmp-commands.txt
653 - mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/" || die
654 -
655 - cd "${S}"
656 - dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
657 - newdoc pc-bios/README README.pc-bios
658 - dodoc docs/qmp-*.txt
659 -
660 - if [[ -n ${softmmu_targets} ]]; then
661 - # Remove SeaBIOS since we're using the SeaBIOS packaged one
662 - rm "${ED}/usr/share/qemu/bios.bin"
663 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
664 - dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
665 - fi
666 -
667 - # Remove vgabios since we're using the vgabios packaged one
668 - rm "${ED}/usr/share/qemu/vgabios.bin"
669 - rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
670 - rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
671 - rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
672 - rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
673 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
674 - dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
675 - dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
676 - dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
677 - dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
678 - dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
679 - fi
680 -
681 - # Remove sgabios since we're using the sgabios packaged one
682 - rm "${ED}/usr/share/qemu/sgabios.bin"
683 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
684 - dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
685 - fi
686 -
687 - # Remove iPXE since we're using the iPXE packaged one
688 - rm "${ED}"/usr/share/qemu/pxe-*.rom
689 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
690 - dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
691 - dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
692 - dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
693 - dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
694 - dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
695 - dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
696 - fi
697 - fi
698 -
699 - qemu_support_kvm && readme.gentoo_create_doc
700 -}
701 -
702 -pkg_postinst() {
703 - if qemu_support_kvm; then
704 - readme.gentoo_print_elog
705 - fi
706 -
707 - if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
708 - udev_reload
709 - fi
710 -
711 - fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
712 -}
713 -
714 -pkg_info() {
715 - echo "Using:"
716 - echo " $(best_version app-emulation/spice-protocol)"
717 - echo " $(best_version sys-firmware/ipxe)"
718 - echo " $(best_version sys-firmware/seabios)"
719 - if has_version 'sys-firmware/seabios[binary]'; then
720 - echo " USE=binary"
721 - else
722 - echo " USE=''"
723 - fi
724 - echo " $(best_version sys-firmware/vgabios)"
725 -}
726
727 diff --git a/app-emulation/qemu/qemu-2.5.0-r3.ebuild b/app-emulation/qemu/qemu-2.5.0-r3.ebuild
728 deleted file mode 100644
729 index fc2fb0b..00000000
730 --- a/app-emulation/qemu/qemu-2.5.0-r3.ebuild
731 +++ /dev/null
732 @@ -1,699 +0,0 @@
733 -# Copyright 1999-2016 Gentoo Foundation
734 -# Distributed under the terms of the GNU General Public License v2
735 -# $Id$
736 -
737 -EAPI=5
738 -
739 -PYTHON_COMPAT=( python2_7 )
740 -PYTHON_REQ_USE="ncurses,readline"
741 -
742 -PLOCALES="de_DE fr_FR hu it tr zh_CN"
743 -
744 -inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
745 - user udev fcaps readme.gentoo pax-utils l10n
746 -
747 -BACKPORTS=
748 -
749 -if [[ ${PV} = *9999* ]]; then
750 - EGIT_REPO_URI="git://git.qemu.org/qemu.git"
751 - inherit git-2
752 - SRC_URI=""
753 -else
754 - SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
755 - ${BACKPORTS:+
756 - https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
757 - KEYWORDS="amd64 ~arm64 ~ppc ~ppc64 x86 ~x86-fbsd"
758 -fi
759 -
760 -DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
761 -HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
762 -
763 -LICENSE="GPL-2 LGPL-2 BSD-2"
764 -SLOT="0"
765 -IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
766 -gnutls gtk gtk2 infiniband iscsi +jpeg \
767 -kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
768 -+png pulseaudio python \
769 -rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
770 -static-user systemtap tci test +threads usb usbredir +uuid vde +vhost-net \
771 -virgl virtfs +vnc vte xattr xen xfs"
772 -
773 -COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
774 -mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
775 -x86_64"
776 -IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
777 -IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus tilegx"
778 -
779 -use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
780 -use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
781 -IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
782 -
783 -# Allow no targets to be built so that people can get a tools-only build.
784 -# Block USE flag configurations known to not work.
785 -REQUIRED_USE="${PYTHON_REQUIRED_USE}
786 - gtk2? ( gtk )
787 - qemu_softmmu_targets_arm? ( fdt )
788 - qemu_softmmu_targets_microblaze? ( fdt )
789 - qemu_softmmu_targets_ppc? ( fdt )
790 - qemu_softmmu_targets_ppc64? ( fdt )
791 - sdl2? ( sdl )
792 - static? ( static-softmmu static-user )
793 - static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
794 - virtfs? ( xattr )
795 - vte? ( gtk )"
796 -
797 -# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
798 -#
799 -# The attr lib isn't always linked in (although the USE flag is always
800 -# respected). This is because qemu supports using the C library's API
801 -# when available rather than always using the extranl library.
802 -#
803 -# Older versions of gnutls are supported, but it's simpler to just require
804 -# the latest versions. This is also why we require nettle.
805 -COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
806 - sys-libs/zlib[static-libs(+)]
807 - xattr? ( sys-apps/attr[static-libs(+)] )"
808 -SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
809 - >=x11-libs/pixman-0.28.0[static-libs(+)]
810 - accessibility? ( app-accessibility/brltty[static-libs(+)] )
811 - aio? ( dev-libs/libaio[static-libs(+)] )
812 - alsa? ( >=media-libs/alsa-lib-1.0.13 )
813 - bluetooth? ( net-wireless/bluez )
814 - caps? ( sys-libs/libcap-ng[static-libs(+)] )
815 - curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
816 - fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
817 - glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
818 - gnutls? (
819 - dev-libs/nettle[static-libs(+)]
820 - >=net-libs/gnutls-3.0[static-libs(+)]
821 - )
822 - gtk? (
823 - gtk2? (
824 - x11-libs/gtk+:2
825 - vte? ( x11-libs/vte:0 )
826 - )
827 - !gtk2? (
828 - x11-libs/gtk+:3
829 - vte? ( x11-libs/vte:2.90 )
830 - )
831 - )
832 - infiniband? ( sys-fabric/librdmacm:=[static-libs(+)] )
833 - iscsi? ( net-libs/libiscsi )
834 - jpeg? ( virtual/jpeg:0=[static-libs(+)] )
835 - lzo? ( dev-libs/lzo:2[static-libs(+)] )
836 - ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
837 - nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
838 - numa? ( sys-process/numactl[static-libs(+)] )
839 - opengl? (
840 - virtual/opengl
841 - media-libs/libepoxy[static-libs(+)]
842 - media-libs/mesa[static-libs(+)]
843 - media-libs/mesa[egl,gles2]
844 - )
845 - png? ( media-libs/libpng:0=[static-libs(+)] )
846 - pulseaudio? ( media-sound/pulseaudio )
847 - rbd? ( sys-cluster/ceph[static-libs(+)] )
848 - sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
849 - sdl? (
850 - !sdl2? (
851 - media-libs/libsdl[X]
852 - >=media-libs/libsdl-1.2.11[static-libs(+)]
853 - )
854 - sdl2? (
855 - media-libs/libsdl2[X]
856 - media-libs/libsdl2[static-libs(+)]
857 - )
858 - )
859 - seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
860 - smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
861 - snappy? ( app-arch/snappy[static-libs(+)] )
862 - spice? (
863 - >=app-emulation/spice-protocol-0.12.3
864 - >=app-emulation/spice-0.12.0[static-libs(+)]
865 - )
866 - ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
867 - usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
868 - usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
869 - uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
870 - vde? ( net-misc/vde[static-libs(+)] )
871 - virgl? ( media-libs/virglrenderer[static-libs(+)] )
872 - virtfs? ( sys-libs/libcap )
873 - xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
874 -USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
875 -X86_FIRMWARE_DEPEND="
876 - >=sys-firmware/ipxe-1.0.0_p20130624
877 - pin-upstream-blobs? (
878 - ~sys-firmware/seabios-1.8.2
879 - ~sys-firmware/sgabios-0.1_pre8
880 - ~sys-firmware/vgabios-0.7a
881 - )
882 - !pin-upstream-blobs? (
883 - sys-firmware/seabios
884 - sys-firmware/sgabios
885 - sys-firmware/vgabios
886 - )"
887 -CDEPEND="
888 - !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
889 - !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
890 - qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
891 - qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
892 - python? ( ${PYTHON_DEPS} )
893 - systemtap? ( dev-util/systemtap )
894 - xen? ( app-emulation/xen-tools:= )"
895 -DEPEND="${CDEPEND}
896 - dev-lang/perl
897 - =dev-lang/python-2*
898 - sys-apps/texinfo
899 - virtual/pkgconfig
900 - kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
901 - gtk? ( nls? ( sys-devel/gettext ) )
902 - static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
903 - static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
904 - test? (
905 - dev-libs/glib[utils]
906 - sys-devel/bc
907 - )"
908 -RDEPEND="${CDEPEND}
909 - selinux? ( sec-policy/selinux-qemu )
910 -"
911 -
912 -STRIP_MASK="/usr/share/qemu/palcode-clipper"
913 -
914 -QA_PREBUILT="
915 - usr/share/qemu/openbios-ppc
916 - usr/share/qemu/openbios-sparc64
917 - usr/share/qemu/openbios-sparc32
918 - usr/share/qemu/palcode-clipper
919 - usr/share/qemu/s390-ccw.img
920 - usr/share/qemu/u-boot.e500
921 -"
922 -
923 -QA_WX_LOAD="usr/bin/qemu-i386
924 - usr/bin/qemu-x86_64
925 - usr/bin/qemu-alpha
926 - usr/bin/qemu-arm
927 - usr/bin/qemu-cris
928 - usr/bin/qemu-m68k
929 - usr/bin/qemu-microblaze
930 - usr/bin/qemu-microblazeel
931 - usr/bin/qemu-mips
932 - usr/bin/qemu-mipsel
933 - usr/bin/qemu-or32
934 - usr/bin/qemu-ppc
935 - usr/bin/qemu-ppc64
936 - usr/bin/qemu-ppc64abi32
937 - usr/bin/qemu-sh4
938 - usr/bin/qemu-sh4eb
939 - usr/bin/qemu-sparc
940 - usr/bin/qemu-sparc64
941 - usr/bin/qemu-armeb
942 - usr/bin/qemu-sparc32plus
943 - usr/bin/qemu-s390x
944 - usr/bin/qemu-unicore32"
945 -
946 -DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
947 -you have the kernel module loaded before running kvm. The easiest way to
948 -ensure that the kernel module is loaded is to load it on boot.\n
949 -For AMD CPUs the module is called 'kvm-amd'.\n
950 -For Intel CPUs the module is called 'kvm-intel'.\n
951 -Please review /etc/conf.d/modules for how to load these.\n\n
952 -Make sure your user is in the 'kvm' group\n
953 -Just run 'gpasswd -a <USER> kvm', then have <USER> re-login.\n\n
954 -For brand new installs, the default permissions on /dev/kvm might not let you
955 -access it. You can tell udev to reset ownership/perms:\n
956 -udevadm trigger -c add /dev/kvm"
957 -
958 -qemu_support_kvm() {
959 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
960 - use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
961 - use qemu_softmmu_targets_s390x; then
962 - return 0
963 - fi
964 -
965 - return 1
966 -}
967 -
968 -pkg_pretend() {
969 - if use kernel_linux && kernel_is lt 2 6 25; then
970 - eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
971 - elif use kernel_linux; then
972 - if ! linux_config_exists; then
973 - eerror "Unable to check your kernel for KVM support"
974 - else
975 - CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
976 - ERROR_KVM="You must enable KVM in your kernel to continue"
977 - ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
978 - ERROR_KVM_AMD+=" your kernel configuration."
979 - ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
980 - ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
981 - ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
982 - ERROR_TUN+=" into your kernel or loaded as a module to use the"
983 - ERROR_TUN+=" virtual network device if using -net tap."
984 - ERROR_BRIDGE="You will also need support for 802.1d"
985 - ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
986 - use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
987 - ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
988 - ERROR_VHOST_NET+=" support"
989 -
990 - if use amd64 || use x86 || use amd64-linux || use x86-linux; then
991 - CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
992 - fi
993 -
994 - use python && CONFIG_CHECK+=" ~DEBUG_FS"
995 - ERROR_DEBUG_FS="debugFS support required for kvm_stat"
996 -
997 - # Now do the actual checks setup above
998 - check_extra_config
999 - fi
1000 - fi
1001 -
1002 - if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
1003 - eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
1004 - eerror "instances are still pointing to it. Please update your"
1005 - eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
1006 - eerror "and the right system binary (e.g. qemu-system-x86_64)."
1007 - die "update your virt configs to not use qemu-kvm"
1008 - fi
1009 -}
1010 -
1011 -pkg_setup() {
1012 - enewgroup kvm 78
1013 -}
1014 -
1015 -# Sanity check to make sure target lists are kept up-to-date.
1016 -check_targets() {
1017 - local var=$1 mak=$2
1018 - local detected sorted
1019 -
1020 - pushd "${S}"/default-configs >/dev/null || die
1021 -
1022 - # Force C locale until glibc is updated. #564936
1023 - detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
1024 - sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
1025 - if [[ ${sorted} != "${detected}" ]] ; then
1026 - eerror "The ebuild needs to be kept in sync."
1027 - eerror "${var}: ${sorted}"
1028 - eerror "$(printf '%-*s' ${#var} configure): ${detected}"
1029 - die "sync ${var} to the list of targets"
1030 - fi
1031 -
1032 - popd >/dev/null
1033 -}
1034 -
1035 -handle_locales() {
1036 - # Make sure locale list is kept up-to-date.
1037 - local detected sorted
1038 - detected=$(echo $(cd po && printf '%s\n' *.po | grep -v messages.po | sed 's:.po$::' | sort -u))
1039 - sorted=$(echo $(printf '%s\n' ${PLOCALES} | sort -u))
1040 - if [[ ${sorted} != "${detected}" ]] ; then
1041 - eerror "The ebuild needs to be kept in sync."
1042 - eerror "PLOCALES: ${sorted}"
1043 - eerror " po/*.po: ${detected}"
1044 - die "sync PLOCALES"
1045 - fi
1046 -
1047 - # Deal with selective install of locales.
1048 - if use nls ; then
1049 - # Delete locales the user does not want. #577814
1050 - rm_loc() { rm po/$1.po || die; }
1051 - l10n_for_each_disabled_locale_do rm_loc
1052 - else
1053 - # Cheap hack to disable gettext .mo generation.
1054 - rm -f po/*.po
1055 - fi
1056 -}
1057 -
1058 -src_prepare() {
1059 - check_targets IUSE_SOFTMMU_TARGETS softmmu
1060 - check_targets IUSE_USER_TARGETS linux-user
1061 -
1062 - # Alter target makefiles to accept CFLAGS set via flag-o
1063 - sed -i -r \
1064 - -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
1065 - Makefile Makefile.target || die
1066 -
1067 - epatch "${FILESDIR}"/qemu-2.5.0-cflags.patch
1068 - [[ -n ${BACKPORTS} ]] && \
1069 - EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
1070 - epatch
1071 -
1072 - epatch "${FILESDIR}"/${P}-CVE-2015-8567.patch #567868
1073 - epatch "${FILESDIR}"/${P}-CVE-2015-8558.patch #568246
1074 - epatch "${FILESDIR}"/${P}-CVE-2015-8701.patch #570110
1075 - epatch "${FILESDIR}"/${P}-CVE-2015-8743.patch #570988
1076 - epatch "${FILESDIR}"/${P}-CVE-2016-1568.patch #571566
1077 - epatch "${FILESDIR}"/${P}-CVE-2015-8613.patch #569118
1078 - epatch "${FILESDIR}"/${P}-CVE-2015-8619.patch #569300
1079 - epatch "${FILESDIR}"/${P}-CVE-2016-1714.patch #571560
1080 - epatch "${FILESDIR}"/${P}-CVE-2016-1922.patch #572082
1081 - epatch "${FILESDIR}"/${P}-CVE-2016-1981.patch #572412
1082 - epatch "${FILESDIR}"/${P}-usb-ehci-oob.patch #572454
1083 - epatch "${FILESDIR}"/${P}-CVE-2016-2197.patch #573280
1084 - epatch "${FILESDIR}"/${P}-CVE-2016-2198.patch #573314
1085 - epatch "${FILESDIR}"/${P}-CVE-2016-2392.patch #574902
1086 - epatch "${FILESDIR}"/${P}-usb-ndis-int-overflow.patch #575492
1087 - epatch "${FILESDIR}"/${P}-rng-stack-corrupt-{0,1,2,3}.patch #576420
1088 - epatch "${FILESDIR}"/${P}-sysmacros.patch
1089 - epatch "${FILESDIR}"/${P}-ne2000-reg-check.patch #573816
1090 - epatch "${FILESDIR}"/${P}-9pfs-segfault.patch #578142
1091 -
1092 - # Fix ld and objcopy being called directly
1093 - tc-export AR LD OBJCOPY
1094 -
1095 - # Verbose builds
1096 - MAKEOPTS+=" V=1"
1097 -
1098 - epatch_user
1099 -
1100 - # Run after we've applied all patches.
1101 - handle_locales
1102 -}
1103 -
1104 -##
1105 -# configures qemu based on the build directory and the build type
1106 -# we are using.
1107 -#
1108 -qemu_src_configure() {
1109 - debug-print-function ${FUNCNAME} "$@"
1110 -
1111 - local buildtype=$1
1112 - local builddir="${S}/${buildtype}-build"
1113 - local static_flag="static-${buildtype}"
1114 -
1115 - mkdir "${builddir}"
1116 -
1117 - local conf_opts=(
1118 - --prefix=/usr
1119 - --sysconfdir=/etc
1120 - --libdir=/usr/$(get_libdir)
1121 - --docdir=/usr/share/doc/${PF}/html
1122 - --disable-bsd-user
1123 - --disable-guest-agent
1124 - --disable-strip
1125 - --disable-werror
1126 - # We support gnutls/nettle for crypto operations. It is possible
1127 - # to use gcrypt when gnutls/nettle are disabled (but not when they
1128 - # are enabled), but it's not really worth the hassle. Disable it
1129 - # all the time to avoid automatically detecting it. #568856
1130 - --disable-gcrypt
1131 - --python="${PYTHON}"
1132 - --cc="$(tc-getCC)"
1133 - --cxx="$(tc-getCXX)"
1134 - --host-cc="$(tc-getBUILD_CC)"
1135 - $(use_enable debug debug-info)
1136 - $(use_enable debug debug-tcg)
1137 - --enable-docs
1138 - $(use_enable tci tcg-interpreter)
1139 - $(use_enable xattr attr)
1140 - )
1141 -
1142 - # Disable options not used by user targets as the default configure
1143 - # options will autoprobe and try to link in a bunch of unused junk.
1144 - conf_softmmu() {
1145 - if [[ ${buildtype} == "user" ]] ; then
1146 - echo "--disable-${2:-$1}"
1147 - else
1148 - use_enable "$@"
1149 - fi
1150 - }
1151 - conf_opts+=(
1152 - $(conf_softmmu accessibility brlapi)
1153 - $(conf_softmmu aio linux-aio)
1154 - $(conf_softmmu bluetooth bluez)
1155 - $(conf_softmmu caps cap-ng)
1156 - $(conf_softmmu curl)
1157 - $(conf_softmmu fdt)
1158 - $(conf_softmmu glusterfs)
1159 - $(conf_softmmu gnutls)
1160 - $(conf_softmmu gnutls nettle)
1161 - $(conf_softmmu gtk)
1162 - $(conf_softmmu infiniband rdma)
1163 - $(conf_softmmu iscsi libiscsi)
1164 - $(conf_softmmu jpeg vnc-jpeg)
1165 - $(conf_softmmu kernel_linux kvm)
1166 - $(conf_softmmu lzo)
1167 - $(conf_softmmu ncurses curses)
1168 - $(conf_softmmu nfs libnfs)
1169 - $(conf_softmmu numa)
1170 - $(conf_softmmu opengl)
1171 - $(conf_softmmu png vnc-png)
1172 - $(conf_softmmu rbd)
1173 - $(conf_softmmu sasl vnc-sasl)
1174 - $(conf_softmmu sdl)
1175 - $(conf_softmmu seccomp)
1176 - $(conf_softmmu smartcard)
1177 - $(conf_softmmu snappy)
1178 - $(conf_softmmu spice)
1179 - $(conf_softmmu ssh libssh2)
1180 - $(conf_softmmu usb libusb)
1181 - $(conf_softmmu usbredir usb-redir)
1182 - $(conf_softmmu uuid)
1183 - $(conf_softmmu vde)
1184 - $(conf_softmmu vhost-net)
1185 - $(conf_softmmu virgl virglrenderer)
1186 - $(conf_softmmu virtfs)
1187 - $(conf_softmmu vnc)
1188 - $(conf_softmmu vte)
1189 - $(conf_softmmu xen)
1190 - $(conf_softmmu xen xen-pci-passthrough)
1191 - $(conf_softmmu xfs xfsctl)
1192 - )
1193 -
1194 - case ${buildtype} in
1195 - user)
1196 - conf_opts+=(
1197 - --enable-linux-user
1198 - --disable-system
1199 - --disable-blobs
1200 - --disable-tools
1201 - )
1202 - ;;
1203 - softmmu)
1204 - # audio options
1205 - local audio_opts="oss"
1206 - use alsa && audio_opts="alsa,${audio_opts}"
1207 - use sdl && audio_opts="sdl,${audio_opts}"
1208 - use pulseaudio && audio_opts="pa,${audio_opts}"
1209 -
1210 - conf_opts+=(
1211 - --disable-linux-user
1212 - --enable-system
1213 - --with-system-pixman
1214 - --audio-drv-list="${audio_opts}"
1215 - )
1216 - use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
1217 - use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
1218 - ;;
1219 - tools)
1220 - conf_opts+=(
1221 - --disable-linux-user
1222 - --disable-system
1223 - --disable-blobs
1224 - )
1225 - static_flag="static"
1226 - ;;
1227 - esac
1228 -
1229 - local targets="${buildtype}_targets"
1230 - [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
1231 -
1232 - # Add support for SystemTAP
1233 - use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
1234 -
1235 - # We always want to attempt to build with PIE support as it results
1236 - # in a more secure binary. But it doesn't work with static or if
1237 - # the current GCC doesn't have PIE support.
1238 - if use ${static_flag}; then
1239 - conf_opts+=( --static --disable-pie )
1240 - else
1241 - gcc-specs-pie && conf_opts+=( --enable-pie )
1242 - fi
1243 -
1244 - echo "../configure ${conf_opts[*]}"
1245 - cd "${builddir}"
1246 - ../configure "${conf_opts[@]}" || die "configure failed"
1247 -
1248 - # FreeBSD's kernel does not support QEMU assigning/grabbing
1249 - # host USB devices yet
1250 - use kernel_FreeBSD && \
1251 - sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
1252 -}
1253 -
1254 -src_configure() {
1255 - local target
1256 -
1257 - python_setup
1258 -
1259 - softmmu_targets= softmmu_bins=()
1260 - user_targets= user_bins=()
1261 -
1262 - for target in ${IUSE_SOFTMMU_TARGETS} ; do
1263 - if use "qemu_softmmu_targets_${target}"; then
1264 - softmmu_targets+=",${target}-softmmu"
1265 - softmmu_bins+=( "qemu-system-${target}" )
1266 - fi
1267 - done
1268 -
1269 - for target in ${IUSE_USER_TARGETS} ; do
1270 - if use "qemu_user_targets_${target}"; then
1271 - user_targets+=",${target}-linux-user"
1272 - user_bins+=( "qemu-${target}" )
1273 - fi
1274 - done
1275 -
1276 - softmmu_targets=${softmmu_targets#,}
1277 - user_targets=${user_targets#,}
1278 -
1279 - [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
1280 - [[ -n ${user_targets} ]] && qemu_src_configure "user"
1281 - [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
1282 -}
1283 -
1284 -src_compile() {
1285 - if [[ -n ${user_targets} ]]; then
1286 - cd "${S}/user-build"
1287 - default
1288 - fi
1289 -
1290 - if [[ -n ${softmmu_targets} ]]; then
1291 - cd "${S}/softmmu-build"
1292 - default
1293 - fi
1294 -
1295 - if [[ -z ${softmmu_targets}${user_targets} ]]; then
1296 - cd "${S}/tools-build"
1297 - default
1298 - fi
1299 -}
1300 -
1301 -src_test() {
1302 - if [[ -n ${softmmu_targets} ]]; then
1303 - cd "${S}/softmmu-build"
1304 - pax-mark m */qemu-system-* #515550
1305 - emake -j1 check
1306 - emake -j1 check-report.html
1307 - fi
1308 -}
1309 -
1310 -qemu_python_install() {
1311 - python_domodule "${S}/scripts/qmp/qmp.py"
1312 -
1313 - python_doscript "${S}/scripts/kvm/kvm_stat"
1314 - python_doscript "${S}/scripts/kvm/vmxcap"
1315 - python_doscript "${S}/scripts/qmp/qmp-shell"
1316 - python_doscript "${S}/scripts/qmp/qemu-ga-client"
1317 -}
1318 -
1319 -src_install() {
1320 - if [[ -n ${user_targets} ]]; then
1321 - cd "${S}/user-build"
1322 - emake DESTDIR="${ED}" install
1323 -
1324 - # Install binfmt handler init script for user targets
1325 - newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
1326 - fi
1327 -
1328 - if [[ -n ${softmmu_targets} ]]; then
1329 - cd "${S}/softmmu-build"
1330 - emake DESTDIR="${ED}" install
1331 -
1332 - # This might not exist if the test failed. #512010
1333 - [[ -e check-report.html ]] && dohtml check-report.html
1334 -
1335 - if use kernel_linux; then
1336 - udev_dorules "${FILESDIR}"/65-kvm.rules
1337 - fi
1338 -
1339 - if use python; then
1340 - python_foreach_impl qemu_python_install
1341 - fi
1342 - fi
1343 -
1344 - if [[ -z ${softmmu_targets}${user_targets} ]]; then
1345 - cd "${S}/tools-build"
1346 - emake DESTDIR="${ED}" install
1347 - fi
1348 -
1349 - # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
1350 - pushd "${ED}"/usr/bin >/dev/null
1351 - pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
1352 - popd >/dev/null
1353 -
1354 - # Install config file example for qemu-bridge-helper
1355 - insinto "/etc/qemu"
1356 - doins "${FILESDIR}/bridge.conf"
1357 -
1358 - # Remove the docdir placed qmp-commands.txt
1359 - mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/" || die
1360 -
1361 - cd "${S}"
1362 - dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
1363 - newdoc pc-bios/README README.pc-bios
1364 - dodoc docs/qmp-*.txt
1365 -
1366 - if [[ -n ${softmmu_targets} ]]; then
1367 - # Remove SeaBIOS since we're using the SeaBIOS packaged one
1368 - rm "${ED}/usr/share/qemu/bios.bin"
1369 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
1370 - dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
1371 - fi
1372 -
1373 - # Remove vgabios since we're using the vgabios packaged one
1374 - rm "${ED}/usr/share/qemu/vgabios.bin"
1375 - rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
1376 - rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
1377 - rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
1378 - rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
1379 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
1380 - dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
1381 - dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
1382 - dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
1383 - dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
1384 - dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
1385 - fi
1386 -
1387 - # Remove sgabios since we're using the sgabios packaged one
1388 - rm "${ED}/usr/share/qemu/sgabios.bin"
1389 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
1390 - dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
1391 - fi
1392 -
1393 - # Remove iPXE since we're using the iPXE packaged one
1394 - rm "${ED}"/usr/share/qemu/pxe-*.rom
1395 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
1396 - dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
1397 - dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
1398 - dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
1399 - dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
1400 - dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
1401 - dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
1402 - fi
1403 - fi
1404 -
1405 - qemu_support_kvm && readme.gentoo_create_doc
1406 -}
1407 -
1408 -pkg_postinst() {
1409 - if qemu_support_kvm; then
1410 - readme.gentoo_print_elog
1411 - fi
1412 -
1413 - if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
1414 - udev_reload
1415 - fi
1416 -
1417 - fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
1418 -}
1419 -
1420 -pkg_info() {
1421 - echo "Using:"
1422 - echo " $(best_version app-emulation/spice-protocol)"
1423 - echo " $(best_version sys-firmware/ipxe)"
1424 - echo " $(best_version sys-firmware/seabios)"
1425 - if has_version 'sys-firmware/seabios[binary]'; then
1426 - echo " USE=binary"
1427 - else
1428 - echo " USE=''"
1429 - fi
1430 - echo " $(best_version sys-firmware/vgabios)"
1431 -}