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