Gentoo Archives: gentoo-commits

From: Matthias Maier <tamiko@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/
Date: Mon, 26 Sep 2016 00:15:56
Message-Id: 1474848920.4dd281902e043e8e8299cf9991aa4841076ae66b.tamiko@gentoo
1 commit: 4dd281902e043e8e8299cf9991aa4841076ae66b
2 Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
3 AuthorDate: Mon Sep 26 00:15:20 2016 +0000
4 Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
5 CommitDate: Mon Sep 26 00:15:20 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4dd28190
7
8 app-emulation/qemu: drop vulnerable versions 2.7.0, 2.7.0-r2
9
10 Package-Manager: portage-2.2.28
11
12 app-emulation/qemu/qemu-2.7.0-r2.ebuild | 685 --------------------------------
13 app-emulation/qemu/qemu-2.7.0.ebuild | 678 -------------------------------
14 2 files changed, 1363 deletions(-)
15
16 diff --git a/app-emulation/qemu/qemu-2.7.0-r2.ebuild b/app-emulation/qemu/qemu-2.7.0-r2.ebuild
17 deleted file mode 100644
18 index d71e077..00000000
19 --- a/app-emulation/qemu/qemu-2.7.0-r2.ebuild
20 +++ /dev/null
21 @@ -1,685 +0,0 @@
22 -# Copyright 1999-2016 Gentoo Foundation
23 -# Distributed under the terms of the GNU General Public License v2
24 -# $Id$
25 -
26 -EAPI="5"
27 -
28 -PYTHON_COMPAT=( python2_7 )
29 -PYTHON_REQ_USE="ncurses,readline"
30 -
31 -PLOCALES="bg de_DE fr_FR hu it tr zh_CN"
32 -
33 -inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
34 - user udev fcaps readme.gentoo pax-utils l10n
35 -
36 -if [[ ${PV} = *9999* ]]; then
37 - EGIT_REPO_URI="git://git.qemu.org/qemu.git"
38 - inherit git-2
39 - SRC_URI=""
40 -else
41 - SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2"
42 - KEYWORDS="amd64 ~arm64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
43 -fi
44 -
45 -DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
46 -HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
47 -
48 -LICENSE="GPL-2 LGPL-2 BSD-2"
49 -SLOT="0"
50 -IUSE="accessibility +aio alsa bluetooth bzip2 +caps +curl debug +fdt glusterfs \
51 -gnutls gtk gtk2 infiniband iscsi +jpeg \
52 -kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
53 -+png pulseaudio python \
54 -rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
55 -static-user systemtap tci test +threads usb usbredir +uuid vde +vhost-net \
56 -virgl virtfs +vnc vte xattr xen xfs"
57 -
58 -COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
59 -mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
60 -x86_64"
61 -IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
62 -IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus tilegx"
63 -
64 -use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
65 -use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
66 -IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
67 -
68 -# Allow no targets to be built so that people can get a tools-only build.
69 -# Block USE flag configurations known to not work.
70 -REQUIRED_USE="${PYTHON_REQUIRED_USE}
71 - gtk2? ( gtk )
72 - qemu_softmmu_targets_arm? ( fdt )
73 - qemu_softmmu_targets_microblaze? ( fdt )
74 - qemu_softmmu_targets_ppc? ( fdt )
75 - qemu_softmmu_targets_ppc64? ( fdt )
76 - sdl2? ( sdl )
77 - static? ( static-softmmu static-user )
78 - static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
79 - virtfs? ( xattr )
80 - vte? ( gtk )"
81 -
82 -# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
83 -#
84 -# The attr lib isn't always linked in (although the USE flag is always
85 -# respected). This is because qemu supports using the C library's API
86 -# when available rather than always using the extranl library.
87 -#
88 -# Older versions of gnutls are supported, but it's simpler to just require
89 -# the latest versions. This is also why we require nettle.
90 -#
91 -# TODO: Split out tools deps into another var. e.g. bzip2 is only used by
92 -# system binaries and tools, not user binaries.
93 -COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
94 - dev-libs/libpcre[static-libs(+)]
95 - sys-libs/zlib[static-libs(+)]
96 - bzip2? ( app-arch/bzip2[static-libs(+)] )
97 - xattr? ( sys-apps/attr[static-libs(+)] )"
98 -SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
99 - >=x11-libs/pixman-0.28.0[static-libs(+)]
100 - accessibility? ( app-accessibility/brltty[static-libs(+)] )
101 - aio? ( dev-libs/libaio[static-libs(+)] )
102 - alsa? ( >=media-libs/alsa-lib-1.0.13 )
103 - bluetooth? ( net-wireless/bluez )
104 - caps? ( sys-libs/libcap-ng[static-libs(+)] )
105 - curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
106 - fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
107 - glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
108 - gnutls? (
109 - dev-libs/nettle:=[static-libs(+)]
110 - >=net-libs/gnutls-3.0:=[static-libs(+)]
111 - )
112 - gtk? (
113 - gtk2? (
114 - x11-libs/gtk+:2
115 - vte? ( x11-libs/vte:0 )
116 - )
117 - !gtk2? (
118 - x11-libs/gtk+:3
119 - vte? ( x11-libs/vte:2.90 )
120 - )
121 - )
122 - infiniband? ( sys-fabric/librdmacm:=[static-libs(+)] )
123 - iscsi? ( net-libs/libiscsi )
124 - jpeg? ( virtual/jpeg:0=[static-libs(+)] )
125 - lzo? ( dev-libs/lzo:2[static-libs(+)] )
126 - ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
127 - nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
128 - numa? ( sys-process/numactl[static-libs(+)] )
129 - opengl? (
130 - virtual/opengl
131 - media-libs/libepoxy[static-libs(+)]
132 - media-libs/mesa[static-libs(+)]
133 - media-libs/mesa[egl,gles2]
134 - )
135 - png? ( media-libs/libpng:0=[static-libs(+)] )
136 - pulseaudio? ( media-sound/pulseaudio )
137 - rbd? ( sys-cluster/ceph[static-libs(+)] )
138 - sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
139 - sdl? (
140 - !sdl2? (
141 - media-libs/libsdl[X]
142 - >=media-libs/libsdl-1.2.11[static-libs(+)]
143 - )
144 - sdl2? (
145 - media-libs/libsdl2[X]
146 - media-libs/libsdl2[static-libs(+)]
147 - )
148 - )
149 - seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
150 - smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
151 - snappy? ( app-arch/snappy[static-libs(+)] )
152 - spice? (
153 - >=app-emulation/spice-protocol-0.12.3
154 - >=app-emulation/spice-0.12.0[static-libs(+)]
155 - )
156 - ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
157 - usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
158 - usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
159 - uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
160 - vde? ( net-misc/vde[static-libs(+)] )
161 - virgl? ( media-libs/virglrenderer[static-libs(+)] )
162 - virtfs? ( sys-libs/libcap )
163 - xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
164 -USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
165 -X86_FIRMWARE_DEPEND="
166 - >=sys-firmware/ipxe-1.0.0_p20130624
167 - pin-upstream-blobs? (
168 - ~sys-firmware/seabios-1.8.2
169 - ~sys-firmware/sgabios-0.1_pre8
170 - ~sys-firmware/vgabios-0.7a
171 - )
172 - !pin-upstream-blobs? (
173 - sys-firmware/seabios
174 - sys-firmware/sgabios
175 - sys-firmware/vgabios
176 - )"
177 -CDEPEND="
178 - !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
179 - !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
180 - qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
181 - qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
182 - python? ( ${PYTHON_DEPS} )
183 - systemtap? ( dev-util/systemtap )
184 - xen? ( app-emulation/xen-tools:= )"
185 -DEPEND="${CDEPEND}
186 - dev-lang/perl
187 - =dev-lang/python-2*
188 - sys-apps/texinfo
189 - virtual/pkgconfig
190 - kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
191 - gtk? ( nls? ( sys-devel/gettext ) )
192 - static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
193 - static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
194 - test? (
195 - dev-libs/glib[utils]
196 - sys-devel/bc
197 - )"
198 -RDEPEND="${CDEPEND}
199 - selinux? ( sec-policy/selinux-qemu )
200 -"
201 -
202 -STRIP_MASK="/usr/share/qemu/palcode-clipper"
203 -
204 -QA_PREBUILT="
205 - usr/share/qemu/openbios-ppc
206 - usr/share/qemu/openbios-sparc64
207 - usr/share/qemu/openbios-sparc32
208 - usr/share/qemu/palcode-clipper
209 - usr/share/qemu/s390-ccw.img
210 - usr/share/qemu/u-boot.e500
211 -"
212 -
213 -QA_WX_LOAD="usr/bin/qemu-i386
214 - usr/bin/qemu-x86_64
215 - usr/bin/qemu-alpha
216 - usr/bin/qemu-arm
217 - usr/bin/qemu-cris
218 - usr/bin/qemu-m68k
219 - usr/bin/qemu-microblaze
220 - usr/bin/qemu-microblazeel
221 - usr/bin/qemu-mips
222 - usr/bin/qemu-mipsel
223 - usr/bin/qemu-or32
224 - usr/bin/qemu-ppc
225 - usr/bin/qemu-ppc64
226 - usr/bin/qemu-ppc64abi32
227 - usr/bin/qemu-sh4
228 - usr/bin/qemu-sh4eb
229 - usr/bin/qemu-sparc
230 - usr/bin/qemu-sparc64
231 - usr/bin/qemu-armeb
232 - usr/bin/qemu-sparc32plus
233 - usr/bin/qemu-s390x
234 - usr/bin/qemu-unicore32"
235 -
236 -DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
237 -you have the kernel module loaded before running kvm. The easiest way to
238 -ensure that the kernel module is loaded is to load it on boot.\n
239 -For AMD CPUs the module is called 'kvm-amd'.\n
240 -For Intel CPUs the module is called 'kvm-intel'.\n
241 -Please review /etc/conf.d/modules for how to load these.\n\n
242 -Make sure your user is in the 'kvm' group\n
243 -Just run 'gpasswd -a <USER> kvm', then have <USER> re-login.\n\n
244 -For brand new installs, the default permissions on /dev/kvm might not let you
245 -access it. You can tell udev to reset ownership/perms:\n
246 -udevadm trigger -c add /dev/kvm"
247 -
248 -qemu_support_kvm() {
249 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
250 - use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
251 - use qemu_softmmu_targets_s390x; then
252 - return 0
253 - fi
254 -
255 - return 1
256 -}
257 -
258 -pkg_pretend() {
259 - if use kernel_linux && kernel_is lt 2 6 25; then
260 - eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
261 - elif use kernel_linux; then
262 - if ! linux_config_exists; then
263 - eerror "Unable to check your kernel for KVM support"
264 - else
265 - CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
266 - ERROR_KVM="You must enable KVM in your kernel to continue"
267 - ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
268 - ERROR_KVM_AMD+=" your kernel configuration."
269 - ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
270 - ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
271 - ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
272 - ERROR_TUN+=" into your kernel or loaded as a module to use the"
273 - ERROR_TUN+=" virtual network device if using -net tap."
274 - ERROR_BRIDGE="You will also need support for 802.1d"
275 - ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
276 - use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
277 - ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
278 - ERROR_VHOST_NET+=" support"
279 -
280 - if use amd64 || use x86 || use amd64-linux || use x86-linux; then
281 - CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
282 - fi
283 -
284 - use python && CONFIG_CHECK+=" ~DEBUG_FS"
285 - ERROR_DEBUG_FS="debugFS support required for kvm_stat"
286 -
287 - # Now do the actual checks setup above
288 - check_extra_config
289 - fi
290 - fi
291 -
292 - if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
293 - eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
294 - eerror "instances are still pointing to it. Please update your"
295 - eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
296 - eerror "and the right system binary (e.g. qemu-system-x86_64)."
297 - die "update your virt configs to not use qemu-kvm"
298 - fi
299 -}
300 -
301 -pkg_setup() {
302 - enewgroup kvm 78
303 -}
304 -
305 -# Sanity check to make sure target lists are kept up-to-date.
306 -check_targets() {
307 - local var=$1 mak=$2
308 - local detected sorted
309 -
310 - pushd "${S}"/default-configs >/dev/null || die
311 -
312 - # Force C locale until glibc is updated. #564936
313 - detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
314 - sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
315 - if [[ ${sorted} != "${detected}" ]] ; then
316 - eerror "The ebuild needs to be kept in sync."
317 - eerror "${var}: ${sorted}"
318 - eerror "$(printf '%-*s' ${#var} configure): ${detected}"
319 - die "sync ${var} to the list of targets"
320 - fi
321 -
322 - popd >/dev/null
323 -}
324 -
325 -handle_locales() {
326 - # Make sure locale list is kept up-to-date.
327 - local detected sorted
328 - detected=$(echo $(cd po && printf '%s\n' *.po | grep -v messages.po | sed 's:.po$::' | sort -u))
329 - sorted=$(echo $(printf '%s\n' ${PLOCALES} | sort -u))
330 - if [[ ${sorted} != "${detected}" ]] ; then
331 - eerror "The ebuild needs to be kept in sync."
332 - eerror "PLOCALES: ${sorted}"
333 - eerror " po/*.po: ${detected}"
334 - die "sync PLOCALES"
335 - fi
336 -
337 - # Deal with selective install of locales.
338 - if use nls ; then
339 - # Delete locales the user does not want. #577814
340 - rm_loc() { rm po/$1.po || die; }
341 - l10n_for_each_disabled_locale_do rm_loc
342 - else
343 - # Cheap hack to disable gettext .mo generation.
344 - rm -f po/*.po
345 - fi
346 -}
347 -
348 -src_prepare() {
349 - check_targets IUSE_SOFTMMU_TARGETS softmmu
350 - check_targets IUSE_USER_TARGETS linux-user
351 -
352 - # Alter target makefiles to accept CFLAGS set via flag-o
353 - sed -i -r \
354 - -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
355 - Makefile Makefile.target || die
356 -
357 - epatch "${FILESDIR}"/${PN}-2.5.0-cflags.patch
358 - epatch "${FILESDIR}"/${PN}-2.5.0-sysmacros.patch
359 - epatch "${FILESDIR}"/${P}-CVE-2016-6836.patch # bug 591242
360 - epatch "${FILESDIR}"/${P}-CVE-2016-7155.patch # bug 593034
361 - epatch "${FILESDIR}"/${P}-CVE-2016-7156.patch # bug 593036
362 - epatch "${FILESDIR}"/${P}-CVE-2016-7157-1.patch # bug 593038
363 - epatch "${FILESDIR}"/${P}-CVE-2016-7157-2.patch # bug 593038
364 - epatch "${FILESDIR}"/${P}-CVE-2016-7170.patch # bug 593284
365 -
366 - # Fix ld and objcopy being called directly
367 - tc-export AR LD OBJCOPY
368 -
369 - # Verbose builds
370 - MAKEOPTS+=" V=1"
371 -
372 - epatch_user
373 -
374 - # Run after we've applied all patches.
375 - handle_locales
376 -}
377 -
378 -##
379 -# configures qemu based on the build directory and the build type
380 -# we are using.
381 -#
382 -qemu_src_configure() {
383 - debug-print-function ${FUNCNAME} "$@"
384 -
385 - local buildtype=$1
386 - local builddir="${S}/${buildtype}-build"
387 - local static_flag="static-${buildtype}"
388 -
389 - mkdir "${builddir}"
390 -
391 - local conf_opts=(
392 - --prefix=/usr
393 - --sysconfdir=/etc
394 - --libdir=/usr/$(get_libdir)
395 - --docdir=/usr/share/doc/${PF}/html
396 - --disable-bsd-user
397 - --disable-guest-agent
398 - --disable-strip
399 - --disable-werror
400 - # We support gnutls/nettle for crypto operations. It is possible
401 - # to use gcrypt when gnutls/nettle are disabled (but not when they
402 - # are enabled), but it's not really worth the hassle. Disable it
403 - # all the time to avoid automatically detecting it. #568856
404 - --disable-gcrypt
405 - --python="${PYTHON}"
406 - --cc="$(tc-getCC)"
407 - --cxx="$(tc-getCXX)"
408 - --host-cc="$(tc-getBUILD_CC)"
409 - $(use_enable debug debug-info)
410 - $(use_enable debug debug-tcg)
411 - --enable-docs
412 - $(use_enable tci tcg-interpreter)
413 - $(use_enable xattr attr)
414 - )
415 -
416 - # Disable options not used by user targets as the default configure
417 - # options will autoprobe and try to link in a bunch of unused junk.
418 - conf_softmmu() {
419 - if [[ ${buildtype} == "user" ]] ; then
420 - echo "--disable-${2:-$1}"
421 - else
422 - use_enable "$@"
423 - fi
424 - }
425 - conf_opts+=(
426 - $(conf_softmmu accessibility brlapi)
427 - $(conf_softmmu aio linux-aio)
428 - $(conf_softmmu bzip2)
429 - $(conf_softmmu bluetooth bluez)
430 - $(conf_softmmu caps cap-ng)
431 - $(conf_softmmu curl)
432 - $(conf_softmmu fdt)
433 - $(conf_softmmu glusterfs)
434 - $(conf_softmmu gnutls)
435 - $(conf_softmmu gnutls nettle)
436 - $(conf_softmmu gtk)
437 - $(conf_softmmu infiniband rdma)
438 - $(conf_softmmu iscsi libiscsi)
439 - $(conf_softmmu jpeg vnc-jpeg)
440 - $(conf_softmmu kernel_linux kvm)
441 - $(conf_softmmu lzo)
442 - $(conf_softmmu ncurses curses)
443 - $(conf_softmmu nfs libnfs)
444 - $(conf_softmmu numa)
445 - $(conf_softmmu opengl)
446 - $(conf_softmmu png vnc-png)
447 - $(conf_softmmu rbd)
448 - $(conf_softmmu sasl vnc-sasl)
449 - $(conf_softmmu sdl)
450 - $(conf_softmmu seccomp)
451 - $(conf_softmmu smartcard)
452 - $(conf_softmmu snappy)
453 - $(conf_softmmu spice)
454 - $(conf_softmmu ssh libssh2)
455 - $(conf_softmmu usb libusb)
456 - $(conf_softmmu usbredir usb-redir)
457 - $(conf_softmmu uuid)
458 - $(conf_softmmu vde)
459 - $(conf_softmmu vhost-net)
460 - $(conf_softmmu virgl virglrenderer)
461 - $(conf_softmmu virtfs)
462 - $(conf_softmmu vnc)
463 - $(conf_softmmu vte)
464 - $(conf_softmmu xen)
465 - $(conf_softmmu xen xen-pci-passthrough)
466 - $(conf_softmmu xfs xfsctl)
467 - )
468 -
469 - case ${buildtype} in
470 - user)
471 - conf_opts+=(
472 - --enable-linux-user
473 - --disable-system
474 - --disable-blobs
475 - --disable-tools
476 - )
477 - ;;
478 - softmmu)
479 - # audio options
480 - local audio_opts="oss"
481 - use alsa && audio_opts="alsa,${audio_opts}"
482 - use sdl && audio_opts="sdl,${audio_opts}"
483 - use pulseaudio && audio_opts="pa,${audio_opts}"
484 -
485 - conf_opts+=(
486 - --disable-linux-user
487 - --enable-system
488 - --with-system-pixman
489 - --audio-drv-list="${audio_opts}"
490 - )
491 - use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
492 - use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
493 - ;;
494 - tools)
495 - conf_opts+=(
496 - --disable-linux-user
497 - --disable-system
498 - --disable-blobs
499 - $(use_enable bzip2)
500 - )
501 - static_flag="static"
502 - ;;
503 - esac
504 -
505 - local targets="${buildtype}_targets"
506 - [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
507 -
508 - # Add support for SystemTAP
509 - use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
510 -
511 - # We always want to attempt to build with PIE support as it results
512 - # in a more secure binary. But it doesn't work with static or if
513 - # the current GCC doesn't have PIE support.
514 - if use ${static_flag}; then
515 - conf_opts+=( --static --disable-pie )
516 - else
517 - gcc-specs-pie && conf_opts+=( --enable-pie )
518 - fi
519 -
520 - echo "../configure ${conf_opts[*]}"
521 - cd "${builddir}"
522 - ../configure "${conf_opts[@]}" || die "configure failed"
523 -
524 - # FreeBSD's kernel does not support QEMU assigning/grabbing
525 - # host USB devices yet
526 - use kernel_FreeBSD && \
527 - sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
528 -}
529 -
530 -src_configure() {
531 - local target
532 -
533 - python_setup
534 -
535 - softmmu_targets= softmmu_bins=()
536 - user_targets= user_bins=()
537 -
538 - for target in ${IUSE_SOFTMMU_TARGETS} ; do
539 - if use "qemu_softmmu_targets_${target}"; then
540 - softmmu_targets+=",${target}-softmmu"
541 - softmmu_bins+=( "qemu-system-${target}" )
542 - fi
543 - done
544 -
545 - for target in ${IUSE_USER_TARGETS} ; do
546 - if use "qemu_user_targets_${target}"; then
547 - user_targets+=",${target}-linux-user"
548 - user_bins+=( "qemu-${target}" )
549 - fi
550 - done
551 -
552 - softmmu_targets=${softmmu_targets#,}
553 - user_targets=${user_targets#,}
554 -
555 - [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
556 - [[ -n ${user_targets} ]] && qemu_src_configure "user"
557 - [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
558 -}
559 -
560 -src_compile() {
561 - if [[ -n ${user_targets} ]]; then
562 - cd "${S}/user-build"
563 - default
564 - fi
565 -
566 - if [[ -n ${softmmu_targets} ]]; then
567 - cd "${S}/softmmu-build"
568 - default
569 - fi
570 -
571 - if [[ -z ${softmmu_targets}${user_targets} ]]; then
572 - cd "${S}/tools-build"
573 - default
574 - fi
575 -}
576 -
577 -src_test() {
578 - if [[ -n ${softmmu_targets} ]]; then
579 - cd "${S}/softmmu-build"
580 - pax-mark m */qemu-system-* #515550
581 - emake -j1 check
582 - emake -j1 check-report.html
583 - fi
584 -}
585 -
586 -qemu_python_install() {
587 - python_domodule "${S}/scripts/qmp/qmp.py"
588 -
589 - python_doscript "${S}/scripts/kvm/vmxcap"
590 - python_doscript "${S}/scripts/qmp/qmp-shell"
591 - python_doscript "${S}/scripts/qmp/qemu-ga-client"
592 -}
593 -
594 -src_install() {
595 - if [[ -n ${user_targets} ]]; then
596 - cd "${S}/user-build"
597 - emake DESTDIR="${ED}" install
598 -
599 - # Install binfmt handler init script for user targets
600 - newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
601 - fi
602 -
603 - if [[ -n ${softmmu_targets} ]]; then
604 - cd "${S}/softmmu-build"
605 - emake DESTDIR="${ED}" install
606 -
607 - # This might not exist if the test failed. #512010
608 - [[ -e check-report.html ]] && dohtml check-report.html
609 -
610 - if use kernel_linux; then
611 - udev_dorules "${FILESDIR}"/65-kvm.rules
612 - fi
613 -
614 - if use python; then
615 - python_foreach_impl qemu_python_install
616 - fi
617 - fi
618 -
619 - if [[ -z ${softmmu_targets}${user_targets} ]]; then
620 - cd "${S}/tools-build"
621 - emake DESTDIR="${ED}" install
622 - fi
623 -
624 - # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
625 - pushd "${ED}"/usr/bin >/dev/null
626 - pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
627 - popd >/dev/null
628 -
629 - # Install config file example for qemu-bridge-helper
630 - insinto "/etc/qemu"
631 - doins "${FILESDIR}/bridge.conf"
632 -
633 - # Remove the docdir placed qmp-commands.txt
634 - mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/" || die
635 -
636 - cd "${S}"
637 - dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
638 - newdoc pc-bios/README README.pc-bios
639 - dodoc docs/qmp-*.txt
640 -
641 - if [[ -n ${softmmu_targets} ]]; then
642 - # Remove SeaBIOS since we're using the SeaBIOS packaged one
643 - rm "${ED}/usr/share/qemu/bios.bin"
644 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
645 - dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
646 - fi
647 -
648 - # Remove vgabios since we're using the vgabios packaged one
649 - rm "${ED}/usr/share/qemu/vgabios.bin"
650 - rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
651 - rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
652 - rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
653 - rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
654 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
655 - dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
656 - dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
657 - dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
658 - dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
659 - dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
660 - fi
661 -
662 - # Remove sgabios since we're using the sgabios packaged one
663 - rm "${ED}/usr/share/qemu/sgabios.bin"
664 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
665 - dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
666 - fi
667 -
668 - # Remove iPXE since we're using the iPXE packaged one
669 - rm "${ED}"/usr/share/qemu/pxe-*.rom
670 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
671 - dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
672 - dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
673 - dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
674 - dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
675 - dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
676 - dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
677 - fi
678 - fi
679 -
680 - qemu_support_kvm && readme.gentoo_create_doc
681 -}
682 -
683 -pkg_postinst() {
684 - if qemu_support_kvm; then
685 - readme.gentoo_print_elog
686 - fi
687 -
688 - if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
689 - udev_reload
690 - fi
691 -
692 - fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
693 -}
694 -
695 -pkg_info() {
696 - echo "Using:"
697 - echo " $(best_version app-emulation/spice-protocol)"
698 - echo " $(best_version sys-firmware/ipxe)"
699 - echo " $(best_version sys-firmware/seabios)"
700 - if has_version 'sys-firmware/seabios[binary]'; then
701 - echo " USE=binary"
702 - else
703 - echo " USE=''"
704 - fi
705 - echo " $(best_version sys-firmware/vgabios)"
706 -}
707
708 diff --git a/app-emulation/qemu/qemu-2.7.0.ebuild b/app-emulation/qemu/qemu-2.7.0.ebuild
709 deleted file mode 100644
710 index 98ee886..00000000
711 --- a/app-emulation/qemu/qemu-2.7.0.ebuild
712 +++ /dev/null
713 @@ -1,678 +0,0 @@
714 -# Copyright 1999-2016 Gentoo Foundation
715 -# Distributed under the terms of the GNU General Public License v2
716 -# $Id$
717 -
718 -EAPI="5"
719 -
720 -PYTHON_COMPAT=( python2_7 )
721 -PYTHON_REQ_USE="ncurses,readline"
722 -
723 -PLOCALES="bg de_DE fr_FR hu it tr zh_CN"
724 -
725 -inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
726 - user udev fcaps readme.gentoo pax-utils l10n
727 -
728 -if [[ ${PV} = *9999* ]]; then
729 - EGIT_REPO_URI="git://git.qemu.org/qemu.git"
730 - inherit git-2
731 - SRC_URI=""
732 -else
733 - SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2"
734 - KEYWORDS="amd64 ~arm64 ~ppc ~ppc64 x86 ~x86-fbsd"
735 -fi
736 -
737 -DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
738 -HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
739 -
740 -LICENSE="GPL-2 LGPL-2 BSD-2"
741 -SLOT="0"
742 -IUSE="accessibility +aio alsa bluetooth bzip2 +caps +curl debug +fdt glusterfs \
743 -gnutls gtk gtk2 infiniband iscsi +jpeg \
744 -kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
745 -+png pulseaudio python \
746 -rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
747 -static-user systemtap tci test +threads usb usbredir +uuid vde +vhost-net \
748 -virgl virtfs +vnc vte xattr xen xfs"
749 -
750 -COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
751 -mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
752 -x86_64"
753 -IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
754 -IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus tilegx"
755 -
756 -use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
757 -use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
758 -IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
759 -
760 -# Allow no targets to be built so that people can get a tools-only build.
761 -# Block USE flag configurations known to not work.
762 -REQUIRED_USE="${PYTHON_REQUIRED_USE}
763 - gtk2? ( gtk )
764 - qemu_softmmu_targets_arm? ( fdt )
765 - qemu_softmmu_targets_microblaze? ( fdt )
766 - qemu_softmmu_targets_ppc? ( fdt )
767 - qemu_softmmu_targets_ppc64? ( fdt )
768 - sdl2? ( sdl )
769 - static? ( static-softmmu static-user )
770 - static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
771 - virtfs? ( xattr )
772 - vte? ( gtk )"
773 -
774 -# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
775 -#
776 -# The attr lib isn't always linked in (although the USE flag is always
777 -# respected). This is because qemu supports using the C library's API
778 -# when available rather than always using the extranl library.
779 -#
780 -# Older versions of gnutls are supported, but it's simpler to just require
781 -# the latest versions. This is also why we require nettle.
782 -#
783 -# TODO: Split out tools deps into another var. e.g. bzip2 is only used by
784 -# system binaries and tools, not user binaries.
785 -COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
786 - sys-libs/zlib[static-libs(+)]
787 - bzip2? ( app-arch/bzip2[static-libs(+)] )
788 - xattr? ( sys-apps/attr[static-libs(+)] )"
789 -SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
790 - >=x11-libs/pixman-0.28.0[static-libs(+)]
791 - accessibility? ( app-accessibility/brltty[static-libs(+)] )
792 - aio? ( dev-libs/libaio[static-libs(+)] )
793 - alsa? ( >=media-libs/alsa-lib-1.0.13 )
794 - bluetooth? ( net-wireless/bluez )
795 - caps? ( sys-libs/libcap-ng[static-libs(+)] )
796 - curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
797 - fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
798 - glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
799 - gnutls? (
800 - dev-libs/nettle:=[static-libs(+)]
801 - >=net-libs/gnutls-3.0:=[static-libs(+)]
802 - )
803 - gtk? (
804 - gtk2? (
805 - x11-libs/gtk+:2
806 - vte? ( x11-libs/vte:0 )
807 - )
808 - !gtk2? (
809 - x11-libs/gtk+:3
810 - vte? ( x11-libs/vte:2.90 )
811 - )
812 - )
813 - infiniband? ( sys-fabric/librdmacm:=[static-libs(+)] )
814 - iscsi? ( net-libs/libiscsi )
815 - jpeg? ( virtual/jpeg:0=[static-libs(+)] )
816 - lzo? ( dev-libs/lzo:2[static-libs(+)] )
817 - ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
818 - nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
819 - numa? ( sys-process/numactl[static-libs(+)] )
820 - opengl? (
821 - virtual/opengl
822 - media-libs/libepoxy[static-libs(+)]
823 - media-libs/mesa[static-libs(+)]
824 - media-libs/mesa[egl,gles2]
825 - )
826 - png? ( media-libs/libpng:0=[static-libs(+)] )
827 - pulseaudio? ( media-sound/pulseaudio )
828 - rbd? ( sys-cluster/ceph[static-libs(+)] )
829 - sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
830 - sdl? (
831 - !sdl2? (
832 - media-libs/libsdl[X]
833 - >=media-libs/libsdl-1.2.11[static-libs(+)]
834 - )
835 - sdl2? (
836 - media-libs/libsdl2[X]
837 - media-libs/libsdl2[static-libs(+)]
838 - )
839 - )
840 - seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
841 - smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
842 - snappy? ( app-arch/snappy[static-libs(+)] )
843 - spice? (
844 - >=app-emulation/spice-protocol-0.12.3
845 - >=app-emulation/spice-0.12.0[static-libs(+)]
846 - )
847 - ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
848 - usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
849 - usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
850 - uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
851 - vde? ( net-misc/vde[static-libs(+)] )
852 - virgl? ( media-libs/virglrenderer[static-libs(+)] )
853 - virtfs? ( sys-libs/libcap )
854 - xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
855 -USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
856 -X86_FIRMWARE_DEPEND="
857 - >=sys-firmware/ipxe-1.0.0_p20130624
858 - pin-upstream-blobs? (
859 - ~sys-firmware/seabios-1.8.2
860 - ~sys-firmware/sgabios-0.1_pre8
861 - ~sys-firmware/vgabios-0.7a
862 - )
863 - !pin-upstream-blobs? (
864 - sys-firmware/seabios
865 - sys-firmware/sgabios
866 - sys-firmware/vgabios
867 - )"
868 -CDEPEND="
869 - !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
870 - !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
871 - qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
872 - qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
873 - python? ( ${PYTHON_DEPS} )
874 - systemtap? ( dev-util/systemtap )
875 - xen? ( app-emulation/xen-tools:= )"
876 -DEPEND="${CDEPEND}
877 - dev-lang/perl
878 - =dev-lang/python-2*
879 - sys-apps/texinfo
880 - virtual/pkgconfig
881 - kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
882 - gtk? ( nls? ( sys-devel/gettext ) )
883 - static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
884 - static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
885 - test? (
886 - dev-libs/glib[utils]
887 - sys-devel/bc
888 - )"
889 -RDEPEND="${CDEPEND}
890 - selinux? ( sec-policy/selinux-qemu )
891 -"
892 -
893 -STRIP_MASK="/usr/share/qemu/palcode-clipper"
894 -
895 -QA_PREBUILT="
896 - usr/share/qemu/openbios-ppc
897 - usr/share/qemu/openbios-sparc64
898 - usr/share/qemu/openbios-sparc32
899 - usr/share/qemu/palcode-clipper
900 - usr/share/qemu/s390-ccw.img
901 - usr/share/qemu/u-boot.e500
902 -"
903 -
904 -QA_WX_LOAD="usr/bin/qemu-i386
905 - usr/bin/qemu-x86_64
906 - usr/bin/qemu-alpha
907 - usr/bin/qemu-arm
908 - usr/bin/qemu-cris
909 - usr/bin/qemu-m68k
910 - usr/bin/qemu-microblaze
911 - usr/bin/qemu-microblazeel
912 - usr/bin/qemu-mips
913 - usr/bin/qemu-mipsel
914 - usr/bin/qemu-or32
915 - usr/bin/qemu-ppc
916 - usr/bin/qemu-ppc64
917 - usr/bin/qemu-ppc64abi32
918 - usr/bin/qemu-sh4
919 - usr/bin/qemu-sh4eb
920 - usr/bin/qemu-sparc
921 - usr/bin/qemu-sparc64
922 - usr/bin/qemu-armeb
923 - usr/bin/qemu-sparc32plus
924 - usr/bin/qemu-s390x
925 - usr/bin/qemu-unicore32"
926 -
927 -DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
928 -you have the kernel module loaded before running kvm. The easiest way to
929 -ensure that the kernel module is loaded is to load it on boot.\n
930 -For AMD CPUs the module is called 'kvm-amd'.\n
931 -For Intel CPUs the module is called 'kvm-intel'.\n
932 -Please review /etc/conf.d/modules for how to load these.\n\n
933 -Make sure your user is in the 'kvm' group\n
934 -Just run 'gpasswd -a <USER> kvm', then have <USER> re-login.\n\n
935 -For brand new installs, the default permissions on /dev/kvm might not let you
936 -access it. You can tell udev to reset ownership/perms:\n
937 -udevadm trigger -c add /dev/kvm"
938 -
939 -qemu_support_kvm() {
940 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
941 - use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
942 - use qemu_softmmu_targets_s390x; then
943 - return 0
944 - fi
945 -
946 - return 1
947 -}
948 -
949 -pkg_pretend() {
950 - if use kernel_linux && kernel_is lt 2 6 25; then
951 - eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
952 - elif use kernel_linux; then
953 - if ! linux_config_exists; then
954 - eerror "Unable to check your kernel for KVM support"
955 - else
956 - CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
957 - ERROR_KVM="You must enable KVM in your kernel to continue"
958 - ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
959 - ERROR_KVM_AMD+=" your kernel configuration."
960 - ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
961 - ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
962 - ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
963 - ERROR_TUN+=" into your kernel or loaded as a module to use the"
964 - ERROR_TUN+=" virtual network device if using -net tap."
965 - ERROR_BRIDGE="You will also need support for 802.1d"
966 - ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
967 - use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
968 - ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
969 - ERROR_VHOST_NET+=" support"
970 -
971 - if use amd64 || use x86 || use amd64-linux || use x86-linux; then
972 - CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
973 - fi
974 -
975 - use python && CONFIG_CHECK+=" ~DEBUG_FS"
976 - ERROR_DEBUG_FS="debugFS support required for kvm_stat"
977 -
978 - # Now do the actual checks setup above
979 - check_extra_config
980 - fi
981 - fi
982 -
983 - if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
984 - eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
985 - eerror "instances are still pointing to it. Please update your"
986 - eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
987 - eerror "and the right system binary (e.g. qemu-system-x86_64)."
988 - die "update your virt configs to not use qemu-kvm"
989 - fi
990 -}
991 -
992 -pkg_setup() {
993 - enewgroup kvm 78
994 -}
995 -
996 -# Sanity check to make sure target lists are kept up-to-date.
997 -check_targets() {
998 - local var=$1 mak=$2
999 - local detected sorted
1000 -
1001 - pushd "${S}"/default-configs >/dev/null || die
1002 -
1003 - # Force C locale until glibc is updated. #564936
1004 - detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
1005 - sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
1006 - if [[ ${sorted} != "${detected}" ]] ; then
1007 - eerror "The ebuild needs to be kept in sync."
1008 - eerror "${var}: ${sorted}"
1009 - eerror "$(printf '%-*s' ${#var} configure): ${detected}"
1010 - die "sync ${var} to the list of targets"
1011 - fi
1012 -
1013 - popd >/dev/null
1014 -}
1015 -
1016 -handle_locales() {
1017 - # Make sure locale list is kept up-to-date.
1018 - local detected sorted
1019 - detected=$(echo $(cd po && printf '%s\n' *.po | grep -v messages.po | sed 's:.po$::' | sort -u))
1020 - sorted=$(echo $(printf '%s\n' ${PLOCALES} | sort -u))
1021 - if [[ ${sorted} != "${detected}" ]] ; then
1022 - eerror "The ebuild needs to be kept in sync."
1023 - eerror "PLOCALES: ${sorted}"
1024 - eerror " po/*.po: ${detected}"
1025 - die "sync PLOCALES"
1026 - fi
1027 -
1028 - # Deal with selective install of locales.
1029 - if use nls ; then
1030 - # Delete locales the user does not want. #577814
1031 - rm_loc() { rm po/$1.po || die; }
1032 - l10n_for_each_disabled_locale_do rm_loc
1033 - else
1034 - # Cheap hack to disable gettext .mo generation.
1035 - rm -f po/*.po
1036 - fi
1037 -}
1038 -
1039 -src_prepare() {
1040 - check_targets IUSE_SOFTMMU_TARGETS softmmu
1041 - check_targets IUSE_USER_TARGETS linux-user
1042 -
1043 - # Alter target makefiles to accept CFLAGS set via flag-o
1044 - sed -i -r \
1045 - -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
1046 - Makefile Makefile.target || die
1047 -
1048 - epatch "${FILESDIR}"/${PN}-2.5.0-cflags.patch
1049 - epatch "${FILESDIR}"/${PN}-2.5.0-sysmacros.patch
1050 - epatch "${FILESDIR}"/${P}-CVE-2016-6836.patch
1051 - # Fix ld and objcopy being called directly
1052 - tc-export AR LD OBJCOPY
1053 -
1054 - # Verbose builds
1055 - MAKEOPTS+=" V=1"
1056 -
1057 - epatch_user
1058 -
1059 - # Run after we've applied all patches.
1060 - handle_locales
1061 -}
1062 -
1063 -##
1064 -# configures qemu based on the build directory and the build type
1065 -# we are using.
1066 -#
1067 -qemu_src_configure() {
1068 - debug-print-function ${FUNCNAME} "$@"
1069 -
1070 - local buildtype=$1
1071 - local builddir="${S}/${buildtype}-build"
1072 - local static_flag="static-${buildtype}"
1073 -
1074 - mkdir "${builddir}"
1075 -
1076 - local conf_opts=(
1077 - --prefix=/usr
1078 - --sysconfdir=/etc
1079 - --libdir=/usr/$(get_libdir)
1080 - --docdir=/usr/share/doc/${PF}/html
1081 - --disable-bsd-user
1082 - --disable-guest-agent
1083 - --disable-strip
1084 - --disable-werror
1085 - # We support gnutls/nettle for crypto operations. It is possible
1086 - # to use gcrypt when gnutls/nettle are disabled (but not when they
1087 - # are enabled), but it's not really worth the hassle. Disable it
1088 - # all the time to avoid automatically detecting it. #568856
1089 - --disable-gcrypt
1090 - --python="${PYTHON}"
1091 - --cc="$(tc-getCC)"
1092 - --cxx="$(tc-getCXX)"
1093 - --host-cc="$(tc-getBUILD_CC)"
1094 - $(use_enable debug debug-info)
1095 - $(use_enable debug debug-tcg)
1096 - --enable-docs
1097 - $(use_enable tci tcg-interpreter)
1098 - $(use_enable xattr attr)
1099 - )
1100 -
1101 - # Disable options not used by user targets as the default configure
1102 - # options will autoprobe and try to link in a bunch of unused junk.
1103 - conf_softmmu() {
1104 - if [[ ${buildtype} == "user" ]] ; then
1105 - echo "--disable-${2:-$1}"
1106 - else
1107 - use_enable "$@"
1108 - fi
1109 - }
1110 - conf_opts+=(
1111 - $(conf_softmmu accessibility brlapi)
1112 - $(conf_softmmu aio linux-aio)
1113 - $(conf_softmmu bzip2)
1114 - $(conf_softmmu bluetooth bluez)
1115 - $(conf_softmmu caps cap-ng)
1116 - $(conf_softmmu curl)
1117 - $(conf_softmmu fdt)
1118 - $(conf_softmmu glusterfs)
1119 - $(conf_softmmu gnutls)
1120 - $(conf_softmmu gnutls nettle)
1121 - $(conf_softmmu gtk)
1122 - $(conf_softmmu infiniband rdma)
1123 - $(conf_softmmu iscsi libiscsi)
1124 - $(conf_softmmu jpeg vnc-jpeg)
1125 - $(conf_softmmu kernel_linux kvm)
1126 - $(conf_softmmu lzo)
1127 - $(conf_softmmu ncurses curses)
1128 - $(conf_softmmu nfs libnfs)
1129 - $(conf_softmmu numa)
1130 - $(conf_softmmu opengl)
1131 - $(conf_softmmu png vnc-png)
1132 - $(conf_softmmu rbd)
1133 - $(conf_softmmu sasl vnc-sasl)
1134 - $(conf_softmmu sdl)
1135 - $(conf_softmmu seccomp)
1136 - $(conf_softmmu smartcard)
1137 - $(conf_softmmu snappy)
1138 - $(conf_softmmu spice)
1139 - $(conf_softmmu ssh libssh2)
1140 - $(conf_softmmu usb libusb)
1141 - $(conf_softmmu usbredir usb-redir)
1142 - $(conf_softmmu uuid)
1143 - $(conf_softmmu vde)
1144 - $(conf_softmmu vhost-net)
1145 - $(conf_softmmu virgl virglrenderer)
1146 - $(conf_softmmu virtfs)
1147 - $(conf_softmmu vnc)
1148 - $(conf_softmmu vte)
1149 - $(conf_softmmu xen)
1150 - $(conf_softmmu xen xen-pci-passthrough)
1151 - $(conf_softmmu xfs xfsctl)
1152 - )
1153 -
1154 - case ${buildtype} in
1155 - user)
1156 - conf_opts+=(
1157 - --enable-linux-user
1158 - --disable-system
1159 - --disable-blobs
1160 - --disable-tools
1161 - )
1162 - ;;
1163 - softmmu)
1164 - # audio options
1165 - local audio_opts="oss"
1166 - use alsa && audio_opts="alsa,${audio_opts}"
1167 - use sdl && audio_opts="sdl,${audio_opts}"
1168 - use pulseaudio && audio_opts="pa,${audio_opts}"
1169 -
1170 - conf_opts+=(
1171 - --disable-linux-user
1172 - --enable-system
1173 - --with-system-pixman
1174 - --audio-drv-list="${audio_opts}"
1175 - )
1176 - use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
1177 - use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
1178 - ;;
1179 - tools)
1180 - conf_opts+=(
1181 - --disable-linux-user
1182 - --disable-system
1183 - --disable-blobs
1184 - $(use_enable bzip2)
1185 - )
1186 - static_flag="static"
1187 - ;;
1188 - esac
1189 -
1190 - local targets="${buildtype}_targets"
1191 - [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
1192 -
1193 - # Add support for SystemTAP
1194 - use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
1195 -
1196 - # We always want to attempt to build with PIE support as it results
1197 - # in a more secure binary. But it doesn't work with static or if
1198 - # the current GCC doesn't have PIE support.
1199 - if use ${static_flag}; then
1200 - conf_opts+=( --static --disable-pie )
1201 - else
1202 - gcc-specs-pie && conf_opts+=( --enable-pie )
1203 - fi
1204 -
1205 - echo "../configure ${conf_opts[*]}"
1206 - cd "${builddir}"
1207 - ../configure "${conf_opts[@]}" || die "configure failed"
1208 -
1209 - # FreeBSD's kernel does not support QEMU assigning/grabbing
1210 - # host USB devices yet
1211 - use kernel_FreeBSD && \
1212 - sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
1213 -}
1214 -
1215 -src_configure() {
1216 - local target
1217 -
1218 - python_setup
1219 -
1220 - softmmu_targets= softmmu_bins=()
1221 - user_targets= user_bins=()
1222 -
1223 - for target in ${IUSE_SOFTMMU_TARGETS} ; do
1224 - if use "qemu_softmmu_targets_${target}"; then
1225 - softmmu_targets+=",${target}-softmmu"
1226 - softmmu_bins+=( "qemu-system-${target}" )
1227 - fi
1228 - done
1229 -
1230 - for target in ${IUSE_USER_TARGETS} ; do
1231 - if use "qemu_user_targets_${target}"; then
1232 - user_targets+=",${target}-linux-user"
1233 - user_bins+=( "qemu-${target}" )
1234 - fi
1235 - done
1236 -
1237 - softmmu_targets=${softmmu_targets#,}
1238 - user_targets=${user_targets#,}
1239 -
1240 - [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
1241 - [[ -n ${user_targets} ]] && qemu_src_configure "user"
1242 - [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
1243 -}
1244 -
1245 -src_compile() {
1246 - if [[ -n ${user_targets} ]]; then
1247 - cd "${S}/user-build"
1248 - default
1249 - fi
1250 -
1251 - if [[ -n ${softmmu_targets} ]]; then
1252 - cd "${S}/softmmu-build"
1253 - default
1254 - fi
1255 -
1256 - if [[ -z ${softmmu_targets}${user_targets} ]]; then
1257 - cd "${S}/tools-build"
1258 - default
1259 - fi
1260 -}
1261 -
1262 -src_test() {
1263 - if [[ -n ${softmmu_targets} ]]; then
1264 - cd "${S}/softmmu-build"
1265 - pax-mark m */qemu-system-* #515550
1266 - emake -j1 check
1267 - emake -j1 check-report.html
1268 - fi
1269 -}
1270 -
1271 -qemu_python_install() {
1272 - python_domodule "${S}/scripts/qmp/qmp.py"
1273 -
1274 - python_doscript "${S}/scripts/kvm/vmxcap"
1275 - python_doscript "${S}/scripts/qmp/qmp-shell"
1276 - python_doscript "${S}/scripts/qmp/qemu-ga-client"
1277 -}
1278 -
1279 -src_install() {
1280 - if [[ -n ${user_targets} ]]; then
1281 - cd "${S}/user-build"
1282 - emake DESTDIR="${ED}" install
1283 -
1284 - # Install binfmt handler init script for user targets
1285 - newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
1286 - fi
1287 -
1288 - if [[ -n ${softmmu_targets} ]]; then
1289 - cd "${S}/softmmu-build"
1290 - emake DESTDIR="${ED}" install
1291 -
1292 - # This might not exist if the test failed. #512010
1293 - [[ -e check-report.html ]] && dohtml check-report.html
1294 -
1295 - if use kernel_linux; then
1296 - udev_dorules "${FILESDIR}"/65-kvm.rules
1297 - fi
1298 -
1299 - if use python; then
1300 - python_foreach_impl qemu_python_install
1301 - fi
1302 - fi
1303 -
1304 - if [[ -z ${softmmu_targets}${user_targets} ]]; then
1305 - cd "${S}/tools-build"
1306 - emake DESTDIR="${ED}" install
1307 - fi
1308 -
1309 - # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
1310 - pushd "${ED}"/usr/bin >/dev/null
1311 - pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
1312 - popd >/dev/null
1313 -
1314 - # Install config file example for qemu-bridge-helper
1315 - insinto "/etc/qemu"
1316 - doins "${FILESDIR}/bridge.conf"
1317 -
1318 - # Remove the docdir placed qmp-commands.txt
1319 - mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/" || die
1320 -
1321 - cd "${S}"
1322 - dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
1323 - newdoc pc-bios/README README.pc-bios
1324 - dodoc docs/qmp-*.txt
1325 -
1326 - if [[ -n ${softmmu_targets} ]]; then
1327 - # Remove SeaBIOS since we're using the SeaBIOS packaged one
1328 - rm "${ED}/usr/share/qemu/bios.bin"
1329 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
1330 - dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
1331 - fi
1332 -
1333 - # Remove vgabios since we're using the vgabios packaged one
1334 - rm "${ED}/usr/share/qemu/vgabios.bin"
1335 - rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
1336 - rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
1337 - rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
1338 - rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
1339 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
1340 - dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
1341 - dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
1342 - dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
1343 - dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
1344 - dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
1345 - fi
1346 -
1347 - # Remove sgabios since we're using the sgabios packaged one
1348 - rm "${ED}/usr/share/qemu/sgabios.bin"
1349 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
1350 - dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
1351 - fi
1352 -
1353 - # Remove iPXE since we're using the iPXE packaged one
1354 - rm "${ED}"/usr/share/qemu/pxe-*.rom
1355 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
1356 - dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
1357 - dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
1358 - dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
1359 - dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
1360 - dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
1361 - dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
1362 - fi
1363 - fi
1364 -
1365 - qemu_support_kvm && readme.gentoo_create_doc
1366 -}
1367 -
1368 -pkg_postinst() {
1369 - if qemu_support_kvm; then
1370 - readme.gentoo_print_elog
1371 - fi
1372 -
1373 - if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
1374 - udev_reload
1375 - fi
1376 -
1377 - fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
1378 -}
1379 -
1380 -pkg_info() {
1381 - echo "Using:"
1382 - echo " $(best_version app-emulation/spice-protocol)"
1383 - echo " $(best_version sys-firmware/ipxe)"
1384 - echo " $(best_version sys-firmware/seabios)"
1385 - if has_version 'sys-firmware/seabios[binary]'; then
1386 - echo " USE=binary"
1387 - else
1388 - echo " USE=''"
1389 - fi
1390 - echo " $(best_version sys-firmware/vgabios)"
1391 -}