Gentoo Archives: gentoo-commits

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