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