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