1 |
commit: 5d204bf38b9c1dac6456fe652227edce091b9948 |
2 |
Author: Aric Belsito <lluixhi <AT> gmail <DOT> com> |
3 |
AuthorDate: Tue Jan 3 03:43:46 2017 +0000 |
4 |
Commit: Aric Belsito <lluixhi <AT> gmail <DOT> com> |
5 |
CommitDate: Tue Jan 3 03:43:46 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=5d204bf3 |
7 |
|
8 |
app-emulation/qemu: Version bump to 2.8.0 |
9 |
|
10 |
app-emulation/qemu/Manifest | 5 + |
11 |
.../qemu/files/qemu-2.8.0-CVE-2016-10028.patch | 40 ++ |
12 |
.../qemu/files/qemu-2.8.0-CVE-2016-9908.patch | 35 ++ |
13 |
.../qemu/files/qemu-2.8.0-CVE-2016-9912.patch | 38 ++ |
14 |
app-emulation/qemu/qemu-2.8.0.ebuild | 687 +++++++++++++++++++++ |
15 |
5 files changed, 805 insertions(+) |
16 |
|
17 |
diff --git a/app-emulation/qemu/Manifest b/app-emulation/qemu/Manifest |
18 |
index f1a94d8..48d0014 100644 |
19 |
--- a/app-emulation/qemu/Manifest |
20 |
+++ b/app-emulation/qemu/Manifest |
21 |
@@ -34,9 +34,14 @@ AUX qemu-2.7.0-CVE-2016-9104.patch 2890 SHA256 7ba38b43519eb8f9c8c70daaa1705c01a |
22 |
AUX qemu-2.7.0-CVE-2016-9105.patch 610 SHA256 f4303796ece1e46f6e622e8cd0c9029daa0a6ed29ef630a0c64a5c595dbeb1b3 SHA512 1ab19ef861b6fe55017d02b7cbf24ad60776ed64e052d6e1b670c9aac7e312207718fcf601e9dba4bdd2c9104b9be25bcf0055b42e080b1f8abf9bc3f7db0b36 WHIRLPOOL 07fe76de2d2d68bcd091e90cc9578b17d5a8ad12ab316683d6e4badea443d08e08060a4e206f555c88b60b0a45f4ba49c9d11f42ee44b5b43200843c37329dad |
23 |
AUX qemu-2.7.0-CVE-2016-9106.patch 835 SHA256 594213b4200ae109dfbc6ec8e536d275d798c756a25e130a86972c514730f541 SHA512 6a3249f47fecdbe28eec496eb1284296d04d9e75efab21ab226d6ef2d5254bd85a44aa08879b1922682b65b5bce2e699ccaafa3a2b8b6f60ccbc84432bc599cd WHIRLPOOL b80c2787cbe71f416a7ea2aa39e800922b0a8a410eacb038d0163dfbb91f6a41cc2ae5afb010a7395ef17207e6b1acda34cddd9ff9d1ab035330ade6334e8b8c |
24 |
AUX qemu-2.7.0-configure-ifunc.patch 517 SHA256 40f6183f1f490216855e83cf03bf21ec8d23786acf83cda21292fea92776d898 SHA512 e34476b5fc5039091862dc9e93c47b69e203e7e394092e7e0bda467b7523e0b5b743c2c6eaf1f36fad3ee743278e321a50d356b6365e2340280556ca6d9b32ad WHIRLPOOL cb6f92a70f91557f14a0f6719d1b3a4dee9cfcb5c34aa897eee0ad48d13c45255252666d826ce00f3183da86b9b265e0dd93aa9b85210cde2a7ce3de56644e59 |
25 |
+AUX qemu-2.8.0-CVE-2016-10028.patch 1384 SHA256 25a9f2b2014bbcbb008683211503716a2b4a0e8d96ea001d32b87d451cee1842 SHA512 6cfad99e54cfaea97f5c14fbbfe35768a8ea46196117bf770725e1079f9bccca3b7071416a14e60a36c3c919760ab49663fc8b551026c8cd58c10b3f2d7940b4 WHIRLPOOL 5c0c8350112cb63c8b3db7a15a9090cd2fba879317565b108285fd92c23a8b75a593a65d94b6e448086b126a735056065d07c1877abdb6815ebaa430cf4adabf |
26 |
+AUX qemu-2.8.0-CVE-2016-9908.patch 1166 SHA256 22ef4999a3daf3c46a3c90ca20fb131545d4d0befeff7c3ca870585a3e03b7b7 SHA512 c46abda3a5b1a68c7c2e5236f8e424f4569a28ba2aea9b8ec32467e55b535492da6e4702d4758a5721f1bf222f7f2554a5e4c9a190781d60c40202a5291dcf49 WHIRLPOOL aa8087350770ecbb60049e3269ddf9d68258657ef6a088b562e344056689e578a390328dde9c5d2b5024e7fa03995b571295a1d64943d9b3882cf0c5f833dbd8 |
27 |
+AUX qemu-2.8.0-CVE-2016-9912.patch 1307 SHA256 e3eac321492a9ef42d88b04877511255c3731a9bb029d7c6ab2da0aa8f09e2d8 SHA512 f9ba4f167334d9b934c37fbed21ded8b3d71e5bdbdb1f15f81d4423b0790bfa127637155d5863b563fa974f1421c4ace1f2a4e3e81e3ae3d6045b2083210b103 WHIRLPOOL 7aa8dab7b6462f142365d274e6131ca1630c396e36c851cb562c081c4243c58e2ae22cf682e51145af08befcaba395254c765cf56112a6c177e1c9a18ffb5926 |
28 |
AUX qemu-binfmt.initd-r1 7966 SHA256 5b4b432aa1e44f387c9eb789de0ec6322741fd36dd241f76520f17c6cd6ac49b SHA512 2ba0bff6eb2b6bac4ed440f793771ce9551cad48e38bddb6cf04f804faac2407e80879f66771910344ddcea45f0014095dcc8bfeb0aad5085ef048fd3612dbd8 WHIRLPOOL a2a1fb830a970757d1e203378c7d382b161b1040f3b8aaf0f22bb3b5e46467eff395474ff40d93c9f133bab307b345a6f75d63eae9f8dd8daf67324db41032f9 |
29 |
DIST qemu-2.7.0.tar.bz2 26867760 SHA256 326e739506ba690daf69fc17bd3913a6c313d9928d743bd8eddb82f403f81e53 SHA512 654acaa7b3724a288e5d7e2a26ab780d9c9ed9f647fba00a906cbaffbe9d58fd666f2d962514aa2c5b391b4c53811ac3170d2eb51727f090bd19dfe45ca9a9db WHIRLPOOL dcb3e5f7da89dd8e14d636d7ebd476e076e0043880bb9ea3fb1c03cb4bcd4e5c7d3c4719da26c3ce521e3a3db5ae671e86f198ac1bc3474e774d75504fef8b8d |
30 |
DIST qemu-2.7.1.tar.bz2 26868403 SHA256 68636788eb69bcb0b44ba220b32b50495d6bd5712a934c282217831c4822958f SHA512 16a83946e9064733254c82c961749bf9c56a0a2a8ee46145b4a78e1452ac0e2548d888963d18c80e28f65202890fd643b0011951b5b1c66ef16234767ed91898 WHIRLPOOL ae3d3c2b2a3700613733659847de6187755631cb09e8c3548ea30cd994357c9ff128646edce88dfe4dce53e6c1c0f37f8de3688ee7e22262033b40f3fc706efa |
31 |
+DIST qemu-2.8.0.tar.bz2 28368517 SHA256 dafd5d7f649907b6b617b822692f4c82e60cf29bc0fc58bc2036219b591e5e62 SHA512 50f2988d822388ba9fd1bf5dbe68359033ed7432d7f0f9790299f32f63faa6dc72979256b5632ba572d47ee3e74ed40e3e8e331dc6303ec1599f1b4367cb78c2 WHIRLPOOL 0ce4e0539657eb832e4039819e7360c792b6aa41c718f0e0d762f4933217f0d370af94b1d6d9776853575b4a6811d8c85db069bf09d21bd15399ac8b50440ff5 |
32 |
EBUILD qemu-2.7.0-r7.ebuild 22495 SHA256 a606d5b6805d24191245b4191c1f62a09096d8ee283c62629f038851b4c8e6c5 SHA512 c45e516c4c45b5a1eaec06d046cebf129f1422c2d5910699c0a367a4c8c7d49e323a6addc765e1ec57209df12270e196169e52a7618afef28019be06feff70ea WHIRLPOOL 94ae6ab13fc03450ce5b6b0e5840e488401116d6bf60ec411cc01f39f2d10931bd65572f25bdf958e9f94bb4f6582795018039b5b4c988fa3bd5dee928014c65 |
33 |
EBUILD qemu-2.7.1.ebuild 22161 SHA256 a7d2ff5c706a35a1b2c5610866215a5db04674ce68fb01e3e076b68839dcafd8 SHA512 7d30615832f2fecf89b472c4ea56446335176a330a7d64693ed7cc9becd47a1f40064fca191467deb8603116b4f69307d7968971c9b3845356b8b8d4cf053472 WHIRLPOOL 23bda8ca28ff8620739c604289a0d81ec4d16c1908b8c02df7833f9c0d98f698922650636456ac0bcc285357836af23ffd28bf3b8c2653a690a86fa5ae662a61 |
34 |
+EBUILD qemu-2.8.0.ebuild 21005 SHA256 5009f688c9c65004640328ad98b007d2b0e33a95daa3cb8958f5968c8109e0b4 SHA512 9d2d86f6df898a19ef3b4a387b6b715b547d387b1995e38e2e4b849fcd184560f6fc543340aa5acd5080823b7ed8db605918bd7e9b860dd170c967d224fe347e WHIRLPOOL 625e49536d32ee8685ec14d8e629ebefb2753e6d43bf33e577aa0e7f30d9144ada724547a28859c75bdd88d178ab9b9b5ee847fb2853f9953cd8a4f74af924d2 |
35 |
MISC metadata.xml 3925 SHA256 d1c219b7da0cbf77919cd1e055acbb3f6788a574fd802c98a43c89a411697b36 SHA512 3ff45d1c8ede12b4eedc7d01f39777b76a1cbd0ba9364299dec99d4b4a05cade5784d6f6e50197d5b5ae1f1b8e831c49da195eb53263c49b7d16aec8ee28b6e6 WHIRLPOOL bc25783fac0f3f13318834cc535404af9af20de16c7aeec222e59dc2ed7740ac5e767b329a5bcd6356d0cbae2428e278515f1446aa8ecb87a873bf4dbe04bf41 |
36 |
|
37 |
diff --git a/app-emulation/qemu/files/qemu-2.8.0-CVE-2016-10028.patch b/app-emulation/qemu/files/qemu-2.8.0-CVE-2016-10028.patch |
38 |
new file mode 100644 |
39 |
index 0000000..466c819 |
40 |
--- /dev/null |
41 |
+++ b/app-emulation/qemu/files/qemu-2.8.0-CVE-2016-10028.patch |
42 |
@@ -0,0 +1,40 @@ |
43 |
+https://lists.gnu.org/archive/html/qemu-devel/2016-12/msg01903.html |
44 |
+https://bugs.gentoo.org/603444 |
45 |
+ |
46 |
+From: P J P |
47 |
+Subject: [Qemu-devel] [PATCH] display: virtio-gpu-3d: check virgl capabilities max_size |
48 |
+Date: Wed, 14 Dec 2016 12:31:56 +0530 |
49 |
+From: Prasad J Pandit <address@hidden> |
50 |
+ |
51 |
+Virtio GPU device while processing 'VIRTIO_GPU_CMD_GET_CAPSET' |
52 |
+command, retrieves the maximum capabilities size to fill in the |
53 |
+response object. It continues to fill in capabilities even if |
54 |
+retrieved 'max_size' is zero(0), thus resulting in OOB access. |
55 |
+Add check to avoid it. |
56 |
+ |
57 |
+Reported-by: Zhenhao Hong <address@hidden> |
58 |
+Signed-off-by: Prasad J Pandit <address@hidden> |
59 |
+--- |
60 |
+ hw/display/virtio-gpu-3d.c | 6 +++++- |
61 |
+ 1 file changed, 5 insertions(+), 1 deletion(-) |
62 |
+ |
63 |
+diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c |
64 |
+index 758d33a..6ceeba3 100644 |
65 |
+--- a/hw/display/virtio-gpu-3d.c |
66 |
++++ b/hw/display/virtio-gpu-3d.c |
67 |
+@@ -370,8 +370,12 @@ static void virgl_cmd_get_capset(VirtIOGPU *g, |
68 |
+ |
69 |
+ virgl_renderer_get_cap_set(gc.capset_id, &max_ver, |
70 |
+ &max_size); |
71 |
++ if (!max_size) { |
72 |
++ cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER; |
73 |
++ return; |
74 |
++ } |
75 |
++ |
76 |
+ resp = g_malloc0(sizeof(*resp) + max_size); |
77 |
+- |
78 |
+ resp->hdr.type = VIRTIO_GPU_RESP_OK_CAPSET; |
79 |
+ virgl_renderer_fill_caps(gc.capset_id, |
80 |
+ gc.capset_version, |
81 |
+-- |
82 |
+2.9.3 |
83 |
|
84 |
diff --git a/app-emulation/qemu/files/qemu-2.8.0-CVE-2016-9908.patch b/app-emulation/qemu/files/qemu-2.8.0-CVE-2016-9908.patch |
85 |
new file mode 100644 |
86 |
index 0000000..841de65 |
87 |
--- /dev/null |
88 |
+++ b/app-emulation/qemu/files/qemu-2.8.0-CVE-2016-9908.patch |
89 |
@@ -0,0 +1,35 @@ |
90 |
+https://lists.gnu.org/archive/html/qemu-devel/2016-11/msg00059.html |
91 |
+https://bugs.gentoo.org/601826 |
92 |
+ |
93 |
+From: Li Qiang |
94 |
+Subject: [Qemu-devel] [PATCH] virtio-gpu: fix information leak in capset get dispatch |
95 |
+Date: Tue, 1 Nov 2016 05:37:57 -0700 |
96 |
+From: Li Qiang <address@hidden> |
97 |
+ |
98 |
+In virgl_cmd_get_capset function, it uses g_malloc to allocate |
99 |
+a response struct to the guest. As the 'resp'struct hasn't been full |
100 |
+initialized it will lead the 'resp->padding' field to the guest. |
101 |
+Use g_malloc0 to avoid this. |
102 |
+ |
103 |
+Signed-off-by: Li Qiang <address@hidden> |
104 |
+--- |
105 |
+ hw/display/virtio-gpu-3d.c | 2 +- |
106 |
+ 1 file changed, 1 insertion(+), 1 deletion(-) |
107 |
+ |
108 |
+diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c |
109 |
+index 23f39de..d98b140 100644 |
110 |
+--- a/hw/display/virtio-gpu-3d.c |
111 |
++++ b/hw/display/virtio-gpu-3d.c |
112 |
+@@ -371,7 +371,7 @@ static void virgl_cmd_get_capset(VirtIOGPU *g, |
113 |
+ |
114 |
+ virgl_renderer_get_cap_set(gc.capset_id, &max_ver, |
115 |
+ &max_size); |
116 |
+- resp = g_malloc(sizeof(*resp) + max_size); |
117 |
++ resp = g_malloc0(sizeof(*resp) + max_size); |
118 |
+ |
119 |
+ resp->hdr.type = VIRTIO_GPU_RESP_OK_CAPSET; |
120 |
+ virgl_renderer_fill_caps(gc.capset_id, |
121 |
+-- |
122 |
+1.8.3.1 |
123 |
+ |
124 |
+ |
125 |
|
126 |
diff --git a/app-emulation/qemu/files/qemu-2.8.0-CVE-2016-9912.patch b/app-emulation/qemu/files/qemu-2.8.0-CVE-2016-9912.patch |
127 |
new file mode 100644 |
128 |
index 0000000..55963f7 |
129 |
--- /dev/null |
130 |
+++ b/app-emulation/qemu/files/qemu-2.8.0-CVE-2016-9912.patch |
131 |
@@ -0,0 +1,38 @@ |
132 |
+https://lists.gnu.org/archive/html/qemu-devel/2016-11/msg05043.html |
133 |
+https://bugs.gentoo.org/602630 |
134 |
+ |
135 |
+From: Li Qiang |
136 |
+Subject: [Qemu-devel] [PATCH] virtio-gpu: call cleanup mapping function in resource destroy |
137 |
+Date: Mon, 28 Nov 2016 21:29:25 -0500 |
138 |
+If the guest destroy the resource before detach banking, the 'iov' |
139 |
+and 'addrs' field in resource is not freed thus leading memory |
140 |
+leak issue. This patch avoid this. |
141 |
+ |
142 |
+Signed-off-by: Li Qiang <address@hidden> |
143 |
+--- |
144 |
+ hw/display/virtio-gpu.c | 3 +++ |
145 |
+ 1 file changed, 3 insertions(+) |
146 |
+ |
147 |
+diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c |
148 |
+index 60bce94..98dadf2 100644 |
149 |
+--- a/hw/display/virtio-gpu.c |
150 |
++++ b/hw/display/virtio-gpu.c |
151 |
+@@ -28,6 +28,8 @@ |
152 |
+ static struct virtio_gpu_simple_resource* |
153 |
+ virtio_gpu_find_resource(VirtIOGPU *g, uint32_t resource_id); |
154 |
+ |
155 |
++static void virtio_gpu_cleanup_mapping(struct virtio_gpu_simple_resource *res); |
156 |
++ |
157 |
+ #ifdef CONFIG_VIRGL |
158 |
+ #include <virglrenderer.h> |
159 |
+ #define VIRGL(_g, _virgl, _simple, ...) \ |
160 |
+@@ -358,6 +360,7 @@ static void virtio_gpu_resource_destroy(VirtIOGPU *g, |
161 |
+ struct virtio_gpu_simple_resource *res) |
162 |
+ { |
163 |
+ pixman_image_unref(res->image); |
164 |
++ virtio_gpu_cleanup_mapping(res); |
165 |
+ QTAILQ_REMOVE(&g->reslist, res, next); |
166 |
+ g_free(res); |
167 |
+ } |
168 |
+-- |
169 |
+1.8.3.1 |
170 |
|
171 |
diff --git a/app-emulation/qemu/qemu-2.8.0.ebuild b/app-emulation/qemu/qemu-2.8.0.ebuild |
172 |
new file mode 100644 |
173 |
index 0000000..4fbc9fd |
174 |
--- /dev/null |
175 |
+++ b/app-emulation/qemu/qemu-2.8.0.ebuild |
176 |
@@ -0,0 +1,687 @@ |
177 |
+# Copyright 1999-2016 Gentoo Foundation |
178 |
+# Distributed under the terms of the GNU General Public License v2 |
179 |
+ |
180 |
+EAPI="5" |
181 |
+ |
182 |
+PYTHON_COMPAT=( python2_7 ) |
183 |
+PYTHON_REQ_USE="ncurses,readline" |
184 |
+ |
185 |
+PLOCALES="bg de_DE fr_FR hu it tr zh_CN" |
186 |
+ |
187 |
+inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \ |
188 |
+ user udev fcaps readme.gentoo-r1 pax-utils l10n |
189 |
+ |
190 |
+if [[ ${PV} = *9999* ]]; then |
191 |
+ EGIT_REPO_URI="git://git.qemu.org/qemu.git" |
192 |
+ inherit git-2 |
193 |
+ SRC_URI="" |
194 |
+else |
195 |
+ SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2" |
196 |
+ KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~x86 ~x86-fbsd" |
197 |
+fi |
198 |
+ |
199 |
+DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools" |
200 |
+HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org" |
201 |
+ |
202 |
+LICENSE="GPL-2 LGPL-2 BSD-2" |
203 |
+SLOT="0" |
204 |
+IUSE="accessibility +aio alsa bluetooth bzip2 +caps +curl debug +fdt glusterfs \ |
205 |
+gnutls gtk gtk2 infiniband iscsi +jpeg \ |
206 |
+kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs |
207 |
++png pulseaudio python \ |
208 |
+rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu |
209 |
+static-user systemtap tci test +threads usb usbredir +uuid vde +vhost-net \ |
210 |
+virgl virtfs +vnc vte xattr xen xfs" |
211 |
+ |
212 |
+COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips |
213 |
+mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 |
214 |
+x86_64" |
215 |
+IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore unicore32 xtensa xtensaeb" |
216 |
+IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus tilegx" |
217 |
+ |
218 |
+use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS}) |
219 |
+use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS}) |
220 |
+IUSE+=" ${use_softmmu_targets} ${use_user_targets}" |
221 |
+ |
222 |
+# Allow no targets to be built so that people can get a tools-only build. |
223 |
+# Block USE flag configurations known to not work. |
224 |
+REQUIRED_USE="${PYTHON_REQUIRED_USE} |
225 |
+ gtk2? ( gtk ) |
226 |
+ qemu_softmmu_targets_arm? ( fdt ) |
227 |
+ qemu_softmmu_targets_microblaze? ( fdt ) |
228 |
+ qemu_softmmu_targets_ppc? ( fdt ) |
229 |
+ qemu_softmmu_targets_ppc64? ( fdt ) |
230 |
+ sdl2? ( sdl ) |
231 |
+ static? ( static-softmmu static-user ) |
232 |
+ static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 ) |
233 |
+ virtfs? ( xattr ) |
234 |
+ vte? ( gtk )" |
235 |
+ |
236 |
+# Yep, you need both libcap and libcap-ng since virtfs only uses libcap. |
237 |
+# |
238 |
+# The attr lib isn't always linked in (although the USE flag is always |
239 |
+# respected). This is because qemu supports using the C library's API |
240 |
+# when available rather than always using the extranl library. |
241 |
+# |
242 |
+# Older versions of gnutls are supported, but it's simpler to just require |
243 |
+# the latest versions. This is also why we require nettle. |
244 |
+# |
245 |
+# TODO: Split out tools deps into another var. e.g. bzip2 is only used by |
246 |
+# system binaries and tools, not user binaries. |
247 |
+COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)] |
248 |
+ sys-libs/zlib[static-libs(+)] |
249 |
+ bzip2? ( app-arch/bzip2[static-libs(+)] ) |
250 |
+ xattr? ( sys-apps/attr[static-libs(+)] )" |
251 |
+SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND} |
252 |
+ >=x11-libs/pixman-0.28.0[static-libs(+)] |
253 |
+ accessibility? ( app-accessibility/brltty[static-libs(+)] ) |
254 |
+ aio? ( dev-libs/libaio[static-libs(+)] ) |
255 |
+ alsa? ( >=media-libs/alsa-lib-1.0.13 ) |
256 |
+ bluetooth? ( net-wireless/bluez ) |
257 |
+ caps? ( sys-libs/libcap-ng[static-libs(+)] ) |
258 |
+ curl? ( >=net-misc/curl-7.15.4[static-libs(+)] ) |
259 |
+ fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] ) |
260 |
+ glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] ) |
261 |
+ gnutls? ( |
262 |
+ dev-libs/nettle:=[static-libs(+)] |
263 |
+ >=net-libs/gnutls-3.0:=[static-libs(+)] |
264 |
+ ) |
265 |
+ gtk? ( |
266 |
+ gtk2? ( |
267 |
+ x11-libs/gtk+:2 |
268 |
+ vte? ( x11-libs/vte:0 ) |
269 |
+ ) |
270 |
+ !gtk2? ( |
271 |
+ x11-libs/gtk+:3 |
272 |
+ vte? ( x11-libs/vte:2.91 ) |
273 |
+ ) |
274 |
+ ) |
275 |
+ infiniband? ( sys-fabric/librdmacm:=[static-libs(+)] ) |
276 |
+ iscsi? ( net-libs/libiscsi ) |
277 |
+ jpeg? ( virtual/jpeg:0=[static-libs(+)] ) |
278 |
+ lzo? ( dev-libs/lzo:2[static-libs(+)] ) |
279 |
+ ncurses? ( sys-libs/ncurses:0=[static-libs(+)] ) |
280 |
+ nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] ) |
281 |
+ numa? ( sys-process/numactl[static-libs(+)] ) |
282 |
+ opengl? ( |
283 |
+ virtual/opengl |
284 |
+ media-libs/libepoxy[static-libs(+)] |
285 |
+ media-libs/mesa[static-libs(+)] |
286 |
+ media-libs/mesa[egl,gles2,gbm] |
287 |
+ ) |
288 |
+ png? ( media-libs/libpng:0=[static-libs(+)] ) |
289 |
+ pulseaudio? ( media-sound/pulseaudio ) |
290 |
+ rbd? ( sys-cluster/ceph[static-libs(+)] ) |
291 |
+ sasl? ( dev-libs/cyrus-sasl[static-libs(+)] ) |
292 |
+ sdl? ( |
293 |
+ !sdl2? ( |
294 |
+ media-libs/libsdl[X] |
295 |
+ >=media-libs/libsdl-1.2.11[static-libs(+)] |
296 |
+ ) |
297 |
+ sdl2? ( |
298 |
+ media-libs/libsdl2[X] |
299 |
+ media-libs/libsdl2[static-libs(+)] |
300 |
+ ) |
301 |
+ ) |
302 |
+ seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] ) |
303 |
+ smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] ) |
304 |
+ snappy? ( app-arch/snappy[static-libs(+)] ) |
305 |
+ spice? ( |
306 |
+ >=app-emulation/spice-protocol-0.12.3 |
307 |
+ >=app-emulation/spice-0.12.0[static-libs(+)] |
308 |
+ ) |
309 |
+ ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] ) |
310 |
+ usb? ( >=virtual/libusb-1-r2[static-libs(+)] ) |
311 |
+ usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] ) |
312 |
+ uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] ) |
313 |
+ vde? ( net-misc/vde[static-libs(+)] ) |
314 |
+ virgl? ( media-libs/virglrenderer[static-libs(+)] ) |
315 |
+ virtfs? ( sys-libs/libcap ) |
316 |
+ xfs? ( sys-fs/xfsprogs[static-libs(+)] )" |
317 |
+USER_LIB_DEPEND="${COMMON_LIB_DEPEND}" |
318 |
+X86_FIRMWARE_DEPEND=" |
319 |
+ >=sys-firmware/ipxe-1.0.0_p20130624 |
320 |
+ pin-upstream-blobs? ( |
321 |
+ ~sys-firmware/seabios-1.10.1 |
322 |
+ ~sys-firmware/sgabios-0.1_pre8 |
323 |
+ ~sys-firmware/vgabios-0.7a |
324 |
+ ) |
325 |
+ !pin-upstream-blobs? ( |
326 |
+ sys-firmware/seabios |
327 |
+ sys-firmware/sgabios |
328 |
+ sys-firmware/vgabios |
329 |
+ )" |
330 |
+CDEPEND=" |
331 |
+ !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) ) |
332 |
+ !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) ) |
333 |
+ qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} ) |
334 |
+ qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} ) |
335 |
+ python? ( ${PYTHON_DEPS} ) |
336 |
+ systemtap? ( dev-util/systemtap ) |
337 |
+ xen? ( app-emulation/xen-tools:= )" |
338 |
+DEPEND="${CDEPEND} |
339 |
+ dev-lang/perl |
340 |
+ =dev-lang/python-2* |
341 |
+ sys-apps/texinfo |
342 |
+ virtual/pkgconfig |
343 |
+ kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 ) |
344 |
+ gtk? ( nls? ( sys-devel/gettext ) ) |
345 |
+ static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) ) |
346 |
+ static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) ) |
347 |
+ test? ( |
348 |
+ dev-libs/glib[utils] |
349 |
+ sys-devel/bc |
350 |
+ )" |
351 |
+RDEPEND="${CDEPEND} |
352 |
+ selinux? ( sec-policy/selinux-qemu ) |
353 |
+" |
354 |
+ |
355 |
+STRIP_MASK="/usr/share/qemu/palcode-clipper" |
356 |
+ |
357 |
+QA_PREBUILT=" |
358 |
+ usr/share/qemu/openbios-ppc |
359 |
+ usr/share/qemu/openbios-sparc64 |
360 |
+ usr/share/qemu/openbios-sparc32 |
361 |
+ usr/share/qemu/palcode-clipper |
362 |
+ usr/share/qemu/s390-ccw.img |
363 |
+ usr/share/qemu/u-boot.e500 |
364 |
+" |
365 |
+ |
366 |
+QA_WX_LOAD="usr/bin/qemu-i386 |
367 |
+ usr/bin/qemu-x86_64 |
368 |
+ usr/bin/qemu-alpha |
369 |
+ usr/bin/qemu-arm |
370 |
+ usr/bin/qemu-cris |
371 |
+ usr/bin/qemu-m68k |
372 |
+ usr/bin/qemu-microblaze |
373 |
+ usr/bin/qemu-microblazeel |
374 |
+ usr/bin/qemu-mips |
375 |
+ usr/bin/qemu-mipsel |
376 |
+ usr/bin/qemu-or32 |
377 |
+ usr/bin/qemu-ppc |
378 |
+ usr/bin/qemu-ppc64 |
379 |
+ usr/bin/qemu-ppc64abi32 |
380 |
+ usr/bin/qemu-sh4 |
381 |
+ usr/bin/qemu-sh4eb |
382 |
+ usr/bin/qemu-sparc |
383 |
+ usr/bin/qemu-sparc64 |
384 |
+ usr/bin/qemu-armeb |
385 |
+ usr/bin/qemu-sparc32plus |
386 |
+ usr/bin/qemu-s390x |
387 |
+ usr/bin/qemu-unicore32" |
388 |
+ |
389 |
+DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure |
390 |
+you have the kernel module loaded before running kvm. The easiest way to |
391 |
+ensure that the kernel module is loaded is to load it on boot.\n |
392 |
+For AMD CPUs the module is called 'kvm-amd'.\n |
393 |
+For Intel CPUs the module is called 'kvm-intel'.\n |
394 |
+Please review /etc/conf.d/modules for how to load these.\n\n |
395 |
+Make sure your user is in the 'kvm' group\n |
396 |
+Just run 'gpasswd -a <USER> kvm', then have <USER> re-login.\n\n |
397 |
+For brand new installs, the default permissions on /dev/kvm might not let you |
398 |
+access it. You can tell udev to reset ownership/perms:\n |
399 |
+udevadm trigger -c add /dev/kvm" |
400 |
+ |
401 |
+qemu_support_kvm() { |
402 |
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \ |
403 |
+ use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \ |
404 |
+ use qemu_softmmu_targets_s390x; then |
405 |
+ return 0 |
406 |
+ fi |
407 |
+ |
408 |
+ return 1 |
409 |
+} |
410 |
+ |
411 |
+pkg_pretend() { |
412 |
+ if use kernel_linux && kernel_is lt 2 6 25; then |
413 |
+ eerror "This version of KVM requres a host kernel of 2.6.25 or higher." |
414 |
+ elif use kernel_linux; then |
415 |
+ if ! linux_config_exists; then |
416 |
+ eerror "Unable to check your kernel for KVM support" |
417 |
+ else |
418 |
+ CONFIG_CHECK="~KVM ~TUN ~BRIDGE" |
419 |
+ ERROR_KVM="You must enable KVM in your kernel to continue" |
420 |
+ ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in" |
421 |
+ ERROR_KVM_AMD+=" your kernel configuration." |
422 |
+ ERROR_KVM_INTEL="If you have an Intel CPU, you must enable" |
423 |
+ ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration." |
424 |
+ ERROR_TUN="You will need the Universal TUN/TAP driver compiled" |
425 |
+ ERROR_TUN+=" into your kernel or loaded as a module to use the" |
426 |
+ ERROR_TUN+=" virtual network device if using -net tap." |
427 |
+ ERROR_BRIDGE="You will also need support for 802.1d" |
428 |
+ ERROR_BRIDGE+=" Ethernet Bridging for some network configurations." |
429 |
+ use vhost-net && CONFIG_CHECK+=" ~VHOST_NET" |
430 |
+ ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net" |
431 |
+ ERROR_VHOST_NET+=" support" |
432 |
+ |
433 |
+ if use amd64 || use x86 || use amd64-linux || use x86-linux; then |
434 |
+ CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL" |
435 |
+ fi |
436 |
+ |
437 |
+ use python && CONFIG_CHECK+=" ~DEBUG_FS" |
438 |
+ ERROR_DEBUG_FS="debugFS support required for kvm_stat" |
439 |
+ |
440 |
+ # Now do the actual checks setup above |
441 |
+ check_extra_config |
442 |
+ fi |
443 |
+ fi |
444 |
+ |
445 |
+ if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then |
446 |
+ eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt" |
447 |
+ eerror "instances are still pointing to it. Please update your" |
448 |
+ eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag" |
449 |
+ eerror "and the right system binary (e.g. qemu-system-x86_64)." |
450 |
+ die "update your virt configs to not use qemu-kvm" |
451 |
+ fi |
452 |
+} |
453 |
+ |
454 |
+pkg_setup() { |
455 |
+ enewgroup kvm 78 |
456 |
+} |
457 |
+ |
458 |
+# Sanity check to make sure target lists are kept up-to-date. |
459 |
+check_targets() { |
460 |
+ local var=$1 mak=$2 |
461 |
+ local detected sorted |
462 |
+ |
463 |
+ pushd "${S}"/default-configs >/dev/null || die |
464 |
+ |
465 |
+ # Force C locale until glibc is updated. #564936 |
466 |
+ detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u)) |
467 |
+ sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u)) |
468 |
+ if [[ ${sorted} != "${detected}" ]] ; then |
469 |
+ eerror "The ebuild needs to be kept in sync." |
470 |
+ eerror "${var}: ${sorted}" |
471 |
+ eerror "$(printf '%-*s' ${#var} configure): ${detected}" |
472 |
+ die "sync ${var} to the list of targets" |
473 |
+ fi |
474 |
+ |
475 |
+ popd >/dev/null |
476 |
+} |
477 |
+ |
478 |
+handle_locales() { |
479 |
+ # Make sure locale list is kept up-to-date. |
480 |
+ local detected sorted |
481 |
+ detected=$(echo $(cd po && printf '%s\n' *.po | grep -v messages.po | sed 's:.po$::' | sort -u)) |
482 |
+ sorted=$(echo $(printf '%s\n' ${PLOCALES} | sort -u)) |
483 |
+ if [[ ${sorted} != "${detected}" ]] ; then |
484 |
+ eerror "The ebuild needs to be kept in sync." |
485 |
+ eerror "PLOCALES: ${sorted}" |
486 |
+ eerror " po/*.po: ${detected}" |
487 |
+ die "sync PLOCALES" |
488 |
+ fi |
489 |
+ |
490 |
+ # Deal with selective install of locales. |
491 |
+ if use nls ; then |
492 |
+ # Delete locales the user does not want. #577814 |
493 |
+ rm_loc() { rm po/$1.po || die; } |
494 |
+ l10n_for_each_disabled_locale_do rm_loc |
495 |
+ else |
496 |
+ # Cheap hack to disable gettext .mo generation. |
497 |
+ rm -f po/*.po |
498 |
+ fi |
499 |
+} |
500 |
+ |
501 |
+src_prepare() { |
502 |
+ check_targets IUSE_SOFTMMU_TARGETS softmmu |
503 |
+ check_targets IUSE_USER_TARGETS linux-user |
504 |
+ |
505 |
+ # Alter target makefiles to accept CFLAGS set via flag-o |
506 |
+ sed -i -r \ |
507 |
+ -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \ |
508 |
+ Makefile Makefile.target || die |
509 |
+ |
510 |
+ # Patching for musl |
511 |
+ epatch "${FILESDIR}"/${PN}-2.0.0-F_SHLCK-and-F_EXLCK.patch |
512 |
+ epatch "${FILESDIR}"/${PN}-2.0.0-linux-user-signal.c-define-__SIGRTMIN-MAX-for-non-GN.patch |
513 |
+ epatch "${FILESDIR}"/${PN}-2.2.0-_sigev_un.patch |
514 |
+ epatch "${FILESDIR}"/${PN}-2.7.0-configure-ifunc.patch |
515 |
+ |
516 |
+ epatch "${FILESDIR}"/${PN}-2.5.0-cflags.patch |
517 |
+ epatch "${FILESDIR}"/${PN}-2.5.0-sysmacros.patch |
518 |
+ epatch "${FILESDIR}"/${PN}-2.7.0-CVE-2016-8669-1.patch #597108 |
519 |
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2016-9908.patch #601826 |
520 |
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2016-9912.patch #602630 |
521 |
+ epatch "${FILESDIR}"/${PN}-2.8.0-CVE-2016-10028.patch #603444 |
522 |
+ |
523 |
+ # Fix ld and objcopy being called directly |
524 |
+ tc-export AR LD OBJCOPY |
525 |
+ |
526 |
+ # Verbose builds |
527 |
+ MAKEOPTS+=" V=1" |
528 |
+ |
529 |
+ epatch_user |
530 |
+ |
531 |
+ # Run after we've applied all patches. |
532 |
+ handle_locales |
533 |
+} |
534 |
+ |
535 |
+## |
536 |
+# configures qemu based on the build directory and the build type |
537 |
+# we are using. |
538 |
+# |
539 |
+qemu_src_configure() { |
540 |
+ debug-print-function ${FUNCNAME} "$@" |
541 |
+ |
542 |
+ local buildtype=$1 |
543 |
+ local builddir="${S}/${buildtype}-build" |
544 |
+ local static_flag="static-${buildtype}" |
545 |
+ |
546 |
+ mkdir "${builddir}" |
547 |
+ |
548 |
+ local conf_opts=( |
549 |
+ --prefix=/usr |
550 |
+ --sysconfdir=/etc |
551 |
+ --libdir=/usr/$(get_libdir) |
552 |
+ --docdir=/usr/share/doc/${PF}/html |
553 |
+ --disable-bsd-user |
554 |
+ --disable-guest-agent |
555 |
+ --disable-strip |
556 |
+ --disable-werror |
557 |
+ # We support gnutls/nettle for crypto operations. It is possible |
558 |
+ # to use gcrypt when gnutls/nettle are disabled (but not when they |
559 |
+ # are enabled), but it's not really worth the hassle. Disable it |
560 |
+ # all the time to avoid automatically detecting it. #568856 |
561 |
+ --disable-gcrypt |
562 |
+ --python="${PYTHON}" |
563 |
+ --cc="$(tc-getCC)" |
564 |
+ --cxx="$(tc-getCXX)" |
565 |
+ --host-cc="$(tc-getBUILD_CC)" |
566 |
+ $(use_enable debug debug-info) |
567 |
+ $(use_enable debug debug-tcg) |
568 |
+ --enable-docs |
569 |
+ $(use_enable tci tcg-interpreter) |
570 |
+ $(use_enable xattr attr) |
571 |
+ ) |
572 |
+ |
573 |
+ # Disable options not used by user targets as the default configure |
574 |
+ # options will autoprobe and try to link in a bunch of unused junk. |
575 |
+ conf_softmmu() { |
576 |
+ if [[ ${buildtype} == "user" ]] ; then |
577 |
+ echo "--disable-${2:-$1}" |
578 |
+ else |
579 |
+ use_enable "$@" |
580 |
+ fi |
581 |
+ } |
582 |
+ conf_opts+=( |
583 |
+ $(conf_softmmu accessibility brlapi) |
584 |
+ $(conf_softmmu aio linux-aio) |
585 |
+ $(conf_softmmu bzip2) |
586 |
+ $(conf_softmmu bluetooth bluez) |
587 |
+ $(conf_softmmu caps cap-ng) |
588 |
+ $(conf_softmmu curl) |
589 |
+ $(conf_softmmu fdt) |
590 |
+ $(conf_softmmu glusterfs) |
591 |
+ $(conf_softmmu gnutls) |
592 |
+ $(conf_softmmu gnutls nettle) |
593 |
+ $(conf_softmmu gtk) |
594 |
+ $(conf_softmmu infiniband rdma) |
595 |
+ $(conf_softmmu iscsi libiscsi) |
596 |
+ $(conf_softmmu jpeg vnc-jpeg) |
597 |
+ $(conf_softmmu kernel_linux kvm) |
598 |
+ $(conf_softmmu lzo) |
599 |
+ $(conf_softmmu ncurses curses) |
600 |
+ $(conf_softmmu nfs libnfs) |
601 |
+ $(conf_softmmu numa) |
602 |
+ $(conf_softmmu opengl) |
603 |
+ $(conf_softmmu png vnc-png) |
604 |
+ $(conf_softmmu rbd) |
605 |
+ $(conf_softmmu sasl vnc-sasl) |
606 |
+ $(conf_softmmu sdl) |
607 |
+ $(conf_softmmu seccomp) |
608 |
+ $(conf_softmmu smartcard) |
609 |
+ $(conf_softmmu snappy) |
610 |
+ $(conf_softmmu spice) |
611 |
+ $(conf_softmmu ssh libssh2) |
612 |
+ $(conf_softmmu usb libusb) |
613 |
+ $(conf_softmmu usbredir usb-redir) |
614 |
+ $(conf_softmmu uuid) |
615 |
+ $(conf_softmmu vde) |
616 |
+ $(conf_softmmu vhost-net) |
617 |
+ $(conf_softmmu virgl virglrenderer) |
618 |
+ $(conf_softmmu virtfs) |
619 |
+ $(conf_softmmu vnc) |
620 |
+ $(conf_softmmu vte) |
621 |
+ $(conf_softmmu xen) |
622 |
+ $(conf_softmmu xen xen-pci-passthrough) |
623 |
+ $(conf_softmmu xfs xfsctl) |
624 |
+ ) |
625 |
+ |
626 |
+ case ${buildtype} in |
627 |
+ user) |
628 |
+ conf_opts+=( |
629 |
+ --enable-linux-user |
630 |
+ --disable-system |
631 |
+ --disable-blobs |
632 |
+ --disable-tools |
633 |
+ ) |
634 |
+ ;; |
635 |
+ softmmu) |
636 |
+ # audio options |
637 |
+ local audio_opts="oss" |
638 |
+ use alsa && audio_opts="alsa,${audio_opts}" |
639 |
+ use sdl && audio_opts="sdl,${audio_opts}" |
640 |
+ use pulseaudio && audio_opts="pa,${audio_opts}" |
641 |
+ |
642 |
+ conf_opts+=( |
643 |
+ --disable-linux-user |
644 |
+ --enable-system |
645 |
+ --with-system-pixman |
646 |
+ --audio-drv-list="${audio_opts}" |
647 |
+ ) |
648 |
+ use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) ) |
649 |
+ use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) ) |
650 |
+ ;; |
651 |
+ tools) |
652 |
+ conf_opts+=( |
653 |
+ --disable-linux-user |
654 |
+ --disable-system |
655 |
+ --disable-blobs |
656 |
+ $(use_enable bzip2) |
657 |
+ ) |
658 |
+ static_flag="static" |
659 |
+ ;; |
660 |
+ esac |
661 |
+ |
662 |
+ local targets="${buildtype}_targets" |
663 |
+ [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" ) |
664 |
+ |
665 |
+ # Add support for SystemTAP |
666 |
+ use systemtap && conf_opts+=( --enable-trace-backend=dtrace ) |
667 |
+ |
668 |
+ # We always want to attempt to build with PIE support as it results |
669 |
+ # in a more secure binary. But it doesn't work with static or if |
670 |
+ # the current GCC doesn't have PIE support. |
671 |
+ if use ${static_flag}; then |
672 |
+ conf_opts+=( --static --disable-pie ) |
673 |
+ else |
674 |
+ gcc-specs-pie && conf_opts+=( --enable-pie ) |
675 |
+ fi |
676 |
+ |
677 |
+ echo "../configure ${conf_opts[*]}" |
678 |
+ cd "${builddir}" |
679 |
+ ../configure "${conf_opts[@]}" || die "configure failed" |
680 |
+ |
681 |
+ # FreeBSD's kernel does not support QEMU assigning/grabbing |
682 |
+ # host USB devices yet |
683 |
+ use kernel_FreeBSD && \ |
684 |
+ sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak |
685 |
+} |
686 |
+ |
687 |
+src_configure() { |
688 |
+ local target |
689 |
+ |
690 |
+ python_setup |
691 |
+ |
692 |
+ softmmu_targets= softmmu_bins=() |
693 |
+ user_targets= user_bins=() |
694 |
+ |
695 |
+ for target in ${IUSE_SOFTMMU_TARGETS} ; do |
696 |
+ if use "qemu_softmmu_targets_${target}"; then |
697 |
+ softmmu_targets+=",${target}-softmmu" |
698 |
+ softmmu_bins+=( "qemu-system-${target}" ) |
699 |
+ fi |
700 |
+ done |
701 |
+ |
702 |
+ for target in ${IUSE_USER_TARGETS} ; do |
703 |
+ if use "qemu_user_targets_${target}"; then |
704 |
+ user_targets+=",${target}-linux-user" |
705 |
+ user_bins+=( "qemu-${target}" ) |
706 |
+ fi |
707 |
+ done |
708 |
+ |
709 |
+ softmmu_targets=${softmmu_targets#,} |
710 |
+ user_targets=${user_targets#,} |
711 |
+ |
712 |
+ [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu" |
713 |
+ [[ -n ${user_targets} ]] && qemu_src_configure "user" |
714 |
+ [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools" |
715 |
+} |
716 |
+ |
717 |
+src_compile() { |
718 |
+ if [[ -n ${user_targets} ]]; then |
719 |
+ cd "${S}/user-build" |
720 |
+ default |
721 |
+ fi |
722 |
+ |
723 |
+ if [[ -n ${softmmu_targets} ]]; then |
724 |
+ cd "${S}/softmmu-build" |
725 |
+ default |
726 |
+ fi |
727 |
+ |
728 |
+ if [[ -z ${softmmu_targets}${user_targets} ]]; then |
729 |
+ cd "${S}/tools-build" |
730 |
+ default |
731 |
+ fi |
732 |
+} |
733 |
+ |
734 |
+src_test() { |
735 |
+ if [[ -n ${softmmu_targets} ]]; then |
736 |
+ cd "${S}/softmmu-build" |
737 |
+ pax-mark m */qemu-system-* #515550 |
738 |
+ emake -j1 check |
739 |
+ emake -j1 check-report.html |
740 |
+ fi |
741 |
+} |
742 |
+ |
743 |
+qemu_python_install() { |
744 |
+ python_domodule "${S}/scripts/qmp/qmp.py" |
745 |
+ |
746 |
+ python_doscript "${S}/scripts/kvm/vmxcap" |
747 |
+ python_doscript "${S}/scripts/qmp/qmp-shell" |
748 |
+ python_doscript "${S}/scripts/qmp/qemu-ga-client" |
749 |
+} |
750 |
+ |
751 |
+src_install() { |
752 |
+ if [[ -n ${user_targets} ]]; then |
753 |
+ cd "${S}/user-build" |
754 |
+ emake DESTDIR="${ED}" install |
755 |
+ |
756 |
+ # Install binfmt handler init script for user targets |
757 |
+ newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt |
758 |
+ fi |
759 |
+ |
760 |
+ if [[ -n ${softmmu_targets} ]]; then |
761 |
+ cd "${S}/softmmu-build" |
762 |
+ emake DESTDIR="${ED}" install |
763 |
+ |
764 |
+ # This might not exist if the test failed. #512010 |
765 |
+ [[ -e check-report.html ]] && dohtml check-report.html |
766 |
+ |
767 |
+ if use kernel_linux; then |
768 |
+ udev_dorules "${FILESDIR}"/65-kvm.rules |
769 |
+ fi |
770 |
+ |
771 |
+ if use python; then |
772 |
+ python_foreach_impl qemu_python_install |
773 |
+ fi |
774 |
+ fi |
775 |
+ |
776 |
+ if [[ -z ${softmmu_targets}${user_targets} ]]; then |
777 |
+ cd "${S}/tools-build" |
778 |
+ emake DESTDIR="${ED}" install |
779 |
+ fi |
780 |
+ |
781 |
+ # Disable mprotect on the qemu binaries as they use JITs to be fast #459348 |
782 |
+ pushd "${ED}"/usr/bin >/dev/null |
783 |
+ pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}" |
784 |
+ popd >/dev/null |
785 |
+ |
786 |
+ # Install config file example for qemu-bridge-helper |
787 |
+ insinto "/etc/qemu" |
788 |
+ doins "${FILESDIR}/bridge.conf" |
789 |
+ |
790 |
+ # Remove the docdir placed qmp-commands.txt |
791 |
+ mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/" || die |
792 |
+ |
793 |
+ cd "${S}" |
794 |
+ dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt |
795 |
+ newdoc pc-bios/README README.pc-bios |
796 |
+ dodoc docs/qmp-*.txt |
797 |
+ |
798 |
+ if [[ -n ${softmmu_targets} ]]; then |
799 |
+ # Remove SeaBIOS since we're using the SeaBIOS packaged one |
800 |
+ rm "${ED}/usr/share/qemu/bios.bin" |
801 |
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then |
802 |
+ dosym ../seabios/bios.bin /usr/share/qemu/bios.bin |
803 |
+ fi |
804 |
+ |
805 |
+ # Remove vgabios since we're using the vgabios packaged one |
806 |
+ rm "${ED}/usr/share/qemu/vgabios.bin" |
807 |
+ rm "${ED}/usr/share/qemu/vgabios-cirrus.bin" |
808 |
+ rm "${ED}/usr/share/qemu/vgabios-qxl.bin" |
809 |
+ rm "${ED}/usr/share/qemu/vgabios-stdvga.bin" |
810 |
+ rm "${ED}/usr/share/qemu/vgabios-vmware.bin" |
811 |
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then |
812 |
+ dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin |
813 |
+ dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin |
814 |
+ dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin |
815 |
+ dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin |
816 |
+ dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin |
817 |
+ fi |
818 |
+ |
819 |
+ # Remove sgabios since we're using the sgabios packaged one |
820 |
+ rm "${ED}/usr/share/qemu/sgabios.bin" |
821 |
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then |
822 |
+ dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin |
823 |
+ fi |
824 |
+ |
825 |
+ # Remove iPXE since we're using the iPXE packaged one |
826 |
+ rm "${ED}"/usr/share/qemu/pxe-*.rom |
827 |
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then |
828 |
+ dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom |
829 |
+ dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom |
830 |
+ dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom |
831 |
+ dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom |
832 |
+ dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom |
833 |
+ dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom |
834 |
+ fi |
835 |
+ fi |
836 |
+ |
837 |
+ qemu_support_kvm && readme.gentoo_create_doc |
838 |
+} |
839 |
+ |
840 |
+pkg_postinst() { |
841 |
+ if qemu_support_kvm; then |
842 |
+ readme.gentoo_print_elog |
843 |
+ fi |
844 |
+ |
845 |
+ if [[ -n ${softmmu_targets} ]] && use kernel_linux; then |
846 |
+ udev_reload |
847 |
+ fi |
848 |
+ |
849 |
+ fcaps cap_net_admin /usr/libexec/qemu-bridge-helper |
850 |
+} |
851 |
+ |
852 |
+pkg_info() { |
853 |
+ echo "Using:" |
854 |
+ echo " $(best_version app-emulation/spice-protocol)" |
855 |
+ echo " $(best_version sys-firmware/ipxe)" |
856 |
+ echo " $(best_version sys-firmware/seabios)" |
857 |
+ if has_version 'sys-firmware/seabios[binary]'; then |
858 |
+ echo " USE=binary" |
859 |
+ else |
860 |
+ echo " USE=''" |
861 |
+ fi |
862 |
+ echo " $(best_version sys-firmware/vgabios)" |
863 |
+} |