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