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