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