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