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