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