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