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