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