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