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: Sat, 03 Jun 2017 14:43:50
Message-Id: 1496501014.c7f0b12f5a2baa48c18bc90e61ac36a43a465cd7.tamiko@gentoo
1 commit: c7f0b12f5a2baa48c18bc90e61ac36a43a465cd7
2 Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
3 AuthorDate: Sat Jun 3 14:42:35 2017 +0000
4 Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
5 CommitDate: Sat Jun 3 14:43:34 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c7f0b12f
7
8 app-emulation/qemu: drop vulnerable, bug #616874
9
10 Package-Manager: Portage-2.3.6, Repoman-2.3.2
11
12 app-emulation/qemu/Manifest | 1 -
13 app-emulation/qemu/qemu-2.8.1-r2.ebuild | 764 --------------------------------
14 2 files changed, 765 deletions(-)
15
16 diff --git a/app-emulation/qemu/Manifest b/app-emulation/qemu/Manifest
17 index fc13e01c719..fb4bf044093 100644
18 --- a/app-emulation/qemu/Manifest
19 +++ b/app-emulation/qemu/Manifest
20 @@ -1,2 +1 @@
21 -DIST qemu-2.8.1.tar.bz2 28366270 SHA256 018e4c7ed22c220395cf41f835d01505e49d0e579a548bd3d72b03809442bbcd SHA512 0397b4029cdcb77ed053c44b3579a3f34894038e6fc6b4aa88de14515f5a78bf2f41c5e865f37111529f567c85d2f1c4deefae47dde54f76eac79410e5b2bdda WHIRLPOOL c41f53f18fac44efd1c81ba9d95204d23e9a70dc9c21624177be2fe92a327428fd5704b25bc334229fa36ae395fb4c82ba3955db39719c4458343978a4d3141a
22 DIST qemu-2.9.0.tar.bz2 28720490 SHA256 00bfb217b1bb03c7a6c3261b819cfccbfb5a58e3e2ceff546327d271773c6c14 SHA512 4b28966eec0ca44681e35fcfb64a4eaef7c280b8d65c91d03f2efa37f76278fd8c1680e5798c7a30dbfcc8f3c05f4a803f48b8a2dfec3a4181bac079b2a5e422 WHIRLPOOL d79fe89eb271a56aee0cbd328e5f96999176b711afb5683d164b7b99d91e6dd2bfaf6e2ff4cd820a941c94f28116765cb07ffd5809d75c2f9654a67d56bfc0c1
23
24 diff --git a/app-emulation/qemu/qemu-2.8.1-r2.ebuild b/app-emulation/qemu/qemu-2.8.1-r2.ebuild
25 deleted file mode 100644
26 index 1f2da1c3859..00000000000
27 --- a/app-emulation/qemu/qemu-2.8.1-r2.ebuild
28 +++ /dev/null
29 @@ -1,764 +0,0 @@
30 -# Copyright 1999-2017 Gentoo Foundation
31 -# Distributed under the terms of the GNU General Public License v2
32 -
33 -EAPI="6"
34 -
35 -PYTHON_COMPAT=( python2_7 )
36 -PYTHON_REQ_USE="ncurses,readline"
37 -
38 -PLOCALES="bg de_DE fr_FR hu it tr zh_CN"
39 -
40 -inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
41 - user udev fcaps readme.gentoo-r1 pax-utils l10n
42 -
43 -if [[ ${PV} = *9999* ]]; then
44 - EGIT_REPO_URI="git://git.qemu.org/qemu.git"
45 - inherit git-r3
46 - SRC_URI=""
47 -else
48 - SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2"
49 - KEYWORDS="amd64 ~arm64 ~ppc ~ppc64 x86 ~x86-fbsd"
50 -fi
51 -
52 -DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
53 -HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
54 -
55 -LICENSE="GPL-2 LGPL-2 BSD-2"
56 -SLOT="0"
57 -IUSE="accessibility +aio alsa bluetooth bzip2 +caps +curl debug +fdt
58 - glusterfs gnutls gtk gtk2 infiniband iscsi +jpeg kernel_linux
59 - kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs +png
60 - pulseaudio python rbd sasl +seccomp sdl sdl2 selinux smartcard snappy
61 - spice ssh static static-user systemtap tci test usb usbredir vde
62 - +vhost-net virgl virtfs +vnc vte xattr xen xfs"
63 -
64 -COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel
65 - mips mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc
66 - sparc64 x86_64"
67 -IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS}
68 - lm32 moxie ppcemb tricore unicore32 xtensa xtensaeb"
69 -IUSE_USER_TARGETS="${COMMON_TARGETS}
70 - armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus tilegx"
71 -
72 -use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
73 -use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
74 -IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
75 -
76 -# Allow no targets to be built so that people can get a tools-only build.
77 -# Block USE flag configurations known to not work.
78 -REQUIRED_USE="${PYTHON_REQUIRED_USE}
79 - gtk2? ( gtk )
80 - qemu_softmmu_targets_arm? ( fdt )
81 - qemu_softmmu_targets_microblaze? ( fdt )
82 - qemu_softmmu_targets_ppc? ( fdt )
83 - qemu_softmmu_targets_ppc64? ( fdt )
84 - sdl2? ( sdl )
85 - static? ( static-user !alsa !bluetooth !gtk !gtk2 !opengl !pulseaudio )
86 - virtfs? ( xattr )
87 - vte? ( gtk )"
88 -
89 -# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
90 -# and user/softmmu targets (qemu-*, qemu-system-*).
91 -#
92 -# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
93 -#
94 -# The attr lib isn't always linked in (although the USE flag is always
95 -# respected). This is because qemu supports using the C library's API
96 -# when available rather than always using the extranl library.
97 -ALL_DEPEND="
98 - >=dev-libs/glib-2.0[static-libs(+)]
99 - sys-libs/zlib[static-libs(+)]
100 - python? ( ${PYTHON_DEPS} )
101 - systemtap? ( dev-util/systemtap )
102 - xattr? ( sys-apps/attr[static-libs(+)] )"
103 -
104 -# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
105 -# softmmu targets (qemu-system-*).
106 -SOFTMMU_TOOLS_DEPEND="
107 - >=x11-libs/pixman-0.28.0[static-libs(+)]
108 - accessibility? (
109 - app-accessibility/brltty[api]
110 - app-accessibility/brltty[static-libs(+)]
111 - )
112 - aio? ( dev-libs/libaio[static-libs(+)] )
113 - alsa? ( >=media-libs/alsa-lib-1.0.13 )
114 - bluetooth? ( net-wireless/bluez )
115 - bzip2? ( app-arch/bzip2[static-libs(+)] )
116 - caps? ( sys-libs/libcap-ng[static-libs(+)] )
117 - curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
118 - fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
119 - glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
120 - gnutls? (
121 - dev-libs/nettle:=[static-libs(+)]
122 - >=net-libs/gnutls-3.0:=[static-libs(+)]
123 - )
124 - gtk? (
125 - gtk2? (
126 - x11-libs/gtk+:2
127 - vte? ( x11-libs/vte:0 )
128 - )
129 - !gtk2? (
130 - x11-libs/gtk+:3
131 - vte? ( x11-libs/vte:2.91 )
132 - )
133 - )
134 - infiniband? ( sys-fabric/librdmacm:=[static-libs(+)] )
135 - iscsi? ( net-libs/libiscsi )
136 - jpeg? ( virtual/jpeg:0=[static-libs(+)] )
137 - lzo? ( dev-libs/lzo:2[static-libs(+)] )
138 - ncurses? (
139 - sys-libs/ncurses:0=[unicode]
140 - sys-libs/ncurses:0=[static-libs(+)]
141 - )
142 - nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
143 - numa? ( sys-process/numactl[static-libs(+)] )
144 - opengl? (
145 - virtual/opengl
146 - media-libs/libepoxy[static-libs(+)]
147 - media-libs/mesa[static-libs(+)]
148 - media-libs/mesa[egl,gbm]
149 - )
150 - png? ( media-libs/libpng:0=[static-libs(+)] )
151 - pulseaudio? ( media-sound/pulseaudio )
152 - rbd? ( sys-cluster/ceph[static-libs(+)] )
153 - sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
154 - sdl? (
155 - !sdl2? (
156 - media-libs/libsdl[X]
157 - >=media-libs/libsdl-1.2.11[static-libs(+)]
158 - )
159 - sdl2? (
160 - media-libs/libsdl2[X]
161 - media-libs/libsdl2[static-libs(+)]
162 - )
163 - )
164 - seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
165 - smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
166 - snappy? ( app-arch/snappy[static-libs(+)] )
167 - spice? (
168 - >=app-emulation/spice-protocol-0.12.3
169 - >=app-emulation/spice-0.12.0[static-libs(+)]
170 - )
171 - ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
172 - usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
173 - usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
174 - vde? ( net-misc/vde[static-libs(+)] )
175 - virgl? ( media-libs/virglrenderer[static-libs(+)] )
176 - virtfs? ( sys-libs/libcap )
177 - xen? ( app-emulation/xen-tools:= )
178 - xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
179 -
180 -X86_FIRMWARE_DEPEND="
181 - >=sys-firmware/ipxe-1.0.0_p20130624
182 - pin-upstream-blobs? (
183 - ~sys-firmware/seabios-1.10.1
184 - ~sys-firmware/sgabios-0.1_pre8
185 - ~sys-firmware/vgabios-0.7a
186 - )
187 - !pin-upstream-blobs? (
188 - sys-firmware/seabios
189 - sys-firmware/sgabios
190 - sys-firmware/vgabios
191 - )"
192 -
193 -CDEPEND="
194 - !static? (
195 - ${ALL_DEPEND//\[static-libs(+)]}
196 - ${SOFTMMU_TOOLS_DEPEND//\[static-libs(+)]}
197 - )
198 - qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
199 - qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )"
200 -DEPEND="${CDEPEND}
201 - dev-lang/perl
202 - =dev-lang/python-2*
203 - sys-apps/texinfo
204 - virtual/pkgconfig
205 - kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
206 - gtk? ( nls? ( sys-devel/gettext ) )
207 - static? (
208 - ${ALL_DEPEND}
209 - ${SOFTMMU_TOOLS_DEPEND}
210 - )
211 - static-user? ( ${ALL_DEPEND} )
212 - test? (
213 - dev-libs/glib[utils]
214 - sys-devel/bc
215 - )"
216 -RDEPEND="${CDEPEND}
217 - selinux? ( sec-policy/selinux-qemu )"
218 -
219 -PATCHES=(
220 - "${FILESDIR}"/${PN}-2.5.0-cflags.patch
221 - "${FILESDIR}"/${PN}-2.5.0-sysmacros.patch
222 - "${FILESDIR}"/${PN}-2.7.0-CVE-2016-8669-1.patch #597108
223 - "${FILESDIR}"/${PN}-2.8.0-CVE-2016-9908.patch #601826
224 - "${FILESDIR}"/${PN}-2.8.0-CVE-2016-9912.patch #602630
225 - "${FILESDIR}"/${PN}-2.8.0-CVE-2016-10028.patch #603444
226 - "${FILESDIR}"/${PN}-2.8.0-CVE-2016-10155.patch #606720
227 - "${FILESDIR}"/${PN}-2.8.0-CVE-2017-5525-1.patch #606264
228 - "${FILESDIR}"/${PN}-2.8.0-CVE-2017-5525-2.patch
229 - "${FILESDIR}"/${PN}-2.8.0-CVE-2017-5552.patch #606722
230 - "${FILESDIR}"/${PN}-2.8.0-CVE-2017-5578.patch #607000
231 - "${FILESDIR}"/${PN}-2.8.0-CVE-2017-5579.patch #607100
232 - "${FILESDIR}"/${PN}-2.8.0-CVE-2017-5856.patch #608036
233 - "${FILESDIR}"/${PN}-2.8.0-CVE-2017-5857.patch #608038
234 - "${FILESDIR}"/${PN}-2.8.0-CVE-2017-5898.patch #608520
235 - "${FILESDIR}"/${PN}-2.8.0-CVE-2017-5973.patch #609334
236 - "${FILESDIR}"/${PN}-2.8.0-CVE-2017-5987.patch #609398
237 - "${FILESDIR}"/${PN}-2.8.0-CVE-2017-6505.patch #612220
238 - "${FILESDIR}"/${PN}-2.8.0-CVE-2017-7377.patch #614744
239 - "${FILESDIR}"/${PN}-2.8.1-CVE-2017-7471.patch #616484
240 - "${FILESDIR}"/${PN}-2.8.1-CVE-2017-8086.patch #616460
241 -)
242 -
243 -STRIP_MASK="/usr/share/qemu/palcode-clipper"
244 -
245 -QA_PREBUILT="
246 - usr/share/qemu/openbios-ppc
247 - usr/share/qemu/openbios-sparc64
248 - usr/share/qemu/openbios-sparc32
249 - usr/share/qemu/palcode-clipper
250 - usr/share/qemu/s390-ccw.img
251 - usr/share/qemu/u-boot.e500"
252 -
253 -QA_WX_LOAD="usr/bin/qemu-i386
254 - usr/bin/qemu-x86_64
255 - usr/bin/qemu-alpha
256 - usr/bin/qemu-arm
257 - usr/bin/qemu-cris
258 - usr/bin/qemu-m68k
259 - usr/bin/qemu-microblaze
260 - usr/bin/qemu-microblazeel
261 - usr/bin/qemu-mips
262 - usr/bin/qemu-mipsel
263 - usr/bin/qemu-or32
264 - usr/bin/qemu-ppc
265 - usr/bin/qemu-ppc64
266 - usr/bin/qemu-ppc64abi32
267 - usr/bin/qemu-sh4
268 - usr/bin/qemu-sh4eb
269 - usr/bin/qemu-sparc
270 - usr/bin/qemu-sparc64
271 - usr/bin/qemu-armeb
272 - usr/bin/qemu-sparc32plus
273 - usr/bin/qemu-s390x
274 - usr/bin/qemu-unicore32"
275 -
276 -DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure you have the
277 -kernel module loaded before running kvm. The easiest way to ensure that the
278 -kernel module is loaded is to load it on boot.
279 - For AMD CPUs the module is called 'kvm-amd'.
280 - For Intel CPUs the module is called 'kvm-intel'.
281 -Please review /etc/conf.d/modules for how to load these.
282 -
283 -Make sure your user is in the 'kvm' group. Just run
284 - $ gpasswd -a <USER> kvm
285 -then have <USER> re-login.
286 -
287 -For brand new installs, the default permissions on /dev/kvm might not let
288 -you access it. You can tell udev to reset ownership/perms:
289 - $ udevadm trigger -c add /dev/kvm
290 -
291 -If you want to register binfmt handlers for qemu user targets:
292 -For openrc:
293 - # rc-update add qemu-binfmt
294 -For systemd:
295 - # ln -s /usr/share/qemu/binfmt.d/qemu.conf /etc/binfmt.d/qemu.conf"
296 -
297 -pkg_pretend() {
298 - if use kernel_linux && kernel_is lt 2 6 25; then
299 - eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
300 - elif use kernel_linux; then
301 - if ! linux_config_exists; then
302 - eerror "Unable to check your kernel for KVM support"
303 - else
304 - CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
305 - ERROR_KVM="You must enable KVM in your kernel to continue"
306 - ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
307 - ERROR_KVM_AMD+=" your kernel configuration."
308 - ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
309 - ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
310 - ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
311 - ERROR_TUN+=" into your kernel or loaded as a module to use the"
312 - ERROR_TUN+=" virtual network device if using -net tap."
313 - ERROR_BRIDGE="You will also need support for 802.1d"
314 - ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
315 - use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
316 - ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
317 - ERROR_VHOST_NET+=" support"
318 -
319 - if use amd64 || use x86 || use amd64-linux || use x86-linux; then
320 - CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
321 - fi
322 -
323 - use python && CONFIG_CHECK+=" ~DEBUG_FS"
324 - ERROR_DEBUG_FS="debugFS support required for kvm_stat"
325 -
326 - # Now do the actual checks setup above
327 - check_extra_config
328 - fi
329 - fi
330 -
331 - if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
332 - eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
333 - eerror "instances are still pointing to it. Please update your"
334 - eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
335 - eerror "and the right system binary (e.g. qemu-system-x86_64)."
336 - die "update your virt configs to not use qemu-kvm"
337 - fi
338 -}
339 -
340 -pkg_setup() {
341 - enewgroup kvm 78
342 -}
343 -
344 -# Sanity check to make sure target lists are kept up-to-date.
345 -check_targets() {
346 - local var=$1 mak=$2
347 - local detected sorted
348 -
349 - pushd "${S}"/default-configs >/dev/null || die
350 -
351 - # Force C locale until glibc is updated. #564936
352 - detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
353 - sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
354 - if [[ ${sorted} != "${detected}" ]] ; then
355 - eerror "The ebuild needs to be kept in sync."
356 - eerror "${var}: ${sorted}"
357 - eerror "$(printf '%-*s' ${#var} configure): ${detected}"
358 - die "sync ${var} to the list of targets"
359 - fi
360 -
361 - popd >/dev/null
362 -}
363 -
364 -handle_locales() {
365 - # Make sure locale list is kept up-to-date.
366 - local detected sorted
367 - detected=$(echo $(cd po && printf '%s\n' *.po | grep -v messages.po | sed 's:.po$::' | sort -u))
368 - sorted=$(echo $(printf '%s\n' ${PLOCALES} | sort -u))
369 - if [[ ${sorted} != "${detected}" ]] ; then
370 - eerror "The ebuild needs to be kept in sync."
371 - eerror "PLOCALES: ${sorted}"
372 - eerror " po/*.po: ${detected}"
373 - die "sync PLOCALES"
374 - fi
375 -
376 - # Deal with selective install of locales.
377 - if use nls ; then
378 - # Delete locales the user does not want. #577814
379 - rm_loc() { rm po/$1.po || die; }
380 - l10n_for_each_disabled_locale_do rm_loc
381 - else
382 - # Cheap hack to disable gettext .mo generation.
383 - rm -f po/*.po
384 - fi
385 -}
386 -
387 -src_prepare() {
388 - check_targets IUSE_SOFTMMU_TARGETS softmmu
389 - check_targets IUSE_USER_TARGETS linux-user
390 -
391 - # Alter target makefiles to accept CFLAGS set via flag-o
392 - sed -i -r \
393 - -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
394 - Makefile Makefile.target || die
395 -
396 - default
397 -
398 - # Fix ld and objcopy being called directly
399 - tc-export AR LD OBJCOPY
400 -
401 - # Verbose builds
402 - MAKEOPTS+=" V=1"
403 -
404 - # Run after we've applied all patches.
405 - handle_locales
406 -}
407 -
408 -##
409 -# configures qemu based on the build directory and the build type
410 -# we are using.
411 -#
412 -qemu_src_configure() {
413 - debug-print-function ${FUNCNAME} "$@"
414 -
415 - local buildtype=$1
416 - local builddir="${S}/${buildtype}-build"
417 -
418 - mkdir "${builddir}"
419 -
420 - local conf_opts=(
421 - --prefix=/usr
422 - --sysconfdir=/etc
423 - --libdir=/usr/$(get_libdir)
424 - --docdir=/usr/share/doc/${PF}/html
425 - --disable-bsd-user
426 - --disable-guest-agent
427 - --disable-strip
428 - --disable-werror
429 - # We support gnutls/nettle for crypto operations. It is possible
430 - # to use gcrypt when gnutls/nettle are disabled (but not when they
431 - # are enabled), but it's not really worth the hassle. Disable it
432 - # all the time to avoid automatically detecting it. #568856
433 - --disable-gcrypt
434 - --python="${PYTHON}"
435 - --cc="$(tc-getCC)"
436 - --cxx="$(tc-getCXX)"
437 - --host-cc="$(tc-getBUILD_CC)"
438 - $(use_enable debug debug-info)
439 - $(use_enable debug debug-tcg)
440 - --enable-docs
441 - $(use_enable tci tcg-interpreter)
442 - $(use_enable xattr attr)
443 - )
444 -
445 - # Disable options not used by user targets. This simplifies building
446 - # static user targets (USE=static-user) considerably.
447 - conf_notuser() {
448 - if [[ ${buildtype} == "user" ]] ; then
449 - echo "--disable-${2:-$1}"
450 - else
451 - use_enable "$@"
452 - fi
453 - }
454 - conf_opts+=(
455 - $(conf_notuser accessibility brlapi)
456 - $(conf_notuser aio linux-aio)
457 - $(conf_notuser bzip2)
458 - $(conf_notuser bluetooth bluez)
459 - $(conf_notuser caps cap-ng)
460 - $(conf_notuser curl)
461 - $(conf_notuser fdt)
462 - $(conf_notuser glusterfs)
463 - $(conf_notuser gnutls)
464 - $(conf_notuser gnutls nettle)
465 - $(conf_notuser gtk)
466 - $(conf_notuser infiniband rdma)
467 - $(conf_notuser iscsi libiscsi)
468 - $(conf_notuser jpeg vnc-jpeg)
469 - $(conf_notuser kernel_linux kvm)
470 - $(conf_notuser lzo)
471 - $(conf_notuser ncurses curses)
472 - $(conf_notuser nfs libnfs)
473 - $(conf_notuser numa)
474 - $(conf_notuser opengl)
475 - $(conf_notuser png vnc-png)
476 - $(conf_notuser rbd)
477 - $(conf_notuser sasl vnc-sasl)
478 - $(conf_notuser sdl)
479 - $(conf_notuser seccomp)
480 - $(conf_notuser smartcard)
481 - $(conf_notuser snappy)
482 - $(conf_notuser spice)
483 - $(conf_notuser ssh libssh2)
484 - $(conf_notuser usb libusb)
485 - $(conf_notuser usbredir usb-redir)
486 - $(conf_notuser vde)
487 - $(conf_notuser vhost-net)
488 - $(conf_notuser virgl virglrenderer)
489 - $(conf_notuser virtfs)
490 - $(conf_notuser vnc)
491 - $(conf_notuser vte)
492 - $(conf_notuser xen)
493 - $(conf_notuser xen xen-pci-passthrough)
494 - $(conf_notuser xfs xfsctl)
495 - )
496 -
497 - if [[ ! ${buildtype} == "user" ]] ; then
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 - conf_opts+=(
504 - --audio-drv-list="${audio_opts}"
505 - )
506 - use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
507 - use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
508 - fi
509 -
510 - case ${buildtype} in
511 - user)
512 - conf_opts+=(
513 - --enable-linux-user
514 - --disable-system
515 - --disable-blobs
516 - --disable-tools
517 - )
518 - local static_flag="static-user"
519 - ;;
520 - softmmu)
521 - conf_opts+=(
522 - --disable-linux-user
523 - --enable-system
524 - --disable-tools
525 - --with-system-pixman
526 - )
527 - local static_flag="static"
528 - ;;
529 - tools)
530 - conf_opts+=(
531 - --disable-linux-user
532 - --disable-system
533 - --disable-blobs
534 - --enable-tools
535 - )
536 - local static_flag="static"
537 - ;;
538 - esac
539 -
540 - local targets="${buildtype}_targets"
541 - [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
542 -
543 - # Add support for SystemTAP
544 - use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
545 -
546 - # We always want to attempt to build with PIE support as it results
547 - # in a more secure binary. But it doesn't work with static or if
548 - # the current GCC doesn't have PIE support.
549 - if use ${static_flag}; then
550 - conf_opts+=( --static --disable-pie )
551 - else
552 - gcc-specs-pie && conf_opts+=( --enable-pie )
553 - fi
554 -
555 - echo "../configure ${conf_opts[*]}"
556 - cd "${builddir}"
557 - ../configure "${conf_opts[@]}" || die "configure failed"
558 -
559 - # FreeBSD's kernel does not support QEMU assigning/grabbing
560 - # host USB devices yet
561 - use kernel_FreeBSD && \
562 - sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
563 -}
564 -
565 -src_configure() {
566 - local target
567 -
568 - python_setup
569 -
570 - softmmu_targets= softmmu_bins=()
571 - user_targets= user_bins=()
572 -
573 - for target in ${IUSE_SOFTMMU_TARGETS} ; do
574 - if use "qemu_softmmu_targets_${target}"; then
575 - softmmu_targets+=",${target}-softmmu"
576 - softmmu_bins+=( "qemu-system-${target}" )
577 - fi
578 - done
579 -
580 - for target in ${IUSE_USER_TARGETS} ; do
581 - if use "qemu_user_targets_${target}"; then
582 - user_targets+=",${target}-linux-user"
583 - user_bins+=( "qemu-${target}" )
584 - fi
585 - done
586 -
587 - softmmu_targets=${softmmu_targets#,}
588 - user_targets=${user_targets#,}
589 -
590 - [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
591 - [[ -n ${user_targets} ]] && qemu_src_configure "user"
592 - qemu_src_configure "tools"
593 -}
594 -
595 -src_compile() {
596 - if [[ -n ${user_targets} ]]; then
597 - cd "${S}/user-build"
598 - default
599 - fi
600 -
601 - if [[ -n ${softmmu_targets} ]]; then
602 - cd "${S}/softmmu-build"
603 - default
604 - fi
605 -
606 - cd "${S}/tools-build"
607 - default
608 -}
609 -
610 -src_test() {
611 - if [[ -n ${softmmu_targets} ]]; then
612 - cd "${S}/softmmu-build"
613 - pax-mark m */qemu-system-* #515550
614 - emake -j1 check
615 - emake -j1 check-report.html
616 - fi
617 -}
618 -
619 -qemu_python_install() {
620 - python_domodule "${S}/scripts/qmp/qmp.py"
621 -
622 - python_doscript "${S}/scripts/kvm/vmxcap"
623 - python_doscript "${S}/scripts/qmp/qmp-shell"
624 - python_doscript "${S}/scripts/qmp/qemu-ga-client"
625 -}
626 -
627 -# Generate binfmt support files.
628 -# - /etc/init.d/qemu-binfmt script which registers the user handlers (openrc)
629 -# - /usr/share/qemu/binfmt.d/qemu.conf (for use with systemd-binfmt)
630 -generate_initd() {
631 - local out="${T}/qemu-binfmt"
632 - local out_systemd="${T}/qemu.conf"
633 - local d="${T}/binfmt.d"
634 -
635 - einfo "Generating qemu binfmt scripts and configuration files"
636 -
637 - # Generate the debian fragments first.
638 - mkdir -p "${d}"
639 - "${S}"/scripts/qemu-binfmt-conf.sh \
640 - --debian \
641 - --exportdir "${d}" \
642 - --qemu-path "${EPREFIX}/usr/bin" \
643 - || die
644 - # Then turn the fragments into a shell script we can source.
645 - sed -E -i \
646 - -e 's:^([^ ]+) (.*)$:\1="\2":' \
647 - "${d}"/* || die
648 -
649 - # Generate the init.d script by assembling the fragments from above.
650 - local f qcpu package interpreter magic mask
651 - cat "${FILESDIR}"/qemu-binfmt.initd.head >"${out}" || die
652 - for f in "${d}"/qemu-* ; do
653 - source "${f}"
654 -
655 - # Normalize the cpu logic like we do in the init.d for the native cpu.
656 - qcpu=${package#qemu-}
657 - case ${qcpu} in
658 - arm*) qcpu="arm";;
659 - mips*) qcpu="mips";;
660 - ppc*) qcpu="ppc";;
661 - s390*) qcpu="s390";;
662 - sh*) qcpu="sh";;
663 - sparc*) qcpu="sparc";;
664 - esac
665 -
666 - cat <<EOF >>"${out}"
667 - if [ "\${cpu}" != "${qcpu}" -a -x "${interpreter}" ] ; then
668 - echo ':${package}:M::${magic}:${mask}:${interpreter}:'"\${QEMU_BINFMT_FLAGS}" >/proc/sys/fs/binfmt_misc/register
669 - fi
670 -EOF
671 -
672 - echo ":${package}:M::${magic}:${mask}:${interpreter}:OC" >>"${out_systemd}"
673 -
674 - done
675 - cat "${FILESDIR}"/qemu-binfmt.initd.tail >>"${out}" || die
676 -}
677 -
678 -src_install() {
679 - if [[ -n ${user_targets} ]]; then
680 - cd "${S}/user-build"
681 - emake DESTDIR="${ED}" install
682 -
683 - # Install binfmt handler init script for user targets.
684 - generate_initd
685 - doinitd "${T}/qemu-binfmt"
686 -
687 - # Install binfmt/qemu.conf.
688 - insinto "/usr/share/qemu/binfmt.d"
689 - doins "${T}/qemu.conf"
690 - fi
691 -
692 - if [[ -n ${softmmu_targets} ]]; then
693 - cd "${S}/softmmu-build"
694 - emake DESTDIR="${ED}" install
695 -
696 - # This might not exist if the test failed. #512010
697 - [[ -e check-report.html ]] && dohtml check-report.html
698 -
699 - if use kernel_linux; then
700 - udev_newrules "${FILESDIR}"/65-kvm.rules-r1 65-kvm.rules
701 - fi
702 -
703 - if use python; then
704 - python_foreach_impl qemu_python_install
705 - fi
706 - fi
707 -
708 - cd "${S}/tools-build"
709 - emake DESTDIR="${ED}" install
710 -
711 - # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
712 - pushd "${ED}"/usr/bin >/dev/null
713 - pax-mark mr "${softmmu_bins[@]}" "${user_bins[@]}" # bug 575594
714 - popd >/dev/null
715 -
716 - # Install config file example for qemu-bridge-helper
717 - insinto "/etc/qemu"
718 - doins "${FILESDIR}/bridge.conf"
719 -
720 - # Remove the docdir placed qmp-commands.txt
721 - mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/" || die
722 -
723 - cd "${S}"
724 - dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
725 - newdoc pc-bios/README README.pc-bios
726 - dodoc docs/qmp-*.txt
727 -
728 - if [[ -n ${softmmu_targets} ]]; then
729 - # Remove SeaBIOS since we're using the SeaBIOS packaged one
730 - rm "${ED}/usr/share/qemu/bios.bin"
731 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
732 - dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
733 - fi
734 -
735 - # Remove vgabios since we're using the vgabios packaged one
736 - rm "${ED}/usr/share/qemu/vgabios.bin"
737 - rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
738 - rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
739 - rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
740 - rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
741 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
742 - dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
743 - dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
744 - dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
745 - dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
746 - dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
747 - fi
748 -
749 - # Remove sgabios since we're using the sgabios packaged one
750 - rm "${ED}/usr/share/qemu/sgabios.bin"
751 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
752 - dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
753 - fi
754 -
755 - # Remove iPXE since we're using the iPXE packaged one
756 - rm "${ED}"/usr/share/qemu/pxe-*.rom
757 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
758 - dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
759 - dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
760 - dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
761 - dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
762 - dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
763 - dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
764 - fi
765 - fi
766 -
767 - DISABLE_AUTOFORMATTING=true
768 - readme.gentoo_create_doc
769 -}
770 -
771 -pkg_postinst() {
772 - DISABLE_AUTOFORMATTING=true
773 - readme.gentoo_print_elog
774 -
775 - if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
776 - udev_reload
777 - fi
778 -
779 - fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
780 -}
781 -
782 -pkg_info() {
783 - echo "Using:"
784 - echo " $(best_version app-emulation/spice-protocol)"
785 - echo " $(best_version sys-firmware/ipxe)"
786 - echo " $(best_version sys-firmware/seabios)"
787 - if has_version 'sys-firmware/seabios[binary]'; then
788 - echo " USE=binary"
789 - else
790 - echo " USE=''"
791 - fi
792 - echo " $(best_version sys-firmware/vgabios)"
793 -}