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