Gentoo Archives: gentoo-commits

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