1 |
cardoe 15/07/25 19:53:47 |
2 |
|
3 |
Modified: ChangeLog |
4 |
Added: qemu-2.3.0-r3.ebuild |
5 |
Log: |
6 |
Add fix from upstream for CVE-2015-5158 #555680 by Agostino Sarubbo. |
7 |
|
8 |
(Portage version: 2.2.20/cvs/Linux x86_64, signed Manifest commit with key A2BC03DC87ED1BD4!) |
9 |
|
10 |
Revision Changes Path |
11 |
1.338 app-emulation/qemu/ChangeLog |
12 |
|
13 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/qemu/ChangeLog?rev=1.338&view=markup |
14 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/qemu/ChangeLog?rev=1.338&content-type=text/plain |
15 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/qemu/ChangeLog?r1=1.337&r2=1.338 |
16 |
|
17 |
Index: ChangeLog |
18 |
=================================================================== |
19 |
RCS file: /var/cvsroot/gentoo-x86/app-emulation/qemu/ChangeLog,v |
20 |
retrieving revision 1.337 |
21 |
retrieving revision 1.338 |
22 |
diff -u -r1.337 -r1.338 |
23 |
--- ChangeLog 25 Jul 2015 19:30:13 -0000 1.337 |
24 |
+++ ChangeLog 25 Jul 2015 19:53:47 -0000 1.338 |
25 |
@@ -1,6 +1,12 @@ |
26 |
# ChangeLog for app-emulation/qemu |
27 |
# Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2 |
28 |
-# $Header: /var/cvsroot/gentoo-x86/app-emulation/qemu/ChangeLog,v 1.337 2015/07/25 19:30:13 cardoe Exp $ |
29 |
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/qemu/ChangeLog,v 1.338 2015/07/25 19:53:47 cardoe Exp $ |
30 |
+ |
31 |
+*qemu-2.3.0-r3 (25 Jul 2015) |
32 |
+ |
33 |
+ 25 Jul 2015; Doug Goldstein <cardoe@g.o> |
34 |
+ +files/qemu-2.3.0-CVE-2015-5158.patch, +qemu-2.3.0-r3.ebuild: |
35 |
+ Add fix from upstream for CVE-2015-5158 #555680 by Agostino Sarubbo. |
36 |
|
37 |
25 Jul 2015; Doug Goldstein <cardoe@g.o> qemu-9999.ebuild: |
38 |
Upstream made VNC WebSockets unconditional. As of commit |
39 |
|
40 |
|
41 |
|
42 |
1.1 app-emulation/qemu/qemu-2.3.0-r3.ebuild |
43 |
|
44 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/qemu/qemu-2.3.0-r3.ebuild?rev=1.1&view=markup |
45 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/qemu/qemu-2.3.0-r3.ebuild?rev=1.1&content-type=text/plain |
46 |
|
47 |
Index: qemu-2.3.0-r3.ebuild |
48 |
=================================================================== |
49 |
# Copyright 1999-2015 Gentoo Foundation |
50 |
# Distributed under the terms of the GNU General Public License v2 |
51 |
# $Header: /var/cvsroot/gentoo-x86/app-emulation/qemu/qemu-2.3.0-r3.ebuild,v 1.1 2015/07/25 19:53:47 cardoe Exp $ |
52 |
|
53 |
EAPI=5 |
54 |
|
55 |
PYTHON_COMPAT=( python2_7 ) |
56 |
PYTHON_REQ_USE="ncurses,readline" |
57 |
|
58 |
inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \ |
59 |
user udev fcaps readme.gentoo pax-utils |
60 |
|
61 |
BACKPORTS= |
62 |
|
63 |
if [[ ${PV} = *9999* ]]; then |
64 |
EGIT_REPO_URI="git://git.qemu.org/qemu.git" |
65 |
inherit git-2 |
66 |
SRC_URI="" |
67 |
else |
68 |
SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2 |
69 |
${BACKPORTS:+ |
70 |
http://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}" |
71 |
KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd" |
72 |
fi |
73 |
|
74 |
DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools" |
75 |
HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org" |
76 |
|
77 |
LICENSE="GPL-2 LGPL-2 BSD-2" |
78 |
SLOT="0" |
79 |
IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \ |
80 |
gtk gtk2 infiniband iscsi +jpeg \ |
81 |
kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs |
82 |
+png pulseaudio python \ |
83 |
rbd sasl +seccomp sdl selinux smartcard snappy spice ssh static static-softmmu \ |
84 |
static-user systemtap tci test +threads tls usb usbredir +uuid vde +vhost-net \ |
85 |
virtfs +vnc xattr xen xfs" |
86 |
|
87 |
COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips |
88 |
mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32 |
89 |
x86_64" |
90 |
IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb xtensa xtensaeb" |
91 |
IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 sparc32plus" |
92 |
|
93 |
use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS}) |
94 |
use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS}) |
95 |
IUSE+=" ${use_softmmu_targets} ${use_user_targets}" |
96 |
|
97 |
# Require at least one softmmu or user target. |
98 |
# Block USE flag configurations known to not work. |
99 |
REQUIRED_USE="|| ( ${use_softmmu_targets} ${use_user_targets} ) |
100 |
${PYTHON_REQUIRED_USE} |
101 |
gtk2? ( gtk ) |
102 |
qemu_softmmu_targets_arm? ( fdt ) |
103 |
qemu_softmmu_targets_microblaze? ( fdt ) |
104 |
qemu_softmmu_targets_ppc? ( fdt ) |
105 |
qemu_softmmu_targets_ppc64? ( fdt ) |
106 |
static? ( static-softmmu static-user ) |
107 |
static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 ) |
108 |
virtfs? ( xattr )" |
109 |
|
110 |
# Yep, you need both libcap and libcap-ng since virtfs only uses libcap. |
111 |
# |
112 |
# The attr lib isn't always linked in (although the USE flag is always |
113 |
# respected). This is because qemu supports using the C library's API |
114 |
# when available rather than always using the extranl library. |
115 |
COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)] |
116 |
sys-libs/zlib[static-libs(+)] |
117 |
xattr? ( sys-apps/attr[static-libs(+)] )" |
118 |
SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND} |
119 |
>=x11-libs/pixman-0.28.0[static-libs(+)] |
120 |
aio? ( dev-libs/libaio[static-libs(+)] ) |
121 |
caps? ( sys-libs/libcap-ng[static-libs(+)] ) |
122 |
curl? ( >=net-misc/curl-7.15.4[static-libs(+)] ) |
123 |
fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] ) |
124 |
glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] ) |
125 |
infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] ) |
126 |
jpeg? ( virtual/jpeg:=[static-libs(+)] ) |
127 |
lzo? ( dev-libs/lzo:2[static-libs(+)] ) |
128 |
ncurses? ( sys-libs/ncurses[static-libs(+)] ) |
129 |
nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] ) |
130 |
numa? ( sys-process/numactl[static-libs(+)] ) |
131 |
png? ( media-libs/libpng:0=[static-libs(+)] ) |
132 |
rbd? ( sys-cluster/ceph[static-libs(+)] ) |
133 |
sasl? ( dev-libs/cyrus-sasl[static-libs(+)] ) |
134 |
sdl? ( >=media-libs/libsdl-1.2.11[static-libs(+)] ) |
135 |
seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] ) |
136 |
snappy? ( app-arch/snappy[static-libs(+)] ) |
137 |
spice? ( >=app-emulation/spice-0.12.0[static-libs(+)] ) |
138 |
ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] ) |
139 |
tls? ( net-libs/gnutls[static-libs(+)] ) |
140 |
usb? ( >=dev-libs/libusb-1.0.18[static-libs(+)] ) |
141 |
uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] ) |
142 |
vde? ( net-misc/vde[static-libs(+)] ) |
143 |
xfs? ( sys-fs/xfsprogs[static-libs(+)] )" |
144 |
USER_LIB_DEPEND="${COMMON_LIB_DEPEND}" |
145 |
X86_FIRMWARE_DEPEND=" |
146 |
>=sys-firmware/ipxe-1.0.0_p20130624 |
147 |
pin-upstream-blobs? ( |
148 |
~sys-firmware/seabios-1.7.5 |
149 |
~sys-firmware/sgabios-0.1_pre8 |
150 |
~sys-firmware/vgabios-0.7a |
151 |
) |
152 |
!pin-upstream-blobs? ( |
153 |
sys-firmware/seabios |
154 |
sys-firmware/sgabios |
155 |
sys-firmware/vgabios |
156 |
)" |
157 |
CDEPEND=" |
158 |
!static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) ) |
159 |
!static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) ) |
160 |
qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} ) |
161 |
qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} ) |
162 |
accessibility? ( app-accessibility/brltty ) |
163 |
alsa? ( >=media-libs/alsa-lib-1.0.13 ) |
164 |
bluetooth? ( net-wireless/bluez ) |
165 |
gtk? ( |
166 |
gtk2? ( x11-libs/gtk+:2 ) |
167 |
!gtk2? ( x11-libs/gtk+:3 ) |
168 |
x11-libs/vte:2.90 |
169 |
) |
170 |
iscsi? ( net-libs/libiscsi ) |
171 |
opengl? ( virtual/opengl ) |
172 |
pulseaudio? ( media-sound/pulseaudio ) |
173 |
python? ( ${PYTHON_DEPS} ) |
174 |
sdl? ( media-libs/libsdl[X] ) |
175 |
smartcard? ( dev-libs/nss !app-emulation/libcacard ) |
176 |
spice? ( >=app-emulation/spice-protocol-0.12.3 ) |
177 |
systemtap? ( dev-util/systemtap ) |
178 |
usbredir? ( >=sys-apps/usbredir-0.6 ) |
179 |
virtfs? ( sys-libs/libcap ) |
180 |
xen? ( app-emulation/xen-tools )" |
181 |
DEPEND="${CDEPEND} |
182 |
dev-lang/perl |
183 |
=dev-lang/python-2* |
184 |
sys-apps/texinfo |
185 |
virtual/pkgconfig |
186 |
kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 ) |
187 |
gtk? ( nls? ( sys-devel/gettext ) ) |
188 |
static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) ) |
189 |
static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) ) |
190 |
test? ( |
191 |
dev-libs/glib[utils] |
192 |
sys-devel/bc |
193 |
)" |
194 |
RDEPEND="${CDEPEND} |
195 |
selinux? ( sec-policy/selinux-qemu ) |
196 |
" |
197 |
|
198 |
STRIP_MASK="/usr/share/qemu/palcode-clipper" |
199 |
|
200 |
QA_PREBUILT=" |
201 |
usr/share/qemu/openbios-ppc |
202 |
usr/share/qemu/openbios-sparc64 |
203 |
usr/share/qemu/openbios-sparc32 |
204 |
usr/share/qemu/palcode-clipper |
205 |
usr/share/qemu/s390-ccw.img |
206 |
usr/share/qemu/u-boot.e500 |
207 |
" |
208 |
|
209 |
QA_WX_LOAD="usr/bin/qemu-i386 |
210 |
usr/bin/qemu-x86_64 |
211 |
usr/bin/qemu-alpha |
212 |
usr/bin/qemu-arm |
213 |
usr/bin/qemu-cris |
214 |
usr/bin/qemu-m68k |
215 |
usr/bin/qemu-microblaze |
216 |
usr/bin/qemu-microblazeel |
217 |
usr/bin/qemu-mips |
218 |
usr/bin/qemu-mipsel |
219 |
usr/bin/qemu-or32 |
220 |
usr/bin/qemu-ppc |
221 |
usr/bin/qemu-ppc64 |
222 |
usr/bin/qemu-ppc64abi32 |
223 |
usr/bin/qemu-sh4 |
224 |
usr/bin/qemu-sh4eb |
225 |
usr/bin/qemu-sparc |
226 |
usr/bin/qemu-sparc64 |
227 |
usr/bin/qemu-armeb |
228 |
usr/bin/qemu-sparc32plus |
229 |
usr/bin/qemu-s390x |
230 |
usr/bin/qemu-unicore32" |
231 |
|
232 |
DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure |
233 |
you have the kernel module loaded before running kvm. The easiest way to |
234 |
ensure that the kernel module is loaded is to load it on boot.\n |
235 |
For AMD CPUs the module is called 'kvm-amd'\n |
236 |
For Intel CPUs the module is called 'kvm-intel'\n |
237 |
Please review /etc/conf.d/modules for how to load these\n\n |
238 |
Make sure your user is in the 'kvm' group\n |
239 |
Just run 'gpasswd -a <USER> kvm', then have <USER> re-login." |
240 |
|
241 |
qemu_support_kvm() { |
242 |
if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \ |
243 |
use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \ |
244 |
use qemu_softmmu_targets_s390x; then |
245 |
return 0 |
246 |
fi |
247 |
|
248 |
return 1 |
249 |
} |
250 |
|
251 |
pkg_pretend() { |
252 |
if use kernel_linux && kernel_is lt 2 6 25; then |
253 |
eerror "This version of KVM requres a host kernel of 2.6.25 or higher." |
254 |
elif use kernel_linux; then |
255 |
if ! linux_config_exists; then |
256 |
eerror "Unable to check your kernel for KVM support" |
257 |
else |
258 |
CONFIG_CHECK="~KVM ~TUN ~BRIDGE" |
259 |
ERROR_KVM="You must enable KVM in your kernel to continue" |
260 |
ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in" |
261 |
ERROR_KVM_AMD+=" your kernel configuration." |
262 |
ERROR_KVM_INTEL="If you have an Intel CPU, you must enable" |
263 |
ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration." |
264 |
ERROR_TUN="You will need the Universal TUN/TAP driver compiled" |
265 |
ERROR_TUN+=" into your kernel or loaded as a module to use the" |
266 |
ERROR_TUN+=" virtual network device if using -net tap." |
267 |
ERROR_BRIDGE="You will also need support for 802.1d" |
268 |
ERROR_BRIDGE+=" Ethernet Bridging for some network configurations." |
269 |
use vhost-net && CONFIG_CHECK+=" ~VHOST_NET" |
270 |
ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net" |
271 |
ERROR_VHOST_NET+=" support" |
272 |
|
273 |
if use amd64 || use x86 || use amd64-linux || use x86-linux; then |
274 |
CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL" |
275 |
fi |
276 |
|
277 |
use python && CONFIG_CHECK+=" ~DEBUG_FS" |
278 |
ERROR_DEBUG_FS="debugFS support required for kvm_stat" |
279 |
|
280 |
# Now do the actual checks setup above |
281 |
check_extra_config |
282 |
fi |
283 |
fi |
284 |
|
285 |
if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then |
286 |
eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt" |
287 |
eerror "instances are still pointing to it. Please update your" |
288 |
eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag" |
289 |
eerror "and the right system binary (e.g. qemu-system-x86_64)." |
290 |
die "update your virt configs to not use qemu-kvm" |
291 |
fi |
292 |
} |
293 |
|
294 |
pkg_setup() { |
295 |
enewgroup kvm 78 |
296 |
} |
297 |
|
298 |
src_prepare() { |
299 |
# Alter target makefiles to accept CFLAGS set via flag-o |
300 |
sed -i -r \ |
301 |
-e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \ |
302 |
Makefile Makefile.target || die |
303 |
|
304 |
# Cheap hack to disable gettext .mo generation. |
305 |
use nls || rm -f po/*.po |
306 |
|
307 |
epatch "${FILESDIR}"/qemu-1.7.0-cflags.patch |
308 |
epatch "${FILESDIR}"/${P}-CVE-2015-3456.patch #549404 |
309 |
epatch "${FILESDIR}"/${P}-CVE-2015-3209.patch #551752 |
310 |
epatch "${FILESDIR}"/${P}-CVE-2015-5158.patch #555680 |
311 |
[[ -n ${BACKPORTS} ]] && \ |
312 |
EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \ |
313 |
epatch |
314 |
|
315 |
# Fix ld and objcopy being called directly |
316 |
tc-export AR LD OBJCOPY |
317 |
|
318 |
# Verbose builds |
319 |
MAKEOPTS+=" V=1" |
320 |
|
321 |
epatch_user |
322 |
} |
323 |
|
324 |
## |
325 |
# configures qemu based on the build directory and the build type |
326 |
# we are using. |
327 |
# |
328 |
qemu_src_configure() { |
329 |
debug-print-function ${FUNCNAME} "$@" |
330 |
|
331 |
local buildtype=$1 |
332 |
local builddir=$2 |
333 |
local static_flag="static-${buildtype}" |
334 |
|
335 |
# audio options |
336 |
local audio_opts="oss" |
337 |
use alsa && audio_opts="alsa,${audio_opts}" |
338 |
use sdl && audio_opts="sdl,${audio_opts}" |
339 |
use pulseaudio && audio_opts="pa,${audio_opts}" |
340 |
|
341 |
local conf_opts=( |
342 |
--prefix=/usr |
343 |
--sysconfdir=/etc |
344 |
--libdir=/usr/$(get_libdir) |
345 |
--docdir=/usr/share/doc/${PF}/html |
346 |
--disable-bsd-user |
347 |
--disable-guest-agent |
348 |
--disable-strip |
349 |
--disable-werror |
350 |
--python="${PYTHON}" |
351 |
--cc="$(tc-getCC)" |
352 |
--cxx="$(tc-getCXX)" |
353 |
--host-cc="$(tc-getBUILD_CC)" |
354 |
$(use_enable debug debug-info) |
355 |
$(use_enable debug debug-tcg) |
356 |
--enable-docs |
357 |
$(use_enable tci tcg-interpreter) |
358 |
$(use_enable xattr attr) |
359 |
) |
360 |
|
361 |
# Disable options not used by user targets as the default configure |
362 |
# options will autoprobe and try to link in a bunch of unused junk. |
363 |
conf_softmmu() { |
364 |
if [[ ${buildtype} == "user" ]] ; then |
365 |
echo "--disable-${2:-$1}" |
366 |
else |
367 |
use_enable "$@" |
368 |
fi |
369 |
} |
370 |
conf_opts+=( |
371 |
$(conf_softmmu accessibility brlapi) |
372 |
$(conf_softmmu aio linux-aio) |
373 |
$(conf_softmmu bluetooth bluez) |
374 |
$(conf_softmmu caps cap-ng) |
375 |
$(conf_softmmu curl) |
376 |
$(conf_softmmu fdt) |
377 |
$(conf_softmmu glusterfs) |
378 |
$(conf_softmmu gtk) |
379 |
$(conf_softmmu infiniband rdma) |
380 |
$(conf_softmmu iscsi libiscsi) |
381 |
$(conf_softmmu jpeg vnc-jpeg) |
382 |
$(conf_softmmu kernel_linux kvm) |
383 |
$(conf_softmmu lzo) |
384 |
$(conf_softmmu ncurses curses) |
385 |
$(conf_softmmu nfs libnfs) |
386 |
$(conf_softmmu numa) |
387 |
$(conf_softmmu opengl) |
388 |
$(conf_softmmu png vnc-png) |
389 |
$(conf_softmmu rbd) |
390 |
$(conf_softmmu sasl vnc-sasl) |
391 |
$(conf_softmmu sdl) |
392 |
$(conf_softmmu seccomp) |
393 |
$(conf_softmmu smartcard smartcard-nss) |
394 |
$(conf_softmmu snappy) |
395 |
$(conf_softmmu spice) |
396 |
$(conf_softmmu ssh libssh2) |
397 |
$(conf_softmmu tls quorum) |
398 |
$(conf_softmmu tls vnc-tls) |
399 |
$(conf_softmmu tls vnc-ws) |
400 |
$(conf_softmmu usb libusb) |
401 |
$(conf_softmmu usbredir usb-redir) |
402 |
$(conf_softmmu uuid) |
403 |
$(conf_softmmu vde) |
404 |
$(conf_softmmu vhost-net) |
405 |
$(conf_softmmu virtfs) |
406 |
$(conf_softmmu vnc) |
407 |
$(conf_softmmu xen) |
408 |
$(conf_softmmu xen xen-pci-passthrough) |
409 |
$(conf_softmmu xfs xfsctl) |
410 |
) |
411 |
|
412 |
case ${buildtype} in |
413 |
user) |
414 |
conf_opts+=( |
415 |
--enable-linux-user |
416 |
--disable-system |
417 |
--target-list="${user_targets}" |
418 |
--disable-blobs |
419 |
--disable-tools |
420 |
) |
421 |
;; |
422 |
softmmu) |
423 |
conf_opts+=( |
424 |
--disable-linux-user |
425 |
--enable-system |
426 |
--target-list="${softmmu_targets}" |
427 |
--with-system-pixman |
428 |
--audio-drv-list="${audio_opts}" |
429 |
) |
430 |
use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) ) |
431 |
;; |
432 |
esac |
433 |
|
434 |
# Add support for SystemTAP |
435 |
use systemtap && conf_opts+=( --enable-trace-backend=dtrace ) |
436 |
|
437 |
# We always want to attempt to build with PIE support as it results |
438 |
# in a more secure binary. But it doesn't work with static or if |
439 |
# the current GCC doesn't have PIE support. |
440 |
if use ${static_flag}; then |
441 |
conf_opts+=( --static --disable-pie ) |
442 |
else |
443 |
gcc-specs-pie && conf_opts+=( --enable-pie ) |
444 |
fi |
445 |
|
446 |
einfo "../configure ${conf_opts[*]}" |
447 |
cd "${builddir}" |
448 |
../configure "${conf_opts[@]}" || die "configure failed" |
449 |
|
450 |
# FreeBSD's kernel does not support QEMU assigning/grabbing |
451 |
# host USB devices yet |
452 |
use kernel_FreeBSD && \ |
453 |
sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak |
454 |
} |
455 |
|
456 |
src_configure() { |
457 |
local target |
458 |
|
459 |
python_setup |
460 |
|
461 |
softmmu_targets= softmmu_bins=() |
462 |
user_targets= user_bins=() |
463 |
|
464 |
for target in ${IUSE_SOFTMMU_TARGETS} ; do |
465 |
if use "qemu_softmmu_targets_${target}"; then |
466 |
softmmu_targets+=",${target}-softmmu" |
467 |
softmmu_bins+=( "qemu-system-${target}" ) |
468 |
fi |
469 |
done |
470 |
|
471 |
for target in ${IUSE_USER_TARGETS} ; do |
472 |
if use "qemu_user_targets_${target}"; then |
473 |
user_targets+=",${target}-linux-user" |
474 |
user_bins+=( "qemu-${target}" ) |
475 |
fi |
476 |
done |
477 |
|
478 |
[[ -n ${softmmu_targets} ]] && \ |
479 |
einfo "Building the following softmmu targets: ${softmmu_targets}" |
480 |
|
481 |
[[ -n ${user_targets} ]] && \ |
482 |
einfo "Building the following user targets: ${user_targets}" |
483 |
|
484 |
if [[ -n ${softmmu_targets} ]]; then |
485 |
mkdir "${S}/softmmu-build" |
486 |
qemu_src_configure "softmmu" "${S}/softmmu-build" |
487 |
fi |
488 |
|
489 |
if [[ -n ${user_targets} ]]; then |
490 |
mkdir "${S}/user-build" |
491 |
qemu_src_configure "user" "${S}/user-build" |
492 |
fi |
493 |
} |
494 |
|
495 |
src_compile() { |
496 |
if [[ -n ${user_targets} ]]; then |
497 |
cd "${S}/user-build" |
498 |
default |
499 |
fi |
500 |
|
501 |
if [[ -n ${softmmu_targets} ]]; then |
502 |
cd "${S}/softmmu-build" |
503 |
default |
504 |
fi |
505 |
} |
506 |
|
507 |
src_test() { |
508 |
if [[ -n ${softmmu_targets} ]]; then |
509 |
cd "${S}/softmmu-build" |
510 |
pax-mark m */qemu-system-* #515550 |
511 |
emake -j1 check |
512 |
emake -j1 check-report.html |
513 |
fi |
514 |
} |
515 |
|
516 |
qemu_python_install() { |
517 |
python_domodule "${S}/scripts/qmp/qmp.py" |
518 |
|
519 |
python_doscript "${S}/scripts/kvm/kvm_stat" |
520 |
python_doscript "${S}/scripts/kvm/vmxcap" |
521 |
python_doscript "${S}/scripts/qmp/qmp-shell" |
522 |
python_doscript "${S}/scripts/qmp/qemu-ga-client" |
523 |
} |
524 |
|
525 |
src_install() { |
526 |
if [[ -n ${user_targets} ]]; then |
527 |
cd "${S}/user-build" |
528 |
emake DESTDIR="${ED}" install |
529 |
|
530 |
# Install binfmt handler init script for user targets |
531 |
newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt |
532 |
fi |
533 |
|
534 |
if [[ -n ${softmmu_targets} ]]; then |
535 |
cd "${S}/softmmu-build" |
536 |
emake DESTDIR="${ED}" install |
537 |
|
538 |
# This might not exist if the test failed. #512010 |
539 |
[[ -e check-report.html ]] && dohtml check-report.html |
540 |
|
541 |
if use kernel_linux; then |
542 |
udev_dorules "${FILESDIR}"/65-kvm.rules |
543 |
fi |
544 |
|
545 |
if use python; then |
546 |
python_foreach_impl qemu_python_install |
547 |
fi |
548 |
fi |
549 |
|
550 |
# Disable mprotect on the qemu binaries as they use JITs to be fast #459348 |
551 |
pushd "${ED}"/usr/bin >/dev/null |
552 |
pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}" |
553 |
popd >/dev/null |
554 |
|
555 |
# Install config file example for qemu-bridge-helper |
556 |
insinto "/etc/qemu" |
557 |
doins "${FILESDIR}/bridge.conf" |
558 |
|
559 |
# Remove the docdir placed qmp-commands.txt |
560 |
mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/qmp/" |
561 |
|
562 |
cd "${S}" |
563 |
dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt |
564 |
newdoc pc-bios/README README.pc-bios |
565 |
dodoc docs/qmp/*.txt |
566 |
|
567 |
# Remove SeaBIOS since we're using the SeaBIOS packaged one |
568 |
rm "${ED}/usr/share/qemu/bios.bin" |
569 |
if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then |
570 |
dosym ../seabios/bios.bin /usr/share/qemu/bios.bin |
571 |
fi |
572 |
|
573 |
# Remove vgabios since we're using the vgabios packaged one |
574 |
if [[ -n ${softmmu_targets} ]]; then |
575 |
rm "${ED}/usr/share/qemu/vgabios.bin" |
576 |
rm "${ED}/usr/share/qemu/vgabios-cirrus.bin" |
577 |
rm "${ED}/usr/share/qemu/vgabios-qxl.bin" |
578 |
rm "${ED}/usr/share/qemu/vgabios-stdvga.bin" |
579 |
rm "${ED}/usr/share/qemu/vgabios-vmware.bin" |
580 |
if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then |
581 |
dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin |
582 |
dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin |
583 |
dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin |
584 |
dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin |
585 |
dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin |
586 |
fi |
587 |
|
588 |
# Remove sgabios since we're using the sgabios packaged one |
589 |
rm "${ED}/usr/share/qemu/sgabios.bin" |
590 |
if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then |
591 |
dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin |
592 |
fi |
593 |
|
594 |
# Remove iPXE since we're using the iPXE packaged one |
595 |
rm "${ED}"/usr/share/qemu/pxe-*.rom |
596 |
if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then |
597 |
dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom |
598 |
dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom |
599 |
dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom |
600 |
dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom |
601 |
dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom |
602 |
dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom |
603 |
fi |
604 |
fi |
605 |
|
606 |
qemu_support_kvm && readme.gentoo_create_doc |
607 |
} |
608 |
|
609 |
pkg_postinst() { |
610 |
if qemu_support_kvm; then |
611 |
readme.gentoo_print_elog |
612 |
ewarn "Migration from qemu-kvm instances and loading qemu-kvm created" |
613 |
ewarn "save states has been removed starting with the 1.6.2 release" |
614 |
ewarn |
615 |
ewarn "It is recommended that you migrate any VMs that may be running" |
616 |
ewarn "on qemu-kvm to a host with a newer qemu and regenerate" |
617 |
ewarn "any saved states with a newer qemu." |
618 |
ewarn |
619 |
ewarn "qemu-kvm was the primary qemu provider in Gentoo through 1.2.x" |
620 |
|
621 |
if use x86 || use amd64; then |
622 |
ewarn |
623 |
ewarn "The /usr/bin/kvm and /usr/bin/qemu-kvm wrappers are no longer" |
624 |
ewarn "installed. In order to use kvm acceleration, pass the flag" |
625 |
ewarn "-enable-kvm when running your system target." |
626 |
fi |
627 |
fi |
628 |
|
629 |
if [[ -n ${softmmu_targets} ]] && use kernel_linux; then |
630 |
udev_reload |
631 |
fi |
632 |
|
633 |
fcaps cap_net_admin /usr/libexec/qemu-bridge-helper |
634 |
if use virtfs && [ -n "${softmmu_targets}" ]; then |
635 |
local virtfs_caps="cap_chown,cap_dac_override,cap_fowner,cap_fsetid,cap_setgid,cap_mknod,cap_setuid" |
636 |
fcaps ${virtfs_caps} /usr/bin/virtfs-proxy-helper |
637 |
fi |
638 |
} |
639 |
|
640 |
pkg_info() { |
641 |
echo "Using:" |
642 |
echo " $(best_version app-emulation/spice-protocol)" |
643 |
echo " $(best_version sys-firmware/ipxe)" |
644 |
echo " $(best_version sys-firmware/seabios)" |
645 |
if has_version sys-firmware/seabios[binary]; then |
646 |
echo " USE=binary" |
647 |
else |
648 |
echo " USE=''" |
649 |
fi |
650 |
echo " $(best_version sys-firmware/vgabios)" |
651 |
} |