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