Gentoo Archives: gentoo-commits

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