Gentoo Archives: gentoo-commits

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