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