1 |
commit: a711d752f0cb579444c9548c1ac018708123234c |
2 |
Author: Jan Vesely <jano.vesely <AT> gmail <DOT> com> |
3 |
AuthorDate: Sat Sep 23 23:47:57 2017 +0000 |
4 |
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Oct 28 20:52:41 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a711d752 |
7 |
|
8 |
app-emulation/qemu: Remove bundled copy of libfdt |
9 |
|
10 |
Bump min dependency on sys-apps/dtc to 1.4.2. |
11 |
|
12 |
Signed-off-by: Matthias Maier <tamiko <AT> gentoo.org> |
13 |
Closes: https://github.com/gentoo/gentoo/pull/5781 |
14 |
|
15 |
app-emulation/qemu/qemu-2.10.0-r1.ebuild | 784 ++++++++++++++++++++++++++++++ |
16 |
app-emulation/qemu/qemu-2.9.0-r57.ebuild | 796 +++++++++++++++++++++++++++++++ |
17 |
2 files changed, 1580 insertions(+) |
18 |
|
19 |
diff --git a/app-emulation/qemu/qemu-2.10.0-r1.ebuild b/app-emulation/qemu/qemu-2.10.0-r1.ebuild |
20 |
new file mode 100644 |
21 |
index 00000000000..a1210f3d599 |
22 |
--- /dev/null |
23 |
+++ b/app-emulation/qemu/qemu-2.10.0-r1.ebuild |
24 |
@@ -0,0 +1,784 @@ |
25 |
+# Copyright 1999-2017 Gentoo Foundation |
26 |
+# Distributed under the terms of the GNU General Public License v2 |
27 |
+ |
28 |
+EAPI="6" |
29 |
+ |
30 |
+PYTHON_COMPAT=( python2_7 ) |
31 |
+PYTHON_REQ_USE="ncurses,readline" |
32 |
+ |
33 |
+PLOCALES="bg de_DE fr_FR hu it tr zh_CN" |
34 |
+ |
35 |
+FIRMWARE_ABI_VERSION="2.9.0-r52" |
36 |
+ |
37 |
+inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \ |
38 |
+ user udev fcaps readme.gentoo-r1 pax-utils l10n |
39 |
+ |
40 |
+if [[ ${PV} = *9999* ]]; then |
41 |
+ EGIT_REPO_URI="git://git.qemu.org/qemu.git" |
42 |
+ inherit git-r3 |
43 |
+ SRC_URI="" |
44 |
+else |
45 |
+ SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2" |
46 |
+ KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~x86 ~x86-fbsd" |
47 |
+fi |
48 |
+ |
49 |
+DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools" |
50 |
+HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org" |
51 |
+ |
52 |
+LICENSE="GPL-2 LGPL-2 BSD-2" |
53 |
+SLOT="0" |
54 |
+IUSE="accessibility +aio alsa bluetooth bzip2 +caps +curl debug +fdt |
55 |
+ glusterfs gnutls gtk gtk2 infiniband iscsi +jpeg kernel_linux |
56 |
+ kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs +png |
57 |
+ pulseaudio python rbd sasl +seccomp sdl sdl2 selinux smartcard snappy |
58 |
+ spice ssh static static-user systemtap tci test usb usbredir vde |
59 |
+ +vhost-net virgl virtfs +vnc vte xattr xen xfs" |
60 |
+ |
61 |
+COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel |
62 |
+ mips mips64 mips64el mipsel nios2 or1k ppc ppc64 s390x sh4 sh4eb sparc |
63 |
+ sparc64 x86_64" |
64 |
+IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} |
65 |
+ lm32 moxie ppcemb tricore unicore32 xtensa xtensaeb" |
66 |
+IUSE_USER_TARGETS="${COMMON_TARGETS} |
67 |
+ armeb hppa mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus tilegx" |
68 |
+ |
69 |
+use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS}) |
70 |
+use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS}) |
71 |
+IUSE+=" ${use_softmmu_targets} ${use_user_targets}" |
72 |
+ |
73 |
+# Allow no targets to be built so that people can get a tools-only build. |
74 |
+# Block USE flag configurations known to not work. |
75 |
+REQUIRED_USE="${PYTHON_REQUIRED_USE} |
76 |
+ gtk2? ( gtk ) |
77 |
+ qemu_softmmu_targets_arm? ( fdt ) |
78 |
+ qemu_softmmu_targets_microblaze? ( fdt ) |
79 |
+ qemu_softmmu_targets_mips64el? ( fdt ) |
80 |
+ qemu_softmmu_targets_ppc? ( fdt ) |
81 |
+ qemu_softmmu_targets_ppc64? ( fdt ) |
82 |
+ sdl2? ( sdl ) |
83 |
+ static? ( static-user !alsa !bluetooth !gtk !gtk2 !opengl !pulseaudio ) |
84 |
+ virtfs? ( xattr ) |
85 |
+ vte? ( gtk )" |
86 |
+ |
87 |
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...) |
88 |
+# and user/softmmu targets (qemu-*, qemu-system-*). |
89 |
+# |
90 |
+# Yep, you need both libcap and libcap-ng since virtfs only uses libcap. |
91 |
+# |
92 |
+# The attr lib isn't always linked in (although the USE flag is always |
93 |
+# respected). This is because qemu supports using the C library's API |
94 |
+# when available rather than always using the extranl library. |
95 |
+ALL_DEPEND=" |
96 |
+ >=dev-libs/glib-2.0[static-libs(+)] |
97 |
+ sys-libs/zlib[static-libs(+)] |
98 |
+ python? ( ${PYTHON_DEPS} ) |
99 |
+ systemtap? ( dev-util/systemtap ) |
100 |
+ xattr? ( sys-apps/attr[static-libs(+)] )" |
101 |
+ |
102 |
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...) |
103 |
+# softmmu targets (qemu-system-*). |
104 |
+SOFTMMU_TOOLS_DEPEND=" |
105 |
+ >=x11-libs/pixman-0.28.0[static-libs(+)] |
106 |
+ accessibility? ( |
107 |
+ app-accessibility/brltty[api] |
108 |
+ app-accessibility/brltty[static-libs(+)] |
109 |
+ ) |
110 |
+ aio? ( dev-libs/libaio[static-libs(+)] ) |
111 |
+ alsa? ( >=media-libs/alsa-lib-1.0.13 ) |
112 |
+ bluetooth? ( net-wireless/bluez ) |
113 |
+ bzip2? ( app-arch/bzip2[static-libs(+)] ) |
114 |
+ caps? ( sys-libs/libcap-ng[static-libs(+)] ) |
115 |
+ curl? ( >=net-misc/curl-7.15.4[static-libs(+)] ) |
116 |
+ fdt? ( >=sys-apps/dtc-1.4.2[static-libs(+)] ) |
117 |
+ glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] ) |
118 |
+ gnutls? ( |
119 |
+ dev-libs/nettle:=[static-libs(+)] |
120 |
+ >=net-libs/gnutls-3.0:=[static-libs(+)] |
121 |
+ ) |
122 |
+ gtk? ( |
123 |
+ gtk2? ( |
124 |
+ x11-libs/gtk+:2 |
125 |
+ vte? ( x11-libs/vte:0 ) |
126 |
+ ) |
127 |
+ !gtk2? ( |
128 |
+ x11-libs/gtk+:3 |
129 |
+ vte? ( x11-libs/vte:2.91 ) |
130 |
+ ) |
131 |
+ ) |
132 |
+ infiniband? ( sys-fabric/librdmacm:=[static-libs(+)] ) |
133 |
+ iscsi? ( net-libs/libiscsi ) |
134 |
+ jpeg? ( virtual/jpeg:0=[static-libs(+)] ) |
135 |
+ lzo? ( dev-libs/lzo:2[static-libs(+)] ) |
136 |
+ ncurses? ( |
137 |
+ sys-libs/ncurses:0=[unicode] |
138 |
+ sys-libs/ncurses:0=[static-libs(+)] |
139 |
+ ) |
140 |
+ nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] ) |
141 |
+ numa? ( sys-process/numactl[static-libs(+)] ) |
142 |
+ opengl? ( |
143 |
+ virtual/opengl |
144 |
+ media-libs/libepoxy[static-libs(+)] |
145 |
+ media-libs/mesa[static-libs(+)] |
146 |
+ media-libs/mesa[egl,gbm] |
147 |
+ ) |
148 |
+ png? ( media-libs/libpng:0=[static-libs(+)] ) |
149 |
+ pulseaudio? ( media-sound/pulseaudio ) |
150 |
+ rbd? ( sys-cluster/ceph[static-libs(+)] ) |
151 |
+ sasl? ( dev-libs/cyrus-sasl[static-libs(+)] ) |
152 |
+ sdl? ( |
153 |
+ !sdl2? ( |
154 |
+ media-libs/libsdl[X] |
155 |
+ >=media-libs/libsdl-1.2.11[static-libs(+)] |
156 |
+ ) |
157 |
+ sdl2? ( |
158 |
+ media-libs/libsdl2[X] |
159 |
+ media-libs/libsdl2[static-libs(+)] |
160 |
+ ) |
161 |
+ ) |
162 |
+ seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] ) |
163 |
+ smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] ) |
164 |
+ snappy? ( app-arch/snappy:=[static-libs(+)] ) |
165 |
+ spice? ( |
166 |
+ >=app-emulation/spice-protocol-0.12.3 |
167 |
+ >=app-emulation/spice-0.12.0[static-libs(+)] |
168 |
+ ) |
169 |
+ ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] ) |
170 |
+ usb? ( >=virtual/libusb-1-r2[static-libs(+)] ) |
171 |
+ usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] ) |
172 |
+ vde? ( net-misc/vde[static-libs(+)] ) |
173 |
+ virgl? ( media-libs/virglrenderer[static-libs(+)] ) |
174 |
+ virtfs? ( sys-libs/libcap ) |
175 |
+ xen? ( app-emulation/xen-tools:= ) |
176 |
+ xfs? ( sys-fs/xfsprogs[static-libs(+)] )" |
177 |
+ |
178 |
+X86_FIRMWARE_DEPEND=" |
179 |
+ pin-upstream-blobs? ( |
180 |
+ ~sys-firmware/edk2-ovmf-2017_pre20170505[binary] |
181 |
+ ~sys-firmware/ipxe-1.0.0_p20160620 |
182 |
+ ~sys-firmware/seabios-1.10.2[binary,seavgabios] |
183 |
+ ~sys-firmware/sgabios-0.1_pre8 |
184 |
+ ) |
185 |
+ !pin-upstream-blobs? ( |
186 |
+ sys-firmware/edk2-ovmf |
187 |
+ sys-firmware/ipxe |
188 |
+ >=sys-firmware/seabios-1.10.2[seavgabios] |
189 |
+ sys-firmware/sgabios |
190 |
+ )" |
191 |
+ |
192 |
+CDEPEND=" |
193 |
+ !static? ( |
194 |
+ ${ALL_DEPEND//\[static-libs(+)]} |
195 |
+ ${SOFTMMU_TOOLS_DEPEND//\[static-libs(+)]} |
196 |
+ ) |
197 |
+ qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} ) |
198 |
+ qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )" |
199 |
+DEPEND="${CDEPEND} |
200 |
+ dev-lang/perl |
201 |
+ =dev-lang/python-2* |
202 |
+ sys-apps/texinfo |
203 |
+ virtual/pkgconfig |
204 |
+ kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 ) |
205 |
+ gtk? ( nls? ( sys-devel/gettext ) ) |
206 |
+ static? ( |
207 |
+ ${ALL_DEPEND} |
208 |
+ ${SOFTMMU_TOOLS_DEPEND} |
209 |
+ ) |
210 |
+ static-user? ( ${ALL_DEPEND} ) |
211 |
+ test? ( |
212 |
+ dev-libs/glib[utils] |
213 |
+ sys-devel/bc |
214 |
+ )" |
215 |
+RDEPEND="${CDEPEND} |
216 |
+ selinux? ( sec-policy/selinux-qemu )" |
217 |
+ |
218 |
+PATCHES=( |
219 |
+ "${FILESDIR}"/${PN}-2.5.0-cflags.patch |
220 |
+ "${FILESDIR}"/${PN}-2.5.0-sysmacros.patch |
221 |
+ "${FILESDIR}"/${PN}-2.10.0-CVE-2017-13711.patch # bug 629350 |
222 |
+) |
223 |
+ |
224 |
+STRIP_MASK="/usr/share/qemu/palcode-clipper" |
225 |
+ |
226 |
+QA_PREBUILT=" |
227 |
+ usr/share/qemu/openbios-ppc |
228 |
+ usr/share/qemu/openbios-sparc64 |
229 |
+ usr/share/qemu/openbios-sparc32 |
230 |
+ usr/share/qemu/palcode-clipper |
231 |
+ usr/share/qemu/s390-ccw.img |
232 |
+ usr/share/qemu/s390-netboot.img |
233 |
+ usr/share/qemu/u-boot.e500" |
234 |
+ |
235 |
+QA_WX_LOAD="usr/bin/qemu-i386 |
236 |
+ usr/bin/qemu-x86_64 |
237 |
+ usr/bin/qemu-alpha |
238 |
+ usr/bin/qemu-arm |
239 |
+ usr/bin/qemu-cris |
240 |
+ usr/bin/qemu-m68k |
241 |
+ usr/bin/qemu-microblaze |
242 |
+ usr/bin/qemu-microblazeel |
243 |
+ usr/bin/qemu-mips |
244 |
+ usr/bin/qemu-mipsel |
245 |
+ usr/bin/qemu-or1k |
246 |
+ usr/bin/qemu-ppc |
247 |
+ usr/bin/qemu-ppc64 |
248 |
+ usr/bin/qemu-ppc64abi32 |
249 |
+ usr/bin/qemu-sh4 |
250 |
+ usr/bin/qemu-sh4eb |
251 |
+ usr/bin/qemu-sparc |
252 |
+ usr/bin/qemu-sparc64 |
253 |
+ usr/bin/qemu-armeb |
254 |
+ usr/bin/qemu-sparc32plus |
255 |
+ usr/bin/qemu-s390x |
256 |
+ usr/bin/qemu-unicore32" |
257 |
+ |
258 |
+DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure you have the |
259 |
+kernel module loaded before running kvm. The easiest way to ensure that the |
260 |
+kernel module is loaded is to load it on boot. |
261 |
+ For AMD CPUs the module is called 'kvm-amd'. |
262 |
+ For Intel CPUs the module is called 'kvm-intel'. |
263 |
+Please review /etc/conf.d/modules for how to load these. |
264 |
+ |
265 |
+Make sure your user is in the 'kvm' group. Just run |
266 |
+ $ gpasswd -a <USER> kvm |
267 |
+then have <USER> re-login. |
268 |
+ |
269 |
+For brand new installs, the default permissions on /dev/kvm might not let |
270 |
+you access it. You can tell udev to reset ownership/perms: |
271 |
+ $ udevadm trigger -c add /dev/kvm |
272 |
+ |
273 |
+If you want to register binfmt handlers for qemu user targets: |
274 |
+For openrc: |
275 |
+ # rc-update add qemu-binfmt |
276 |
+For systemd: |
277 |
+ # ln -s /usr/share/qemu/binfmt.d/qemu.conf /etc/binfmt.d/qemu.conf" |
278 |
+ |
279 |
+pkg_pretend() { |
280 |
+ if use kernel_linux && kernel_is lt 2 6 25; then |
281 |
+ eerror "This version of KVM requres a host kernel of 2.6.25 or higher." |
282 |
+ elif use kernel_linux; then |
283 |
+ if ! linux_config_exists; then |
284 |
+ eerror "Unable to check your kernel for KVM support" |
285 |
+ else |
286 |
+ CONFIG_CHECK="~KVM ~TUN ~BRIDGE" |
287 |
+ ERROR_KVM="You must enable KVM in your kernel to continue" |
288 |
+ ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in" |
289 |
+ ERROR_KVM_AMD+=" your kernel configuration." |
290 |
+ ERROR_KVM_INTEL="If you have an Intel CPU, you must enable" |
291 |
+ ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration." |
292 |
+ ERROR_TUN="You will need the Universal TUN/TAP driver compiled" |
293 |
+ ERROR_TUN+=" into your kernel or loaded as a module to use the" |
294 |
+ ERROR_TUN+=" virtual network device if using -net tap." |
295 |
+ ERROR_BRIDGE="You will also need support for 802.1d" |
296 |
+ ERROR_BRIDGE+=" Ethernet Bridging for some network configurations." |
297 |
+ use vhost-net && CONFIG_CHECK+=" ~VHOST_NET" |
298 |
+ ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net" |
299 |
+ ERROR_VHOST_NET+=" support" |
300 |
+ |
301 |
+ if use amd64 || use x86 || use amd64-linux || use x86-linux; then |
302 |
+ CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL" |
303 |
+ fi |
304 |
+ |
305 |
+ use python && CONFIG_CHECK+=" ~DEBUG_FS" |
306 |
+ ERROR_DEBUG_FS="debugFS support required for kvm_stat" |
307 |
+ |
308 |
+ # Now do the actual checks setup above |
309 |
+ check_extra_config |
310 |
+ fi |
311 |
+ fi |
312 |
+ |
313 |
+ if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then |
314 |
+ eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt" |
315 |
+ eerror "instances are still pointing to it. Please update your" |
316 |
+ eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag" |
317 |
+ eerror "and the right system binary (e.g. qemu-system-x86_64)." |
318 |
+ die "update your virt configs to not use qemu-kvm" |
319 |
+ fi |
320 |
+} |
321 |
+ |
322 |
+pkg_setup() { |
323 |
+ enewgroup kvm 78 |
324 |
+} |
325 |
+ |
326 |
+# Sanity check to make sure target lists are kept up-to-date. |
327 |
+check_targets() { |
328 |
+ local var=$1 mak=$2 |
329 |
+ local detected sorted |
330 |
+ |
331 |
+ pushd "${S}"/default-configs >/dev/null || die |
332 |
+ |
333 |
+ # Force C locale until glibc is updated. #564936 |
334 |
+ detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u)) |
335 |
+ sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u)) |
336 |
+ if [[ ${sorted} != "${detected}" ]] ; then |
337 |
+ eerror "The ebuild needs to be kept in sync." |
338 |
+ eerror "${var}: ${sorted}" |
339 |
+ eerror "$(printf '%-*s' ${#var} configure): ${detected}" |
340 |
+ die "sync ${var} to the list of targets" |
341 |
+ fi |
342 |
+ |
343 |
+ popd >/dev/null |
344 |
+} |
345 |
+ |
346 |
+handle_locales() { |
347 |
+ # Make sure locale list is kept up-to-date. |
348 |
+ local detected sorted |
349 |
+ detected=$(echo $(cd po && printf '%s\n' *.po | grep -v messages.po | sed 's:.po$::' | sort -u)) |
350 |
+ sorted=$(echo $(printf '%s\n' ${PLOCALES} | sort -u)) |
351 |
+ if [[ ${sorted} != "${detected}" ]] ; then |
352 |
+ eerror "The ebuild needs to be kept in sync." |
353 |
+ eerror "PLOCALES: ${sorted}" |
354 |
+ eerror " po/*.po: ${detected}" |
355 |
+ die "sync PLOCALES" |
356 |
+ fi |
357 |
+ |
358 |
+ # Deal with selective install of locales. |
359 |
+ if use nls ; then |
360 |
+ # Delete locales the user does not want. #577814 |
361 |
+ rm_loc() { rm po/$1.po || die; } |
362 |
+ l10n_for_each_disabled_locale_do rm_loc |
363 |
+ else |
364 |
+ # Cheap hack to disable gettext .mo generation. |
365 |
+ rm -f po/*.po |
366 |
+ fi |
367 |
+} |
368 |
+ |
369 |
+src_prepare() { |
370 |
+ check_targets IUSE_SOFTMMU_TARGETS softmmu |
371 |
+ check_targets IUSE_USER_TARGETS linux-user |
372 |
+ |
373 |
+ # Alter target makefiles to accept CFLAGS set via flag-o |
374 |
+ sed -i -r \ |
375 |
+ -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \ |
376 |
+ Makefile Makefile.target || die |
377 |
+ |
378 |
+ default |
379 |
+ |
380 |
+ # Fix ld and objcopy being called directly |
381 |
+ tc-export AR LD OBJCOPY |
382 |
+ |
383 |
+ # Verbose builds |
384 |
+ MAKEOPTS+=" V=1" |
385 |
+ |
386 |
+ # Run after we've applied all patches. |
387 |
+ handle_locales |
388 |
+ |
389 |
+ # Remove bundled copy of libfdt |
390 |
+ rm -r dtc || die |
391 |
+} |
392 |
+ |
393 |
+## |
394 |
+# configures qemu based on the build directory and the build type |
395 |
+# we are using. |
396 |
+# |
397 |
+qemu_src_configure() { |
398 |
+ debug-print-function ${FUNCNAME} "$@" |
399 |
+ |
400 |
+ local buildtype=$1 |
401 |
+ local builddir="${S}/${buildtype}-build" |
402 |
+ |
403 |
+ mkdir "${builddir}" |
404 |
+ |
405 |
+ local conf_opts=( |
406 |
+ --prefix=/usr |
407 |
+ --sysconfdir=/etc |
408 |
+ --libdir=/usr/$(get_libdir) |
409 |
+ --docdir=/usr/share/doc/${PF}/html |
410 |
+ --disable-bsd-user |
411 |
+ --disable-guest-agent |
412 |
+ --disable-strip |
413 |
+ --disable-werror |
414 |
+ # We support gnutls/nettle for crypto operations. It is possible |
415 |
+ # to use gcrypt when gnutls/nettle are disabled (but not when they |
416 |
+ # are enabled), but it's not really worth the hassle. Disable it |
417 |
+ # all the time to avoid automatically detecting it. #568856 |
418 |
+ --disable-gcrypt |
419 |
+ --python="${PYTHON}" |
420 |
+ --cc="$(tc-getCC)" |
421 |
+ --cxx="$(tc-getCXX)" |
422 |
+ --host-cc="$(tc-getBUILD_CC)" |
423 |
+ $(use_enable debug debug-info) |
424 |
+ $(use_enable debug debug-tcg) |
425 |
+ --enable-docs |
426 |
+ $(use_enable tci tcg-interpreter) |
427 |
+ $(use_enable xattr attr) |
428 |
+ ) |
429 |
+ |
430 |
+ # Disable options not used by user targets. This simplifies building |
431 |
+ # static user targets (USE=static-user) considerably. |
432 |
+ conf_notuser() { |
433 |
+ if [[ ${buildtype} == "user" ]] ; then |
434 |
+ echo "--disable-${2:-$1}" |
435 |
+ else |
436 |
+ use_enable "$@" |
437 |
+ fi |
438 |
+ } |
439 |
+ conf_opts+=( |
440 |
+ $(conf_notuser accessibility brlapi) |
441 |
+ $(conf_notuser aio linux-aio) |
442 |
+ $(conf_notuser bzip2) |
443 |
+ $(conf_notuser bluetooth bluez) |
444 |
+ $(conf_notuser caps cap-ng) |
445 |
+ $(conf_notuser curl) |
446 |
+ $(conf_notuser fdt) |
447 |
+ $(conf_notuser glusterfs) |
448 |
+ $(conf_notuser gnutls) |
449 |
+ $(conf_notuser gnutls nettle) |
450 |
+ $(conf_notuser gtk) |
451 |
+ $(conf_notuser infiniband rdma) |
452 |
+ $(conf_notuser iscsi libiscsi) |
453 |
+ $(conf_notuser jpeg vnc-jpeg) |
454 |
+ $(conf_notuser kernel_linux kvm) |
455 |
+ $(conf_notuser lzo) |
456 |
+ $(conf_notuser ncurses curses) |
457 |
+ $(conf_notuser nfs libnfs) |
458 |
+ $(conf_notuser numa) |
459 |
+ $(conf_notuser opengl) |
460 |
+ $(conf_notuser png vnc-png) |
461 |
+ $(conf_notuser rbd) |
462 |
+ $(conf_notuser sasl vnc-sasl) |
463 |
+ $(conf_notuser sdl) |
464 |
+ $(conf_notuser seccomp) |
465 |
+ $(conf_notuser smartcard) |
466 |
+ $(conf_notuser snappy) |
467 |
+ $(conf_notuser spice) |
468 |
+ $(conf_notuser ssh libssh2) |
469 |
+ $(conf_notuser usb libusb) |
470 |
+ $(conf_notuser usbredir usb-redir) |
471 |
+ $(conf_notuser vde) |
472 |
+ $(conf_notuser vhost-net) |
473 |
+ $(conf_notuser virgl virglrenderer) |
474 |
+ $(conf_notuser virtfs) |
475 |
+ $(conf_notuser vnc) |
476 |
+ $(conf_notuser vte) |
477 |
+ $(conf_notuser xen) |
478 |
+ $(conf_notuser xen xen-pci-passthrough) |
479 |
+ $(conf_notuser xfs xfsctl) |
480 |
+ ) |
481 |
+ |
482 |
+ if [[ ! ${buildtype} == "user" ]] ; then |
483 |
+ # audio options |
484 |
+ local audio_opts="oss" |
485 |
+ use alsa && audio_opts="alsa,${audio_opts}" |
486 |
+ use sdl && audio_opts="sdl,${audio_opts}" |
487 |
+ use pulseaudio && audio_opts="pa,${audio_opts}" |
488 |
+ conf_opts+=( |
489 |
+ --audio-drv-list="${audio_opts}" |
490 |
+ ) |
491 |
+ use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) ) |
492 |
+ use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) ) |
493 |
+ fi |
494 |
+ |
495 |
+ case ${buildtype} in |
496 |
+ user) |
497 |
+ conf_opts+=( |
498 |
+ --enable-linux-user |
499 |
+ --disable-system |
500 |
+ --disable-blobs |
501 |
+ --disable-tools |
502 |
+ ) |
503 |
+ local static_flag="static-user" |
504 |
+ ;; |
505 |
+ softmmu) |
506 |
+ conf_opts+=( |
507 |
+ --disable-linux-user |
508 |
+ --enable-system |
509 |
+ --disable-tools |
510 |
+ --with-system-pixman |
511 |
+ ) |
512 |
+ local static_flag="static" |
513 |
+ ;; |
514 |
+ tools) |
515 |
+ conf_opts+=( |
516 |
+ --disable-linux-user |
517 |
+ --disable-system |
518 |
+ --disable-blobs |
519 |
+ --enable-tools |
520 |
+ ) |
521 |
+ local static_flag="static" |
522 |
+ ;; |
523 |
+ esac |
524 |
+ |
525 |
+ local targets="${buildtype}_targets" |
526 |
+ [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" ) |
527 |
+ |
528 |
+ # Add support for SystemTAP |
529 |
+ use systemtap && conf_opts+=( --enable-trace-backend=dtrace ) |
530 |
+ |
531 |
+ # We always want to attempt to build with PIE support as it results |
532 |
+ # in a more secure binary. But it doesn't work with static or if |
533 |
+ # the current GCC doesn't have PIE support. |
534 |
+ if use ${static_flag}; then |
535 |
+ conf_opts+=( --static --disable-pie ) |
536 |
+ else |
537 |
+ tc-enables-pie && conf_opts+=( --enable-pie ) |
538 |
+ fi |
539 |
+ |
540 |
+ echo "../configure ${conf_opts[*]}" |
541 |
+ cd "${builddir}" |
542 |
+ ../configure "${conf_opts[@]}" || die "configure failed" |
543 |
+ |
544 |
+ # FreeBSD's kernel does not support QEMU assigning/grabbing |
545 |
+ # host USB devices yet |
546 |
+ use kernel_FreeBSD && \ |
547 |
+ sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak |
548 |
+} |
549 |
+ |
550 |
+src_configure() { |
551 |
+ local target |
552 |
+ |
553 |
+ python_setup |
554 |
+ |
555 |
+ softmmu_targets= softmmu_bins=() |
556 |
+ user_targets= user_bins=() |
557 |
+ |
558 |
+ for target in ${IUSE_SOFTMMU_TARGETS} ; do |
559 |
+ if use "qemu_softmmu_targets_${target}"; then |
560 |
+ softmmu_targets+=",${target}-softmmu" |
561 |
+ softmmu_bins+=( "qemu-system-${target}" ) |
562 |
+ fi |
563 |
+ done |
564 |
+ |
565 |
+ for target in ${IUSE_USER_TARGETS} ; do |
566 |
+ if use "qemu_user_targets_${target}"; then |
567 |
+ user_targets+=",${target}-linux-user" |
568 |
+ user_bins+=( "qemu-${target}" ) |
569 |
+ fi |
570 |
+ done |
571 |
+ |
572 |
+ softmmu_targets=${softmmu_targets#,} |
573 |
+ user_targets=${user_targets#,} |
574 |
+ |
575 |
+ [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu" |
576 |
+ [[ -n ${user_targets} ]] && qemu_src_configure "user" |
577 |
+ qemu_src_configure "tools" |
578 |
+} |
579 |
+ |
580 |
+src_compile() { |
581 |
+ if [[ -n ${user_targets} ]]; then |
582 |
+ cd "${S}/user-build" |
583 |
+ default |
584 |
+ fi |
585 |
+ |
586 |
+ if [[ -n ${softmmu_targets} ]]; then |
587 |
+ cd "${S}/softmmu-build" |
588 |
+ default |
589 |
+ fi |
590 |
+ |
591 |
+ cd "${S}/tools-build" |
592 |
+ default |
593 |
+} |
594 |
+ |
595 |
+src_test() { |
596 |
+ if [[ -n ${softmmu_targets} ]]; then |
597 |
+ cd "${S}/softmmu-build" |
598 |
+ pax-mark m */qemu-system-* #515550 |
599 |
+ emake -j1 check |
600 |
+ emake -j1 check-report.html |
601 |
+ fi |
602 |
+} |
603 |
+ |
604 |
+qemu_python_install() { |
605 |
+ python_domodule "${S}/scripts/qmp/qmp.py" |
606 |
+ |
607 |
+ python_doscript "${S}/scripts/kvm/vmxcap" |
608 |
+ python_doscript "${S}/scripts/qmp/qmp-shell" |
609 |
+ python_doscript "${S}/scripts/qmp/qemu-ga-client" |
610 |
+} |
611 |
+ |
612 |
+# Generate binfmt support files. |
613 |
+# - /etc/init.d/qemu-binfmt script which registers the user handlers (openrc) |
614 |
+# - /usr/share/qemu/binfmt.d/qemu.conf (for use with systemd-binfmt) |
615 |
+generate_initd() { |
616 |
+ local out="${T}/qemu-binfmt" |
617 |
+ local out_systemd="${T}/qemu.conf" |
618 |
+ local d="${T}/binfmt.d" |
619 |
+ |
620 |
+ einfo "Generating qemu binfmt scripts and configuration files" |
621 |
+ |
622 |
+ # Generate the debian fragments first. |
623 |
+ mkdir -p "${d}" |
624 |
+ "${S}"/scripts/qemu-binfmt-conf.sh \ |
625 |
+ --debian \ |
626 |
+ --exportdir "${d}" \ |
627 |
+ --qemu-path "${EPREFIX}/usr/bin" \ |
628 |
+ || die |
629 |
+ # Then turn the fragments into a shell script we can source. |
630 |
+ sed -E -i \ |
631 |
+ -e 's:^([^ ]+) (.*)$:\1="\2":' \ |
632 |
+ "${d}"/* || die |
633 |
+ |
634 |
+ # Generate the init.d script by assembling the fragments from above. |
635 |
+ local f qcpu package interpreter magic mask |
636 |
+ cat "${FILESDIR}"/qemu-binfmt.initd.head >"${out}" || die |
637 |
+ for f in "${d}"/qemu-* ; do |
638 |
+ source "${f}" |
639 |
+ |
640 |
+ # Normalize the cpu logic like we do in the init.d for the native cpu. |
641 |
+ qcpu=${package#qemu-} |
642 |
+ case ${qcpu} in |
643 |
+ arm*) qcpu="arm";; |
644 |
+ mips*) qcpu="mips";; |
645 |
+ ppc*) qcpu="ppc";; |
646 |
+ s390*) qcpu="s390";; |
647 |
+ sh*) qcpu="sh";; |
648 |
+ sparc*) qcpu="sparc";; |
649 |
+ esac |
650 |
+ |
651 |
+ cat <<EOF >>"${out}" |
652 |
+ if [ "\${cpu}" != "${qcpu}" -a -x "${interpreter}" ] ; then |
653 |
+ echo ':${package}:M::${magic}:${mask}:${interpreter}:'"\${QEMU_BINFMT_FLAGS}" >/proc/sys/fs/binfmt_misc/register |
654 |
+ fi |
655 |
+EOF |
656 |
+ |
657 |
+ echo ":${package}:M::${magic}:${mask}:${interpreter}:OC" >>"${out_systemd}" |
658 |
+ |
659 |
+ done |
660 |
+ cat "${FILESDIR}"/qemu-binfmt.initd.tail >>"${out}" || die |
661 |
+} |
662 |
+ |
663 |
+src_install() { |
664 |
+ if [[ -n ${user_targets} ]]; then |
665 |
+ cd "${S}/user-build" |
666 |
+ emake DESTDIR="${ED}" install |
667 |
+ |
668 |
+ # Install binfmt handler init script for user targets. |
669 |
+ generate_initd |
670 |
+ doinitd "${T}/qemu-binfmt" |
671 |
+ |
672 |
+ # Install binfmt/qemu.conf. |
673 |
+ insinto "/usr/share/qemu/binfmt.d" |
674 |
+ doins "${T}/qemu.conf" |
675 |
+ fi |
676 |
+ |
677 |
+ if [[ -n ${softmmu_targets} ]]; then |
678 |
+ cd "${S}/softmmu-build" |
679 |
+ emake DESTDIR="${ED}" install |
680 |
+ |
681 |
+ # This might not exist if the test failed. #512010 |
682 |
+ [[ -e check-report.html ]] && dohtml check-report.html |
683 |
+ |
684 |
+ if use kernel_linux; then |
685 |
+ udev_newrules "${FILESDIR}"/65-kvm.rules-r1 65-kvm.rules |
686 |
+ fi |
687 |
+ |
688 |
+ if use python; then |
689 |
+ python_foreach_impl qemu_python_install |
690 |
+ fi |
691 |
+ fi |
692 |
+ |
693 |
+ cd "${S}/tools-build" |
694 |
+ emake DESTDIR="${ED}" install |
695 |
+ |
696 |
+ # Disable mprotect on the qemu binaries as they use JITs to be fast #459348 |
697 |
+ pushd "${ED}"/usr/bin >/dev/null |
698 |
+ pax-mark mr "${softmmu_bins[@]}" "${user_bins[@]}" # bug 575594 |
699 |
+ popd >/dev/null |
700 |
+ |
701 |
+ # Install config file example for qemu-bridge-helper |
702 |
+ insinto "/etc/qemu" |
703 |
+ doins "${FILESDIR}/bridge.conf" |
704 |
+ |
705 |
+ cd "${S}" |
706 |
+ dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt |
707 |
+ newdoc pc-bios/README README.pc-bios |
708 |
+ |
709 |
+ if [[ -n ${softmmu_targets} ]]; then |
710 |
+ # Remove SeaBIOS since we're using the SeaBIOS packaged one |
711 |
+ rm "${ED}/usr/share/qemu/bios.bin" |
712 |
+ rm "${ED}/usr/share/qemu/bios-256k.bin" |
713 |
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then |
714 |
+ dosym ../seabios/bios.bin /usr/share/qemu/bios.bin |
715 |
+ dosym ../seabios/bios-256k.bin /usr/share/qemu/bios-256k.bin |
716 |
+ fi |
717 |
+ |
718 |
+ # Remove vgabios since we're using the seavgabios packaged one |
719 |
+ rm "${ED}/usr/share/qemu/vgabios.bin" |
720 |
+ rm "${ED}/usr/share/qemu/vgabios-cirrus.bin" |
721 |
+ rm "${ED}/usr/share/qemu/vgabios-qxl.bin" |
722 |
+ rm "${ED}/usr/share/qemu/vgabios-stdvga.bin" |
723 |
+ rm "${ED}/usr/share/qemu/vgabios-virtio.bin" |
724 |
+ rm "${ED}/usr/share/qemu/vgabios-vmware.bin" |
725 |
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then |
726 |
+ dosym ../seavgabios/vgabios-isavga.bin /usr/share/qemu/vgabios.bin |
727 |
+ dosym ../seavgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin |
728 |
+ dosym ../seavgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin |
729 |
+ dosym ../seavgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin |
730 |
+ dosym ../seavgabios/vgabios-virtio.bin /usr/share/qemu/vgabios-virtio.bin |
731 |
+ dosym ../seavgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin |
732 |
+ fi |
733 |
+ |
734 |
+ # Remove sgabios since we're using the sgabios packaged one |
735 |
+ rm "${ED}/usr/share/qemu/sgabios.bin" |
736 |
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then |
737 |
+ dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin |
738 |
+ fi |
739 |
+ |
740 |
+ # Remove iPXE since we're using the iPXE packaged one |
741 |
+ rm "${ED}"/usr/share/qemu/pxe-*.rom |
742 |
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then |
743 |
+ dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom |
744 |
+ dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom |
745 |
+ dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom |
746 |
+ dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom |
747 |
+ dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom |
748 |
+ dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom |
749 |
+ fi |
750 |
+ fi |
751 |
+ |
752 |
+ DISABLE_AUTOFORMATTING=true |
753 |
+ readme.gentoo_create_doc |
754 |
+} |
755 |
+ |
756 |
+firmware_abi_change() { |
757 |
+ local pv |
758 |
+ for pv in ${REPLACING_VERSIONS}; do |
759 |
+ if ! version_is_at_least ${FIRMWARE_ABI_VERSION} ${pv}; then |
760 |
+ return 0 |
761 |
+ fi |
762 |
+ done |
763 |
+ return 1 |
764 |
+} |
765 |
+ |
766 |
+pkg_postinst() { |
767 |
+ if [[ -n ${softmmu_targets} ]] && use kernel_linux; then |
768 |
+ udev_reload |
769 |
+ fi |
770 |
+ |
771 |
+ fcaps cap_net_admin /usr/libexec/qemu-bridge-helper |
772 |
+ |
773 |
+ DISABLE_AUTOFORMATTING=true |
774 |
+ readme.gentoo_print_elog |
775 |
+ |
776 |
+ if use pin-upstream-blobs && firmware_abi_change; then |
777 |
+ ewarn "This version of qemu pins new versions of firmware blobs:" |
778 |
+ ewarn " $(best_version sys-firmware/edk2-ovmf)" |
779 |
+ ewarn " $(best_version sys-firmware/ipxe)" |
780 |
+ ewarn " $(best_version sys-firmware/seabios)" |
781 |
+ ewarn " $(best_version sys-firmware/sgabios)" |
782 |
+ ewarn "This might break resume of hibernated guests (started with a different" |
783 |
+ ewarn "firmware version) and live migration to/from qemu versions with different" |
784 |
+ ewarn "firmware. Please (cold) restart all running guests. For functional" |
785 |
+ ewarn "guest migration ensure that all" |
786 |
+ ewarn "hosts run at least" |
787 |
+ ewarn " app-emulation/qemu-${FIRMWARE_ABI_VERSION}." |
788 |
+ fi |
789 |
+} |
790 |
+ |
791 |
+pkg_info() { |
792 |
+ echo "Using:" |
793 |
+ echo " $(best_version app-emulation/spice-protocol)" |
794 |
+ echo " $(best_version sys-firmware/edk2-ovmf)" |
795 |
+ if has_version 'sys-firmware/edk2-ovmf[binary]'; then |
796 |
+ echo " USE=binary" |
797 |
+ else |
798 |
+ echo " USE=''" |
799 |
+ fi |
800 |
+ echo " $(best_version sys-firmware/ipxe)" |
801 |
+ echo " $(best_version sys-firmware/seabios)" |
802 |
+ if has_version 'sys-firmware/seabios[binary]'; then |
803 |
+ echo " USE=binary" |
804 |
+ else |
805 |
+ echo " USE=''" |
806 |
+ fi |
807 |
+ echo " $(best_version sys-firmware/sgabios)" |
808 |
+} |
809 |
|
810 |
diff --git a/app-emulation/qemu/qemu-2.9.0-r57.ebuild b/app-emulation/qemu/qemu-2.9.0-r57.ebuild |
811 |
new file mode 100644 |
812 |
index 00000000000..a63311cba20 |
813 |
--- /dev/null |
814 |
+++ b/app-emulation/qemu/qemu-2.9.0-r57.ebuild |
815 |
@@ -0,0 +1,796 @@ |
816 |
+# Copyright 1999-2017 Gentoo Foundation |
817 |
+# Distributed under the terms of the GNU General Public License v2 |
818 |
+ |
819 |
+EAPI="6" |
820 |
+ |
821 |
+PYTHON_COMPAT=( python2_7 ) |
822 |
+PYTHON_REQ_USE="ncurses,readline" |
823 |
+ |
824 |
+PLOCALES="bg de_DE fr_FR hu it tr zh_CN" |
825 |
+ |
826 |
+FIRMWARE_ABI_VERSION="2.9.0-r52" |
827 |
+ |
828 |
+inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \ |
829 |
+ user udev fcaps readme.gentoo-r1 pax-utils l10n |
830 |
+ |
831 |
+if [[ ${PV} = *9999* ]]; then |
832 |
+ EGIT_REPO_URI="git://git.qemu.org/qemu.git" |
833 |
+ inherit git-r3 |
834 |
+ SRC_URI="" |
835 |
+else |
836 |
+ SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2" |
837 |
+ KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~x86 ~x86-fbsd" |
838 |
+fi |
839 |
+ |
840 |
+DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools" |
841 |
+HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org" |
842 |
+ |
843 |
+LICENSE="GPL-2 LGPL-2 BSD-2" |
844 |
+SLOT="0" |
845 |
+IUSE="accessibility +aio alsa bluetooth bzip2 +caps +curl debug +fdt |
846 |
+ glusterfs gnutls gtk gtk2 infiniband iscsi +jpeg kernel_linux |
847 |
+ kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs +png |
848 |
+ pulseaudio python rbd sasl +seccomp sdl sdl2 selinux smartcard snappy |
849 |
+ spice ssh static static-user systemtap tci test usb usbredir vde |
850 |
+ +vhost-net virgl virtfs +vnc vte xattr xen xfs" |
851 |
+ |
852 |
+COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel |
853 |
+ mips mips64 mips64el mipsel nios2 or1k ppc ppc64 s390x sh4 sh4eb sparc |
854 |
+ sparc64 x86_64" |
855 |
+IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} |
856 |
+ lm32 moxie ppcemb tricore unicore32 xtensa xtensaeb" |
857 |
+IUSE_USER_TARGETS="${COMMON_TARGETS} |
858 |
+ armeb hppa mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus tilegx" |
859 |
+ |
860 |
+use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS}) |
861 |
+use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS}) |
862 |
+IUSE+=" ${use_softmmu_targets} ${use_user_targets}" |
863 |
+ |
864 |
+# Allow no targets to be built so that people can get a tools-only build. |
865 |
+# Block USE flag configurations known to not work. |
866 |
+REQUIRED_USE="${PYTHON_REQUIRED_USE} |
867 |
+ gtk2? ( gtk ) |
868 |
+ qemu_softmmu_targets_arm? ( fdt ) |
869 |
+ qemu_softmmu_targets_microblaze? ( fdt ) |
870 |
+ qemu_softmmu_targets_mips64el? ( fdt ) |
871 |
+ qemu_softmmu_targets_ppc? ( fdt ) |
872 |
+ qemu_softmmu_targets_ppc64? ( fdt ) |
873 |
+ sdl2? ( sdl ) |
874 |
+ static? ( static-user !alsa !bluetooth !gtk !gtk2 !opengl !pulseaudio ) |
875 |
+ virtfs? ( xattr ) |
876 |
+ vte? ( gtk )" |
877 |
+ |
878 |
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...) |
879 |
+# and user/softmmu targets (qemu-*, qemu-system-*). |
880 |
+# |
881 |
+# Yep, you need both libcap and libcap-ng since virtfs only uses libcap. |
882 |
+# |
883 |
+# The attr lib isn't always linked in (although the USE flag is always |
884 |
+# respected). This is because qemu supports using the C library's API |
885 |
+# when available rather than always using the extranl library. |
886 |
+ALL_DEPEND=" |
887 |
+ >=dev-libs/glib-2.0[static-libs(+)] |
888 |
+ sys-libs/zlib[static-libs(+)] |
889 |
+ python? ( ${PYTHON_DEPS} ) |
890 |
+ systemtap? ( dev-util/systemtap ) |
891 |
+ xattr? ( sys-apps/attr[static-libs(+)] )" |
892 |
+ |
893 |
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...) |
894 |
+# softmmu targets (qemu-system-*). |
895 |
+SOFTMMU_TOOLS_DEPEND=" |
896 |
+ >=x11-libs/pixman-0.28.0[static-libs(+)] |
897 |
+ accessibility? ( |
898 |
+ app-accessibility/brltty[api] |
899 |
+ app-accessibility/brltty[static-libs(+)] |
900 |
+ ) |
901 |
+ aio? ( dev-libs/libaio[static-libs(+)] ) |
902 |
+ alsa? ( >=media-libs/alsa-lib-1.0.13 ) |
903 |
+ bluetooth? ( net-wireless/bluez ) |
904 |
+ bzip2? ( app-arch/bzip2[static-libs(+)] ) |
905 |
+ caps? ( sys-libs/libcap-ng[static-libs(+)] ) |
906 |
+ curl? ( >=net-misc/curl-7.15.4[static-libs(+)] ) |
907 |
+ fdt? ( >=sys-apps/dtc-1.4.2[static-libs(+)] ) |
908 |
+ glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] ) |
909 |
+ gnutls? ( |
910 |
+ dev-libs/nettle:=[static-libs(+)] |
911 |
+ >=net-libs/gnutls-3.0:=[static-libs(+)] |
912 |
+ ) |
913 |
+ gtk? ( |
914 |
+ gtk2? ( |
915 |
+ x11-libs/gtk+:2 |
916 |
+ vte? ( x11-libs/vte:0 ) |
917 |
+ ) |
918 |
+ !gtk2? ( |
919 |
+ x11-libs/gtk+:3 |
920 |
+ vte? ( x11-libs/vte:2.91 ) |
921 |
+ ) |
922 |
+ ) |
923 |
+ infiniband? ( sys-fabric/librdmacm:=[static-libs(+)] ) |
924 |
+ iscsi? ( net-libs/libiscsi ) |
925 |
+ jpeg? ( virtual/jpeg:0=[static-libs(+)] ) |
926 |
+ lzo? ( dev-libs/lzo:2[static-libs(+)] ) |
927 |
+ ncurses? ( |
928 |
+ sys-libs/ncurses:0=[unicode] |
929 |
+ sys-libs/ncurses:0=[static-libs(+)] |
930 |
+ ) |
931 |
+ nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] ) |
932 |
+ numa? ( sys-process/numactl[static-libs(+)] ) |
933 |
+ opengl? ( |
934 |
+ virtual/opengl |
935 |
+ media-libs/libepoxy[static-libs(+)] |
936 |
+ media-libs/mesa[static-libs(+)] |
937 |
+ media-libs/mesa[egl,gbm] |
938 |
+ ) |
939 |
+ png? ( media-libs/libpng:0=[static-libs(+)] ) |
940 |
+ pulseaudio? ( media-sound/pulseaudio ) |
941 |
+ rbd? ( sys-cluster/ceph[static-libs(+)] ) |
942 |
+ sasl? ( dev-libs/cyrus-sasl[static-libs(+)] ) |
943 |
+ sdl? ( |
944 |
+ !sdl2? ( |
945 |
+ media-libs/libsdl[X] |
946 |
+ >=media-libs/libsdl-1.2.11[static-libs(+)] |
947 |
+ ) |
948 |
+ sdl2? ( |
949 |
+ media-libs/libsdl2[X] |
950 |
+ media-libs/libsdl2[static-libs(+)] |
951 |
+ ) |
952 |
+ ) |
953 |
+ seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] ) |
954 |
+ smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] ) |
955 |
+ snappy? ( app-arch/snappy:=[static-libs(+)] ) |
956 |
+ spice? ( |
957 |
+ >=app-emulation/spice-protocol-0.12.3 |
958 |
+ >=app-emulation/spice-0.12.0[static-libs(+)] |
959 |
+ ) |
960 |
+ ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] ) |
961 |
+ usb? ( >=virtual/libusb-1-r2[static-libs(+)] ) |
962 |
+ usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] ) |
963 |
+ vde? ( net-misc/vde[static-libs(+)] ) |
964 |
+ virgl? ( media-libs/virglrenderer[static-libs(+)] ) |
965 |
+ virtfs? ( sys-libs/libcap ) |
966 |
+ xen? ( app-emulation/xen-tools:= ) |
967 |
+ xfs? ( sys-fs/xfsprogs[static-libs(+)] )" |
968 |
+ |
969 |
+X86_FIRMWARE_DEPEND=" |
970 |
+ pin-upstream-blobs? ( |
971 |
+ ~sys-firmware/edk2-ovmf-2017_pre20170505[binary] |
972 |
+ ~sys-firmware/ipxe-1.0.0_p20160620 |
973 |
+ ~sys-firmware/seabios-1.10.2[binary,seavgabios] |
974 |
+ ~sys-firmware/sgabios-0.1_pre8 |
975 |
+ ) |
976 |
+ !pin-upstream-blobs? ( |
977 |
+ sys-firmware/edk2-ovmf |
978 |
+ sys-firmware/ipxe |
979 |
+ >=sys-firmware/seabios-1.10.2[seavgabios] |
980 |
+ sys-firmware/sgabios |
981 |
+ )" |
982 |
+ |
983 |
+CDEPEND=" |
984 |
+ !static? ( |
985 |
+ ${ALL_DEPEND//\[static-libs(+)]} |
986 |
+ ${SOFTMMU_TOOLS_DEPEND//\[static-libs(+)]} |
987 |
+ ) |
988 |
+ qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} ) |
989 |
+ qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )" |
990 |
+DEPEND="${CDEPEND} |
991 |
+ dev-lang/perl |
992 |
+ =dev-lang/python-2* |
993 |
+ sys-apps/texinfo |
994 |
+ virtual/pkgconfig |
995 |
+ kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 ) |
996 |
+ gtk? ( nls? ( sys-devel/gettext ) ) |
997 |
+ static? ( |
998 |
+ ${ALL_DEPEND} |
999 |
+ ${SOFTMMU_TOOLS_DEPEND} |
1000 |
+ ) |
1001 |
+ static-user? ( ${ALL_DEPEND} ) |
1002 |
+ test? ( |
1003 |
+ dev-libs/glib[utils] |
1004 |
+ sys-devel/bc |
1005 |
+ )" |
1006 |
+RDEPEND="${CDEPEND} |
1007 |
+ selinux? ( sec-policy/selinux-qemu )" |
1008 |
+ |
1009 |
+PATCHES=( |
1010 |
+ "${FILESDIR}"/${PN}-2.5.0-cflags.patch |
1011 |
+ "${FILESDIR}"/${PN}-2.5.0-sysmacros.patch |
1012 |
+ "${FILESDIR}"/${PN}-2.9.0-CVE-2017-8309.patch # bug 616870 |
1013 |
+ "${FILESDIR}"/${PN}-2.9.0-CVE-2017-8379.patch # bug 616872 |
1014 |
+ "${FILESDIR}"/${PN}-2.9.0-CVE-2017-8380.patch # bug 616874 |
1015 |
+ "${FILESDIR}"/${PN}-2.9.0-CVE-2017-8112.patch # bug 616636 |
1016 |
+ "${FILESDIR}"/${PN}-2.9.0-CVE-2017-7493.patch # bug 618808 |
1017 |
+ "${FILESDIR}"/${PN}-2.9.0-CVE-2017-11434.patch # bug 625614 |
1018 |
+ "${FILESDIR}"/${PN}-2.9.0-CVE-2017-11334.patch # bug 621292 |
1019 |
+ "${FILESDIR}"/${PN}-2.9.0-CVE-2017-9524-1.patch # bug 621292 |
1020 |
+ "${FILESDIR}"/${PN}-2.9.0-CVE-2017-9524-2.patch |
1021 |
+ "${FILESDIR}"/${PN}-2.9.0-CVE-2017-9503-1.patch # bug 621184 |
1022 |
+ "${FILESDIR}"/${PN}-2.9.0-CVE-2017-9503-2.patch |
1023 |
+ "${FILESDIR}"/${PN}-2.9.0-CVE-2017-10664.patch # bug 623016 |
1024 |
+ "${FILESDIR}"/${PN}-2.9.0-CVE-2017-10806.patch # bug 624088 |
1025 |
+) |
1026 |
+ |
1027 |
+STRIP_MASK="/usr/share/qemu/palcode-clipper" |
1028 |
+ |
1029 |
+QA_PREBUILT=" |
1030 |
+ usr/share/qemu/openbios-ppc |
1031 |
+ usr/share/qemu/openbios-sparc64 |
1032 |
+ usr/share/qemu/openbios-sparc32 |
1033 |
+ usr/share/qemu/palcode-clipper |
1034 |
+ usr/share/qemu/s390-ccw.img |
1035 |
+ usr/share/qemu/u-boot.e500" |
1036 |
+ |
1037 |
+QA_WX_LOAD="usr/bin/qemu-i386 |
1038 |
+ usr/bin/qemu-x86_64 |
1039 |
+ usr/bin/qemu-alpha |
1040 |
+ usr/bin/qemu-arm |
1041 |
+ usr/bin/qemu-cris |
1042 |
+ usr/bin/qemu-m68k |
1043 |
+ usr/bin/qemu-microblaze |
1044 |
+ usr/bin/qemu-microblazeel |
1045 |
+ usr/bin/qemu-mips |
1046 |
+ usr/bin/qemu-mipsel |
1047 |
+ usr/bin/qemu-or1k |
1048 |
+ usr/bin/qemu-ppc |
1049 |
+ usr/bin/qemu-ppc64 |
1050 |
+ usr/bin/qemu-ppc64abi32 |
1051 |
+ usr/bin/qemu-sh4 |
1052 |
+ usr/bin/qemu-sh4eb |
1053 |
+ usr/bin/qemu-sparc |
1054 |
+ usr/bin/qemu-sparc64 |
1055 |
+ usr/bin/qemu-armeb |
1056 |
+ usr/bin/qemu-sparc32plus |
1057 |
+ usr/bin/qemu-s390x |
1058 |
+ usr/bin/qemu-unicore32" |
1059 |
+ |
1060 |
+DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure you have the |
1061 |
+kernel module loaded before running kvm. The easiest way to ensure that the |
1062 |
+kernel module is loaded is to load it on boot. |
1063 |
+ For AMD CPUs the module is called 'kvm-amd'. |
1064 |
+ For Intel CPUs the module is called 'kvm-intel'. |
1065 |
+Please review /etc/conf.d/modules for how to load these. |
1066 |
+ |
1067 |
+Make sure your user is in the 'kvm' group. Just run |
1068 |
+ $ gpasswd -a <USER> kvm |
1069 |
+then have <USER> re-login. |
1070 |
+ |
1071 |
+For brand new installs, the default permissions on /dev/kvm might not let |
1072 |
+you access it. You can tell udev to reset ownership/perms: |
1073 |
+ $ udevadm trigger -c add /dev/kvm |
1074 |
+ |
1075 |
+If you want to register binfmt handlers for qemu user targets: |
1076 |
+For openrc: |
1077 |
+ # rc-update add qemu-binfmt |
1078 |
+For systemd: |
1079 |
+ # ln -s /usr/share/qemu/binfmt.d/qemu.conf /etc/binfmt.d/qemu.conf" |
1080 |
+ |
1081 |
+pkg_pretend() { |
1082 |
+ if use kernel_linux && kernel_is lt 2 6 25; then |
1083 |
+ eerror "This version of KVM requres a host kernel of 2.6.25 or higher." |
1084 |
+ elif use kernel_linux; then |
1085 |
+ if ! linux_config_exists; then |
1086 |
+ eerror "Unable to check your kernel for KVM support" |
1087 |
+ else |
1088 |
+ CONFIG_CHECK="~KVM ~TUN ~BRIDGE" |
1089 |
+ ERROR_KVM="You must enable KVM in your kernel to continue" |
1090 |
+ ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in" |
1091 |
+ ERROR_KVM_AMD+=" your kernel configuration." |
1092 |
+ ERROR_KVM_INTEL="If you have an Intel CPU, you must enable" |
1093 |
+ ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration." |
1094 |
+ ERROR_TUN="You will need the Universal TUN/TAP driver compiled" |
1095 |
+ ERROR_TUN+=" into your kernel or loaded as a module to use the" |
1096 |
+ ERROR_TUN+=" virtual network device if using -net tap." |
1097 |
+ ERROR_BRIDGE="You will also need support for 802.1d" |
1098 |
+ ERROR_BRIDGE+=" Ethernet Bridging for some network configurations." |
1099 |
+ use vhost-net && CONFIG_CHECK+=" ~VHOST_NET" |
1100 |
+ ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net" |
1101 |
+ ERROR_VHOST_NET+=" support" |
1102 |
+ |
1103 |
+ if use amd64 || use x86 || use amd64-linux || use x86-linux; then |
1104 |
+ CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL" |
1105 |
+ fi |
1106 |
+ |
1107 |
+ use python && CONFIG_CHECK+=" ~DEBUG_FS" |
1108 |
+ ERROR_DEBUG_FS="debugFS support required for kvm_stat" |
1109 |
+ |
1110 |
+ # Now do the actual checks setup above |
1111 |
+ check_extra_config |
1112 |
+ fi |
1113 |
+ fi |
1114 |
+ |
1115 |
+ if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then |
1116 |
+ eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt" |
1117 |
+ eerror "instances are still pointing to it. Please update your" |
1118 |
+ eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag" |
1119 |
+ eerror "and the right system binary (e.g. qemu-system-x86_64)." |
1120 |
+ die "update your virt configs to not use qemu-kvm" |
1121 |
+ fi |
1122 |
+} |
1123 |
+ |
1124 |
+pkg_setup() { |
1125 |
+ enewgroup kvm 78 |
1126 |
+} |
1127 |
+ |
1128 |
+# Sanity check to make sure target lists are kept up-to-date. |
1129 |
+check_targets() { |
1130 |
+ local var=$1 mak=$2 |
1131 |
+ local detected sorted |
1132 |
+ |
1133 |
+ pushd "${S}"/default-configs >/dev/null || die |
1134 |
+ |
1135 |
+ # Force C locale until glibc is updated. #564936 |
1136 |
+ detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u)) |
1137 |
+ sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u)) |
1138 |
+ if [[ ${sorted} != "${detected}" ]] ; then |
1139 |
+ eerror "The ebuild needs to be kept in sync." |
1140 |
+ eerror "${var}: ${sorted}" |
1141 |
+ eerror "$(printf '%-*s' ${#var} configure): ${detected}" |
1142 |
+ die "sync ${var} to the list of targets" |
1143 |
+ fi |
1144 |
+ |
1145 |
+ popd >/dev/null |
1146 |
+} |
1147 |
+ |
1148 |
+handle_locales() { |
1149 |
+ # Make sure locale list is kept up-to-date. |
1150 |
+ local detected sorted |
1151 |
+ detected=$(echo $(cd po && printf '%s\n' *.po | grep -v messages.po | sed 's:.po$::' | sort -u)) |
1152 |
+ sorted=$(echo $(printf '%s\n' ${PLOCALES} | sort -u)) |
1153 |
+ if [[ ${sorted} != "${detected}" ]] ; then |
1154 |
+ eerror "The ebuild needs to be kept in sync." |
1155 |
+ eerror "PLOCALES: ${sorted}" |
1156 |
+ eerror " po/*.po: ${detected}" |
1157 |
+ die "sync PLOCALES" |
1158 |
+ fi |
1159 |
+ |
1160 |
+ # Deal with selective install of locales. |
1161 |
+ if use nls ; then |
1162 |
+ # Delete locales the user does not want. #577814 |
1163 |
+ rm_loc() { rm po/$1.po || die; } |
1164 |
+ l10n_for_each_disabled_locale_do rm_loc |
1165 |
+ else |
1166 |
+ # Cheap hack to disable gettext .mo generation. |
1167 |
+ rm -f po/*.po |
1168 |
+ fi |
1169 |
+} |
1170 |
+ |
1171 |
+src_prepare() { |
1172 |
+ check_targets IUSE_SOFTMMU_TARGETS softmmu |
1173 |
+ check_targets IUSE_USER_TARGETS linux-user |
1174 |
+ |
1175 |
+ # Alter target makefiles to accept CFLAGS set via flag-o |
1176 |
+ sed -i -r \ |
1177 |
+ -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \ |
1178 |
+ Makefile Makefile.target || die |
1179 |
+ |
1180 |
+ default |
1181 |
+ |
1182 |
+ # Fix ld and objcopy being called directly |
1183 |
+ tc-export AR LD OBJCOPY |
1184 |
+ |
1185 |
+ # Verbose builds |
1186 |
+ MAKEOPTS+=" V=1" |
1187 |
+ |
1188 |
+ # Run after we've applied all patches. |
1189 |
+ handle_locales |
1190 |
+ |
1191 |
+ #remove bundled copy of libfdt |
1192 |
+ rm -r dtc || die |
1193 |
+} |
1194 |
+ |
1195 |
+## |
1196 |
+# configures qemu based on the build directory and the build type |
1197 |
+# we are using. |
1198 |
+# |
1199 |
+qemu_src_configure() { |
1200 |
+ debug-print-function ${FUNCNAME} "$@" |
1201 |
+ |
1202 |
+ local buildtype=$1 |
1203 |
+ local builddir="${S}/${buildtype}-build" |
1204 |
+ |
1205 |
+ mkdir "${builddir}" |
1206 |
+ |
1207 |
+ local conf_opts=( |
1208 |
+ --prefix=/usr |
1209 |
+ --sysconfdir=/etc |
1210 |
+ --libdir=/usr/$(get_libdir) |
1211 |
+ --docdir=/usr/share/doc/${PF}/html |
1212 |
+ --disable-bsd-user |
1213 |
+ --disable-guest-agent |
1214 |
+ --disable-strip |
1215 |
+ --disable-werror |
1216 |
+ # We support gnutls/nettle for crypto operations. It is possible |
1217 |
+ # to use gcrypt when gnutls/nettle are disabled (but not when they |
1218 |
+ # are enabled), but it's not really worth the hassle. Disable it |
1219 |
+ # all the time to avoid automatically detecting it. #568856 |
1220 |
+ --disable-gcrypt |
1221 |
+ --python="${PYTHON}" |
1222 |
+ --cc="$(tc-getCC)" |
1223 |
+ --cxx="$(tc-getCXX)" |
1224 |
+ --host-cc="$(tc-getBUILD_CC)" |
1225 |
+ $(use_enable debug debug-info) |
1226 |
+ $(use_enable debug debug-tcg) |
1227 |
+ --enable-docs |
1228 |
+ $(use_enable tci tcg-interpreter) |
1229 |
+ $(use_enable xattr attr) |
1230 |
+ ) |
1231 |
+ |
1232 |
+ # Disable options not used by user targets. This simplifies building |
1233 |
+ # static user targets (USE=static-user) considerably. |
1234 |
+ conf_notuser() { |
1235 |
+ if [[ ${buildtype} == "user" ]] ; then |
1236 |
+ echo "--disable-${2:-$1}" |
1237 |
+ else |
1238 |
+ use_enable "$@" |
1239 |
+ fi |
1240 |
+ } |
1241 |
+ conf_opts+=( |
1242 |
+ $(conf_notuser accessibility brlapi) |
1243 |
+ $(conf_notuser aio linux-aio) |
1244 |
+ $(conf_notuser bzip2) |
1245 |
+ $(conf_notuser bluetooth bluez) |
1246 |
+ $(conf_notuser caps cap-ng) |
1247 |
+ $(conf_notuser curl) |
1248 |
+ $(conf_notuser fdt) |
1249 |
+ $(conf_notuser glusterfs) |
1250 |
+ $(conf_notuser gnutls) |
1251 |
+ $(conf_notuser gnutls nettle) |
1252 |
+ $(conf_notuser gtk) |
1253 |
+ $(conf_notuser infiniband rdma) |
1254 |
+ $(conf_notuser iscsi libiscsi) |
1255 |
+ $(conf_notuser jpeg vnc-jpeg) |
1256 |
+ $(conf_notuser kernel_linux kvm) |
1257 |
+ $(conf_notuser lzo) |
1258 |
+ $(conf_notuser ncurses curses) |
1259 |
+ $(conf_notuser nfs libnfs) |
1260 |
+ $(conf_notuser numa) |
1261 |
+ $(conf_notuser opengl) |
1262 |
+ $(conf_notuser png vnc-png) |
1263 |
+ $(conf_notuser rbd) |
1264 |
+ $(conf_notuser sasl vnc-sasl) |
1265 |
+ $(conf_notuser sdl) |
1266 |
+ $(conf_notuser seccomp) |
1267 |
+ $(conf_notuser smartcard) |
1268 |
+ $(conf_notuser snappy) |
1269 |
+ $(conf_notuser spice) |
1270 |
+ $(conf_notuser ssh libssh2) |
1271 |
+ $(conf_notuser usb libusb) |
1272 |
+ $(conf_notuser usbredir usb-redir) |
1273 |
+ $(conf_notuser vde) |
1274 |
+ $(conf_notuser vhost-net) |
1275 |
+ $(conf_notuser virgl virglrenderer) |
1276 |
+ $(conf_notuser virtfs) |
1277 |
+ $(conf_notuser vnc) |
1278 |
+ $(conf_notuser vte) |
1279 |
+ $(conf_notuser xen) |
1280 |
+ $(conf_notuser xen xen-pci-passthrough) |
1281 |
+ $(conf_notuser xfs xfsctl) |
1282 |
+ ) |
1283 |
+ |
1284 |
+ if [[ ! ${buildtype} == "user" ]] ; then |
1285 |
+ # audio options |
1286 |
+ local audio_opts="oss" |
1287 |
+ use alsa && audio_opts="alsa,${audio_opts}" |
1288 |
+ use sdl && audio_opts="sdl,${audio_opts}" |
1289 |
+ use pulseaudio && audio_opts="pa,${audio_opts}" |
1290 |
+ conf_opts+=( |
1291 |
+ --audio-drv-list="${audio_opts}" |
1292 |
+ ) |
1293 |
+ use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) ) |
1294 |
+ use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) ) |
1295 |
+ fi |
1296 |
+ |
1297 |
+ case ${buildtype} in |
1298 |
+ user) |
1299 |
+ conf_opts+=( |
1300 |
+ --enable-linux-user |
1301 |
+ --disable-system |
1302 |
+ --disable-blobs |
1303 |
+ --disable-tools |
1304 |
+ ) |
1305 |
+ local static_flag="static-user" |
1306 |
+ ;; |
1307 |
+ softmmu) |
1308 |
+ conf_opts+=( |
1309 |
+ --disable-linux-user |
1310 |
+ --enable-system |
1311 |
+ --disable-tools |
1312 |
+ --with-system-pixman |
1313 |
+ ) |
1314 |
+ local static_flag="static" |
1315 |
+ ;; |
1316 |
+ tools) |
1317 |
+ conf_opts+=( |
1318 |
+ --disable-linux-user |
1319 |
+ --disable-system |
1320 |
+ --disable-blobs |
1321 |
+ --enable-tools |
1322 |
+ ) |
1323 |
+ local static_flag="static" |
1324 |
+ ;; |
1325 |
+ esac |
1326 |
+ |
1327 |
+ local targets="${buildtype}_targets" |
1328 |
+ [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" ) |
1329 |
+ |
1330 |
+ # Add support for SystemTAP |
1331 |
+ use systemtap && conf_opts+=( --enable-trace-backend=dtrace ) |
1332 |
+ |
1333 |
+ # We always want to attempt to build with PIE support as it results |
1334 |
+ # in a more secure binary. But it doesn't work with static or if |
1335 |
+ # the current GCC doesn't have PIE support. |
1336 |
+ if use ${static_flag}; then |
1337 |
+ conf_opts+=( --static --disable-pie ) |
1338 |
+ else |
1339 |
+ tc-enables-pie && conf_opts+=( --enable-pie ) |
1340 |
+ fi |
1341 |
+ |
1342 |
+ echo "../configure ${conf_opts[*]}" |
1343 |
+ cd "${builddir}" |
1344 |
+ ../configure "${conf_opts[@]}" || die "configure failed" |
1345 |
+ |
1346 |
+ # FreeBSD's kernel does not support QEMU assigning/grabbing |
1347 |
+ # host USB devices yet |
1348 |
+ use kernel_FreeBSD && \ |
1349 |
+ sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak |
1350 |
+} |
1351 |
+ |
1352 |
+src_configure() { |
1353 |
+ local target |
1354 |
+ |
1355 |
+ python_setup |
1356 |
+ |
1357 |
+ softmmu_targets= softmmu_bins=() |
1358 |
+ user_targets= user_bins=() |
1359 |
+ |
1360 |
+ for target in ${IUSE_SOFTMMU_TARGETS} ; do |
1361 |
+ if use "qemu_softmmu_targets_${target}"; then |
1362 |
+ softmmu_targets+=",${target}-softmmu" |
1363 |
+ softmmu_bins+=( "qemu-system-${target}" ) |
1364 |
+ fi |
1365 |
+ done |
1366 |
+ |
1367 |
+ for target in ${IUSE_USER_TARGETS} ; do |
1368 |
+ if use "qemu_user_targets_${target}"; then |
1369 |
+ user_targets+=",${target}-linux-user" |
1370 |
+ user_bins+=( "qemu-${target}" ) |
1371 |
+ fi |
1372 |
+ done |
1373 |
+ |
1374 |
+ softmmu_targets=${softmmu_targets#,} |
1375 |
+ user_targets=${user_targets#,} |
1376 |
+ |
1377 |
+ [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu" |
1378 |
+ [[ -n ${user_targets} ]] && qemu_src_configure "user" |
1379 |
+ qemu_src_configure "tools" |
1380 |
+} |
1381 |
+ |
1382 |
+src_compile() { |
1383 |
+ if [[ -n ${user_targets} ]]; then |
1384 |
+ cd "${S}/user-build" |
1385 |
+ default |
1386 |
+ fi |
1387 |
+ |
1388 |
+ if [[ -n ${softmmu_targets} ]]; then |
1389 |
+ cd "${S}/softmmu-build" |
1390 |
+ default |
1391 |
+ fi |
1392 |
+ |
1393 |
+ cd "${S}/tools-build" |
1394 |
+ default |
1395 |
+} |
1396 |
+ |
1397 |
+src_test() { |
1398 |
+ if [[ -n ${softmmu_targets} ]]; then |
1399 |
+ cd "${S}/softmmu-build" |
1400 |
+ pax-mark m */qemu-system-* #515550 |
1401 |
+ emake -j1 check |
1402 |
+ emake -j1 check-report.html |
1403 |
+ fi |
1404 |
+} |
1405 |
+ |
1406 |
+qemu_python_install() { |
1407 |
+ python_domodule "${S}/scripts/qmp/qmp.py" |
1408 |
+ |
1409 |
+ python_doscript "${S}/scripts/kvm/vmxcap" |
1410 |
+ python_doscript "${S}/scripts/qmp/qmp-shell" |
1411 |
+ python_doscript "${S}/scripts/qmp/qemu-ga-client" |
1412 |
+} |
1413 |
+ |
1414 |
+# Generate binfmt support files. |
1415 |
+# - /etc/init.d/qemu-binfmt script which registers the user handlers (openrc) |
1416 |
+# - /usr/share/qemu/binfmt.d/qemu.conf (for use with systemd-binfmt) |
1417 |
+generate_initd() { |
1418 |
+ local out="${T}/qemu-binfmt" |
1419 |
+ local out_systemd="${T}/qemu.conf" |
1420 |
+ local d="${T}/binfmt.d" |
1421 |
+ |
1422 |
+ einfo "Generating qemu binfmt scripts and configuration files" |
1423 |
+ |
1424 |
+ # Generate the debian fragments first. |
1425 |
+ mkdir -p "${d}" |
1426 |
+ "${S}"/scripts/qemu-binfmt-conf.sh \ |
1427 |
+ --debian \ |
1428 |
+ --exportdir "${d}" \ |
1429 |
+ --qemu-path "${EPREFIX}/usr/bin" \ |
1430 |
+ || die |
1431 |
+ # Then turn the fragments into a shell script we can source. |
1432 |
+ sed -E -i \ |
1433 |
+ -e 's:^([^ ]+) (.*)$:\1="\2":' \ |
1434 |
+ "${d}"/* || die |
1435 |
+ |
1436 |
+ # Generate the init.d script by assembling the fragments from above. |
1437 |
+ local f qcpu package interpreter magic mask |
1438 |
+ cat "${FILESDIR}"/qemu-binfmt.initd.head >"${out}" || die |
1439 |
+ for f in "${d}"/qemu-* ; do |
1440 |
+ source "${f}" |
1441 |
+ |
1442 |
+ # Normalize the cpu logic like we do in the init.d for the native cpu. |
1443 |
+ qcpu=${package#qemu-} |
1444 |
+ case ${qcpu} in |
1445 |
+ arm*) qcpu="arm";; |
1446 |
+ mips*) qcpu="mips";; |
1447 |
+ ppc*) qcpu="ppc";; |
1448 |
+ s390*) qcpu="s390";; |
1449 |
+ sh*) qcpu="sh";; |
1450 |
+ sparc*) qcpu="sparc";; |
1451 |
+ esac |
1452 |
+ |
1453 |
+ cat <<EOF >>"${out}" |
1454 |
+ if [ "\${cpu}" != "${qcpu}" -a -x "${interpreter}" ] ; then |
1455 |
+ echo ':${package}:M::${magic}:${mask}:${interpreter}:'"\${QEMU_BINFMT_FLAGS}" >/proc/sys/fs/binfmt_misc/register |
1456 |
+ fi |
1457 |
+EOF |
1458 |
+ |
1459 |
+ echo ":${package}:M::${magic}:${mask}:${interpreter}:OC" >>"${out_systemd}" |
1460 |
+ |
1461 |
+ done |
1462 |
+ cat "${FILESDIR}"/qemu-binfmt.initd.tail >>"${out}" || die |
1463 |
+} |
1464 |
+ |
1465 |
+src_install() { |
1466 |
+ if [[ -n ${user_targets} ]]; then |
1467 |
+ cd "${S}/user-build" |
1468 |
+ emake DESTDIR="${ED}" install |
1469 |
+ |
1470 |
+ # Install binfmt handler init script for user targets. |
1471 |
+ generate_initd |
1472 |
+ doinitd "${T}/qemu-binfmt" |
1473 |
+ |
1474 |
+ # Install binfmt/qemu.conf. |
1475 |
+ insinto "/usr/share/qemu/binfmt.d" |
1476 |
+ doins "${T}/qemu.conf" |
1477 |
+ fi |
1478 |
+ |
1479 |
+ if [[ -n ${softmmu_targets} ]]; then |
1480 |
+ cd "${S}/softmmu-build" |
1481 |
+ emake DESTDIR="${ED}" install |
1482 |
+ |
1483 |
+ # This might not exist if the test failed. #512010 |
1484 |
+ [[ -e check-report.html ]] && dohtml check-report.html |
1485 |
+ |
1486 |
+ if use kernel_linux; then |
1487 |
+ udev_newrules "${FILESDIR}"/65-kvm.rules-r1 65-kvm.rules |
1488 |
+ fi |
1489 |
+ |
1490 |
+ if use python; then |
1491 |
+ python_foreach_impl qemu_python_install |
1492 |
+ fi |
1493 |
+ fi |
1494 |
+ |
1495 |
+ cd "${S}/tools-build" |
1496 |
+ emake DESTDIR="${ED}" install |
1497 |
+ |
1498 |
+ # Disable mprotect on the qemu binaries as they use JITs to be fast #459348 |
1499 |
+ pushd "${ED}"/usr/bin >/dev/null |
1500 |
+ pax-mark mr "${softmmu_bins[@]}" "${user_bins[@]}" # bug 575594 |
1501 |
+ popd >/dev/null |
1502 |
+ |
1503 |
+ # Install config file example for qemu-bridge-helper |
1504 |
+ insinto "/etc/qemu" |
1505 |
+ doins "${FILESDIR}/bridge.conf" |
1506 |
+ |
1507 |
+ cd "${S}" |
1508 |
+ dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt |
1509 |
+ newdoc pc-bios/README README.pc-bios |
1510 |
+ dodoc docs/qmp-*.txt |
1511 |
+ |
1512 |
+ if [[ -n ${softmmu_targets} ]]; then |
1513 |
+ # Remove SeaBIOS since we're using the SeaBIOS packaged one |
1514 |
+ rm "${ED}/usr/share/qemu/bios.bin" |
1515 |
+ rm "${ED}/usr/share/qemu/bios-256k.bin" |
1516 |
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then |
1517 |
+ dosym ../seabios/bios.bin /usr/share/qemu/bios.bin |
1518 |
+ dosym ../seabios/bios-256k.bin /usr/share/qemu/bios-256k.bin |
1519 |
+ fi |
1520 |
+ |
1521 |
+ # Remove vgabios since we're using the seavgabios packaged one |
1522 |
+ rm "${ED}/usr/share/qemu/vgabios.bin" |
1523 |
+ rm "${ED}/usr/share/qemu/vgabios-cirrus.bin" |
1524 |
+ rm "${ED}/usr/share/qemu/vgabios-qxl.bin" |
1525 |
+ rm "${ED}/usr/share/qemu/vgabios-stdvga.bin" |
1526 |
+ rm "${ED}/usr/share/qemu/vgabios-virtio.bin" |
1527 |
+ rm "${ED}/usr/share/qemu/vgabios-vmware.bin" |
1528 |
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then |
1529 |
+ dosym ../seavgabios/vgabios-isavga.bin /usr/share/qemu/vgabios.bin |
1530 |
+ dosym ../seavgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin |
1531 |
+ dosym ../seavgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin |
1532 |
+ dosym ../seavgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin |
1533 |
+ dosym ../seavgabios/vgabios-virtio.bin /usr/share/qemu/vgabios-virtio.bin |
1534 |
+ dosym ../seavgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin |
1535 |
+ fi |
1536 |
+ |
1537 |
+ # Remove sgabios since we're using the sgabios packaged one |
1538 |
+ rm "${ED}/usr/share/qemu/sgabios.bin" |
1539 |
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then |
1540 |
+ dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin |
1541 |
+ fi |
1542 |
+ |
1543 |
+ # Remove iPXE since we're using the iPXE packaged one |
1544 |
+ rm "${ED}"/usr/share/qemu/pxe-*.rom |
1545 |
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then |
1546 |
+ dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom |
1547 |
+ dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom |
1548 |
+ dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom |
1549 |
+ dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom |
1550 |
+ dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom |
1551 |
+ dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom |
1552 |
+ fi |
1553 |
+ fi |
1554 |
+ |
1555 |
+ DISABLE_AUTOFORMATTING=true |
1556 |
+ readme.gentoo_create_doc |
1557 |
+} |
1558 |
+ |
1559 |
+firmware_abi_change() { |
1560 |
+ local pv |
1561 |
+ for pv in ${REPLACING_VERSIONS}; do |
1562 |
+ if ! version_is_at_least ${FIRMWARE_ABI_VERSION} ${pv}; then |
1563 |
+ return 0 |
1564 |
+ fi |
1565 |
+ done |
1566 |
+ return 1 |
1567 |
+} |
1568 |
+ |
1569 |
+pkg_postinst() { |
1570 |
+ if [[ -n ${softmmu_targets} ]] && use kernel_linux; then |
1571 |
+ udev_reload |
1572 |
+ fi |
1573 |
+ |
1574 |
+ fcaps cap_net_admin /usr/libexec/qemu-bridge-helper |
1575 |
+ |
1576 |
+ DISABLE_AUTOFORMATTING=true |
1577 |
+ readme.gentoo_print_elog |
1578 |
+ |
1579 |
+ if use pin-upstream-blobs && firmware_abi_change; then |
1580 |
+ ewarn "This version of qemu pins new versions of firmware blobs:" |
1581 |
+ ewarn " $(best_version sys-firmware/edk2-ovmf)" |
1582 |
+ ewarn " $(best_version sys-firmware/ipxe)" |
1583 |
+ ewarn " $(best_version sys-firmware/seabios)" |
1584 |
+ ewarn " $(best_version sys-firmware/sgabios)" |
1585 |
+ ewarn "This might break resume of hibernated guests (started with a different" |
1586 |
+ ewarn "firmware version) and live migration to/from qemu versions with different" |
1587 |
+ ewarn "firmware. Please (cold) restart all running guests. For functional" |
1588 |
+ ewarn "guest migration ensure that all" |
1589 |
+ ewarn "hosts run at least" |
1590 |
+ ewarn " app-emulation/qemu-${FIRMWARE_ABI_VERSION}." |
1591 |
+ fi |
1592 |
+} |
1593 |
+ |
1594 |
+pkg_info() { |
1595 |
+ echo "Using:" |
1596 |
+ echo " $(best_version app-emulation/spice-protocol)" |
1597 |
+ echo " $(best_version sys-firmware/edk2-ovmf)" |
1598 |
+ if has_version 'sys-firmware/edk2-ovmf[binary]'; then |
1599 |
+ echo " USE=binary" |
1600 |
+ else |
1601 |
+ echo " USE=''" |
1602 |
+ fi |
1603 |
+ echo " $(best_version sys-firmware/ipxe)" |
1604 |
+ echo " $(best_version sys-firmware/seabios)" |
1605 |
+ if has_version 'sys-firmware/seabios[binary]'; then |
1606 |
+ echo " USE=binary" |
1607 |
+ else |
1608 |
+ echo " USE=''" |
1609 |
+ fi |
1610 |
+ echo " $(best_version sys-firmware/sgabios)" |
1611 |
+} |