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