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