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