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: Sun, 02 Oct 2016 01:52:35
Message-Id: 1475373121.3418efea4dcee08436ad5cbf5b2081661c443c00.tamiko@gentoo
1 commit: 3418efea4dcee08436ad5cbf5b2081661c443c00
2 Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
3 AuthorDate: Sun Oct 2 01:52:01 2016 +0000
4 Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
5 CommitDate: Sun Oct 2 01:52:01 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3418efea
7
8 app-emulation/qemu: drop vulnerable, bug #594368
9
10 Package-Manager: portage-2.3.0
11
12 app-emulation/qemu/qemu-2.7.0-r3.ebuild | 687 --------------------------------
13 1 file changed, 687 deletions(-)
14
15 diff --git a/app-emulation/qemu/qemu-2.7.0-r3.ebuild b/app-emulation/qemu/qemu-2.7.0-r3.ebuild
16 deleted file mode 100644
17 index c78e26c..00000000
18 --- a/app-emulation/qemu/qemu-2.7.0-r3.ebuild
19 +++ /dev/null
20 @@ -1,687 +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 -
367 - # Fix ld and objcopy being called directly
368 - tc-export AR LD OBJCOPY
369 -
370 - # Verbose builds
371 - MAKEOPTS+=" V=1"
372 -
373 - epatch_user
374 -
375 - # Run after we've applied all patches.
376 - handle_locales
377 -}
378 -
379 -##
380 -# configures qemu based on the build directory and the build type
381 -# we are using.
382 -#
383 -qemu_src_configure() {
384 - debug-print-function ${FUNCNAME} "$@"
385 -
386 - local buildtype=$1
387 - local builddir="${S}/${buildtype}-build"
388 - local static_flag="static-${buildtype}"
389 -
390 - mkdir "${builddir}"
391 -
392 - local conf_opts=(
393 - --prefix=/usr
394 - --sysconfdir=/etc
395 - --libdir=/usr/$(get_libdir)
396 - --docdir=/usr/share/doc/${PF}/html
397 - --disable-bsd-user
398 - --disable-guest-agent
399 - --disable-strip
400 - --disable-werror
401 - # We support gnutls/nettle for crypto operations. It is possible
402 - # to use gcrypt when gnutls/nettle are disabled (but not when they
403 - # are enabled), but it's not really worth the hassle. Disable it
404 - # all the time to avoid automatically detecting it. #568856
405 - --disable-gcrypt
406 - --python="${PYTHON}"
407 - --cc="$(tc-getCC)"
408 - --cxx="$(tc-getCXX)"
409 - --host-cc="$(tc-getBUILD_CC)"
410 - $(use_enable debug debug-info)
411 - $(use_enable debug debug-tcg)
412 - --enable-docs
413 - $(use_enable tci tcg-interpreter)
414 - $(use_enable xattr attr)
415 - )
416 -
417 - # Disable options not used by user targets as the default configure
418 - # options will autoprobe and try to link in a bunch of unused junk.
419 - conf_softmmu() {
420 - if [[ ${buildtype} == "user" ]] ; then
421 - echo "--disable-${2:-$1}"
422 - else
423 - use_enable "$@"
424 - fi
425 - }
426 - conf_opts+=(
427 - $(conf_softmmu accessibility brlapi)
428 - $(conf_softmmu aio linux-aio)
429 - $(conf_softmmu bzip2)
430 - $(conf_softmmu bluetooth bluez)
431 - $(conf_softmmu caps cap-ng)
432 - $(conf_softmmu curl)
433 - $(conf_softmmu fdt)
434 - $(conf_softmmu glusterfs)
435 - $(conf_softmmu gnutls)
436 - $(conf_softmmu gnutls nettle)
437 - $(conf_softmmu gtk)
438 - $(conf_softmmu infiniband rdma)
439 - $(conf_softmmu iscsi libiscsi)
440 - $(conf_softmmu jpeg vnc-jpeg)
441 - $(conf_softmmu kernel_linux kvm)
442 - $(conf_softmmu lzo)
443 - $(conf_softmmu ncurses curses)
444 - $(conf_softmmu nfs libnfs)
445 - $(conf_softmmu numa)
446 - $(conf_softmmu opengl)
447 - $(conf_softmmu png vnc-png)
448 - $(conf_softmmu rbd)
449 - $(conf_softmmu sasl vnc-sasl)
450 - $(conf_softmmu sdl)
451 - $(conf_softmmu seccomp)
452 - $(conf_softmmu smartcard)
453 - $(conf_softmmu snappy)
454 - $(conf_softmmu spice)
455 - $(conf_softmmu ssh libssh2)
456 - $(conf_softmmu usb libusb)
457 - $(conf_softmmu usbredir usb-redir)
458 - $(conf_softmmu uuid)
459 - $(conf_softmmu vde)
460 - $(conf_softmmu vhost-net)
461 - $(conf_softmmu virgl virglrenderer)
462 - $(conf_softmmu virtfs)
463 - $(conf_softmmu vnc)
464 - $(conf_softmmu vte)
465 - $(conf_softmmu xen)
466 - $(conf_softmmu xen xen-pci-passthrough)
467 - $(conf_softmmu xfs xfsctl)
468 - )
469 -
470 - case ${buildtype} in
471 - user)
472 - conf_opts+=(
473 - --enable-linux-user
474 - --disable-system
475 - --disable-blobs
476 - --disable-tools
477 - )
478 - ;;
479 - softmmu)
480 - # audio options
481 - local audio_opts="oss"
482 - use alsa && audio_opts="alsa,${audio_opts}"
483 - use sdl && audio_opts="sdl,${audio_opts}"
484 - use pulseaudio && audio_opts="pa,${audio_opts}"
485 -
486 - conf_opts+=(
487 - --disable-linux-user
488 - --enable-system
489 - --with-system-pixman
490 - --audio-drv-list="${audio_opts}"
491 - )
492 - use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
493 - use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
494 - ;;
495 - tools)
496 - conf_opts+=(
497 - --disable-linux-user
498 - --disable-system
499 - --disable-blobs
500 - $(use_enable bzip2)
501 - )
502 - static_flag="static"
503 - ;;
504 - esac
505 -
506 - local targets="${buildtype}_targets"
507 - [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
508 -
509 - # Add support for SystemTAP
510 - use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
511 -
512 - # We always want to attempt to build with PIE support as it results
513 - # in a more secure binary. But it doesn't work with static or if
514 - # the current GCC doesn't have PIE support.
515 - if use ${static_flag}; then
516 - conf_opts+=( --static --disable-pie )
517 - else
518 - gcc-specs-pie && conf_opts+=( --enable-pie )
519 - fi
520 -
521 - echo "../configure ${conf_opts[*]}"
522 - cd "${builddir}"
523 - ../configure "${conf_opts[@]}" || die "configure failed"
524 -
525 - # FreeBSD's kernel does not support QEMU assigning/grabbing
526 - # host USB devices yet
527 - use kernel_FreeBSD && \
528 - sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
529 -}
530 -
531 -src_configure() {
532 - local target
533 -
534 - python_setup
535 -
536 - softmmu_targets= softmmu_bins=()
537 - user_targets= user_bins=()
538 -
539 - for target in ${IUSE_SOFTMMU_TARGETS} ; do
540 - if use "qemu_softmmu_targets_${target}"; then
541 - softmmu_targets+=",${target}-softmmu"
542 - softmmu_bins+=( "qemu-system-${target}" )
543 - fi
544 - done
545 -
546 - for target in ${IUSE_USER_TARGETS} ; do
547 - if use "qemu_user_targets_${target}"; then
548 - user_targets+=",${target}-linux-user"
549 - user_bins+=( "qemu-${target}" )
550 - fi
551 - done
552 -
553 - softmmu_targets=${softmmu_targets#,}
554 - user_targets=${user_targets#,}
555 -
556 - [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
557 - [[ -n ${user_targets} ]] && qemu_src_configure "user"
558 - [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
559 -}
560 -
561 -src_compile() {
562 - if [[ -n ${user_targets} ]]; then
563 - cd "${S}/user-build"
564 - default
565 - fi
566 -
567 - if [[ -n ${softmmu_targets} ]]; then
568 - cd "${S}/softmmu-build"
569 - default
570 - fi
571 -
572 - if [[ -z ${softmmu_targets}${user_targets} ]]; then
573 - cd "${S}/tools-build"
574 - default
575 - fi
576 -}
577 -
578 -src_test() {
579 - if [[ -n ${softmmu_targets} ]]; then
580 - cd "${S}/softmmu-build"
581 - pax-mark m */qemu-system-* #515550
582 - emake -j1 check
583 - emake -j1 check-report.html
584 - fi
585 -}
586 -
587 -qemu_python_install() {
588 - python_domodule "${S}/scripts/qmp/qmp.py"
589 -
590 - python_doscript "${S}/scripts/kvm/vmxcap"
591 - python_doscript "${S}/scripts/qmp/qmp-shell"
592 - python_doscript "${S}/scripts/qmp/qemu-ga-client"
593 -}
594 -
595 -src_install() {
596 - if [[ -n ${user_targets} ]]; then
597 - cd "${S}/user-build"
598 - emake DESTDIR="${ED}" install
599 -
600 - # Install binfmt handler init script for user targets
601 - newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
602 - fi
603 -
604 - if [[ -n ${softmmu_targets} ]]; then
605 - cd "${S}/softmmu-build"
606 - emake DESTDIR="${ED}" install
607 -
608 - # This might not exist if the test failed. #512010
609 - [[ -e check-report.html ]] && dohtml check-report.html
610 -
611 - if use kernel_linux; then
612 - udev_dorules "${FILESDIR}"/65-kvm.rules
613 - fi
614 -
615 - if use python; then
616 - python_foreach_impl qemu_python_install
617 - fi
618 - fi
619 -
620 - if [[ -z ${softmmu_targets}${user_targets} ]]; then
621 - cd "${S}/tools-build"
622 - emake DESTDIR="${ED}" install
623 - fi
624 -
625 - # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
626 - pushd "${ED}"/usr/bin >/dev/null
627 - pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
628 - popd >/dev/null
629 -
630 - # Install config file example for qemu-bridge-helper
631 - insinto "/etc/qemu"
632 - doins "${FILESDIR}/bridge.conf"
633 -
634 - # Remove the docdir placed qmp-commands.txt
635 - mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/" || die
636 -
637 - cd "${S}"
638 - dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
639 - newdoc pc-bios/README README.pc-bios
640 - dodoc docs/qmp-*.txt
641 -
642 - if [[ -n ${softmmu_targets} ]]; then
643 - # Remove SeaBIOS since we're using the SeaBIOS packaged one
644 - rm "${ED}/usr/share/qemu/bios.bin"
645 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
646 - dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
647 - fi
648 -
649 - # Remove vgabios since we're using the vgabios packaged one
650 - rm "${ED}/usr/share/qemu/vgabios.bin"
651 - rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
652 - rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
653 - rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
654 - rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
655 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
656 - dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
657 - dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
658 - dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
659 - dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
660 - dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
661 - fi
662 -
663 - # Remove sgabios since we're using the sgabios packaged one
664 - rm "${ED}/usr/share/qemu/sgabios.bin"
665 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
666 - dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
667 - fi
668 -
669 - # Remove iPXE since we're using the iPXE packaged one
670 - rm "${ED}"/usr/share/qemu/pxe-*.rom
671 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
672 - dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
673 - dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
674 - dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
675 - dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
676 - dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
677 - dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
678 - fi
679 - fi
680 -
681 - qemu_support_kvm && readme.gentoo_create_doc
682 -}
683 -
684 -pkg_postinst() {
685 - if qemu_support_kvm; then
686 - readme.gentoo_print_elog
687 - fi
688 -
689 - if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
690 - udev_reload
691 - fi
692 -
693 - fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
694 -}
695 -
696 -pkg_info() {
697 - echo "Using:"
698 - echo " $(best_version app-emulation/spice-protocol)"
699 - echo " $(best_version sys-firmware/ipxe)"
700 - echo " $(best_version sys-firmware/seabios)"
701 - if has_version 'sys-firmware/seabios[binary]'; then
702 - echo " USE=binary"
703 - else
704 - echo " USE=''"
705 - fi
706 - echo " $(best_version sys-firmware/vgabios)"
707 -}