Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/releng:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
Date: Sat, 22 Feb 2014 14:19:49
Message-Id: 1393078489.8ba3585ad3576156987e3897ee8bbafb325d3bb6.blueness@gentoo
1 commit: 8ba3585ad3576156987e3897ee8bbafb325d3bb6
2 Author: Felix Janda <felix.janda <AT> posteo <DOT> de>
3 AuthorDate: Wed Feb 19 19:19:49 2014 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Sat Feb 22 14:14:49 2014 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/releng.git;a=commit;h=8ba3585a
7
8 app-emulation/qemu: add to tree
9
10 ---
11 app-emulation/qemu/Manifest | 12 +
12 app-emulation/qemu/files/65-kvm.rules | 1 +
13 app-emulation/qemu/files/bridge.conf | 14 +
14 app-emulation/qemu/files/qemu-1.5.3-openpty.patch | 12 +
15 app-emulation/qemu/files/qemu-1.7.0-ffsll.patch | 19 +
16 app-emulation/qemu/files/qemu-1.7.0-sigset_t.patch | 12 +
17 app-emulation/qemu/files/qemu-9999-cflags.patch | 13 +
18 app-emulation/qemu/files/qemu-binfmt.initd-r1 | 129 +++++
19 app-emulation/qemu/files/qemu-kvm-1.4 | 3 +
20 app-emulation/qemu/metadata.xml | 52 ++
21 app-emulation/qemu/qemu-1.5.3-r99.ebuild | 552 +++++++++++++++++++++
22 11 files changed, 819 insertions(+)
23
24 diff --git a/app-emulation/qemu/Manifest b/app-emulation/qemu/Manifest
25 new file mode 100644
26 index 0000000..92ffdfd
27 --- /dev/null
28 +++ b/app-emulation/qemu/Manifest
29 @@ -0,0 +1,12 @@
30 +AUX 65-kvm.rules 40 SHA256 c16a8dc7855880b2651f1a3ff488ecc54d4ac1036c71fffd5007021d8d18a7c5 SHA512 98aad2a2f212a7ac0ee5b60a9c92744fa462bce5f26594845c7a31d692aaaca2d52cb57bdbede7dfc60b9862c2a6510665dbb03215d5cf76e62516a283decdd6 WHIRLPOOL 937de93a23930f6b8533f0c3e0dd249c99ddf7d54446dea857607266ac0a4b435c5b4a52b2986b138bace9c0a7ade66f94116b38e2bc4767ead54bd11baf0920
31 +AUX bridge.conf 454 SHA256 a51850dd39923f3482e4c575b48ad9fef9c9ebb2f2176225da399b79ce48c69d SHA512 a907ee86b81a1b61033bb7621ded65112504131ef7b698c53e4014b958ee6fc79e66f63069015a01e41362cb70a7d0ed26dd9a03033cf776f4846f0e1f8f1533 WHIRLPOOL 8fcbd4abf9b8f7ca3d16fe0eaf17196ebf708dfecf85ce0f020e0de22b64905114f7b310f361826c81bb961c6b1bbbf984bff1e595bb949993b8966ccb222c35
32 +AUX qemu-1.5.3-openpty.patch 256 SHA256 885ff6391fc7a106b41f7d29ff103c083ecc34580ddd68918c0398bacff43aad SHA512 e5e1900d015880977fcad370b79d5030c782edf2a5794d082796714f95b431447e7d38558ffdfae5af5f7d5d5d6dc2ba3af27e0cee644a72b62651a4570009e4 WHIRLPOOL 894593cd57a96a619b53574e5e86ba72b62659e525cb615522e7ee9ff856454b7d0aee5f9c8cf08641efa5245aba3577808ec8858f4ea73f30483313eb315204
33 +AUX qemu-1.7.0-ffsll.patch 560 SHA256 d211b937e4c50d50c680cf7e4450079a3b3924857849d7a99da4e3adac708aa8 SHA512 00594c276865ae9d3c1b748ebcf3e5d88b8a4b10e1700b215f22de5dbd6ba06bb9ad9b461bc93ba3b8794418d4197d3af45ef5eb46b9c1829afa9ca0b1eacf13 WHIRLPOOL 475307753a39fab1bf2e82602068f9992978cf74f9c3374369d1c0329592248b31830135d07d1386d8a66a7bf539a33551ac9de04478e5a2efe4d8385689e61d
34 +AUX qemu-1.7.0-sigset_t.patch 403 SHA256 081866f22ed90e9e4bfb91fed7b213d923d369dcfdec229fcc8120074d9ba18a SHA512 65106e0d6f3e0b8bd8623d54d9f8795d422dcae90f682025e0b71aa56e0668c24babbbebddebb0f88227e97447c50b840bcea234d264c58a438e04ea3cfa3095 WHIRLPOOL 32a6c3dc3a967dc0882914b5cf7e10cba3be7925ae0a8ed0e85690d5c12e055544240e44efaf9ab9ce3de6620f12127331d3dd46c6ea03a4bb4d56e17d68e9db
35 +AUX qemu-9999-cflags.patch 347 SHA256 fe3bcbe83e81225b2c722578a0a976fcb724419d5208bbd6d02fb543e80b7e12 SHA512 e1b8be744170d61a2155b23a8394db01f8af6dc70ec033e71b2ff46f72975704836d42b96d7904e5d462289c5f8f24317f2fb28698f18a77ab1de02829e585eb WHIRLPOOL 2d972c7e40292f424fd37a4c1af04d2be095c215211ec2e1d15d8457df553342ffc02a7d39985f817fbbf5342e422d30e439c35a925341cf9b852ca7ff15a308
36 +AUX qemu-binfmt.initd-r1 7023 SHA256 3572c110c6f217754e638796400a5901910a2e61b8818c8569f8258b103ebcc6 SHA512 773af64fef164c00945acf5881e64a10141aa8fdc85491e57bf8dcc7c800a4f81879527998a0896a42f921edcbf5f741beb31ac2a82e45cba506c7b8461733c8 WHIRLPOOL 30382fe347248683e989c2b7fbd804ce26173b313746d80467029b2ad3594f414628f7537120b168a0e700c424d3525528eb632b07e16544c2fd07f418f3187c
37 +AUX qemu-kvm-1.4 68 SHA256 8b1adf198129f001e75a2311fc420c168094d1084d2163cdf6a32b3b23c96137 SHA512 706fab4d155c410acc292e67fb354ce7dcd17f7e33f2ca8c9c44035ea128f8d36f89e27cf87ebe22721f5676be9e7f2ae5484fd000183c8ffd7854e02eb3d120 WHIRLPOOL ef795330b592cef8e3d92f52a77eb77a671e6aa1a47d07531917b5c1c09e72e5df1a44aea939b086e0a3c5ef2a5cea9223556a46ceae73e55300475c42f07067
38 +DIST qemu-1.5.3-25d93791.tar.xz 3136 SHA256 311bf6db68e37080a7cb3ea9bd573420b783dd2484ce62a936abba39e3b58446 SHA512 023df394a5dd76e7a0363b0cf994a41f18eac0b1e15ba5aca025dd73456d05535eef729ed6febec245c2f51aa10611366ee68175d80057ce6ab92a3a1c79a191 WHIRLPOOL e8e090eb5f425ba07de3bad58155558bf8aed5db3715e4a9dc8b0b3f0913c1fcbc6e727704e66f3979f57b86b0563efdd0462069ea3f0f7b37c001c564ec3d4f
39 +DIST qemu-1.5.3.tar.bz2 11932631 SHA256 39364ccbe82434c4eb8c25813896a1dce2db1977080d06ce13f96aa24ee2a601 SHA512 a14c7ec22cbf94fcc53ae5bc4d663dbcb1e29e14aac7bb2bd03f7ae1afdcf528c4198856db7aba32f0c84b5b9f583137fa4c0cf386a12c8f74c9c8d7825f1c52 WHIRLPOOL b793744e935922e58ff2528ed77ad416cbef086b259dec974f9b0c9aba08949cbe958e468d67ce4606baa66e236902e186f9679e27041fbddef506267d792b15
40 +EBUILD qemu-1.5.3-r99.ebuild 17666 SHA256 b386ef4824abf36f0bd869cb8ba71422ec86eb9718a64f055872f787f4bc506b SHA512 c2f13a4dfdaa21762ac6a374da25582d51e42153e94ea1e35b58e0a4b8d72572d0b1032926a716e0bf0d262fffb6e2cab5f00667013fe921693c3e281916903b WHIRLPOOL e38bade926f0535686f9c9a4962587df9130fcabad9295757ebef068632917e1e231aadf47e0b0c97449d98489f8d653e83f787c3d9bfc2b1bbe47d9803772e4
41 +MISC metadata.xml 3516 SHA256 5ee91d2ad67fa84993869317278d95577e7dc94fa2fccd3635f5b8c2ce543ef1 SHA512 62e3c9d519cfa8e1c100efd2c39f5a7940abb5eeb0fd3ce0fa2b0c175eeeb4942a5521282fbb07056bf80c37ea7c81e1e78e8aa42cd313d0a9b24f327f2a5103 WHIRLPOOL aabc5374e1aeaf3907c638290d04fc7ba47bd7f71b0b3962281743c2dcd782d29e865579b8cba21cae2b117936175780346cc937dcd63eded58099f2448a3d43
42
43 diff --git a/app-emulation/qemu/files/65-kvm.rules b/app-emulation/qemu/files/65-kvm.rules
44 new file mode 100644
45 index 0000000..c2f7317
46 --- /dev/null
47 +++ b/app-emulation/qemu/files/65-kvm.rules
48 @@ -0,0 +1 @@
49 +KERNEL=="kvm", GROUP="kvm", MODE="0660"
50
51 diff --git a/app-emulation/qemu/files/bridge.conf b/app-emulation/qemu/files/bridge.conf
52 new file mode 100644
53 index 0000000..2bde37e
54 --- /dev/null
55 +++ b/app-emulation/qemu/files/bridge.conf
56 @@ -0,0 +1,14 @@
57 +# This should have the following permissions: root:qemu 0640
58 +
59 +# allow br0
60 +# Uncommenting the above would allow users in the 'qemu' group
61 +# to add devices to 'br0'
62 +
63 +# allow virbr0
64 +# Uncommenting the above would allow users in the 'qemu' group
65 +# to add devices to 'virbr0'
66 +
67 +# include /etc/qemu/bob.conf
68 +# Uncommenting the above would allow users in the 'bob' group
69 +# to have permissions defined in it, iff it has the following
70 +# permissions: root:bob 0640
71
72 diff --git a/app-emulation/qemu/files/qemu-1.5.3-openpty.patch b/app-emulation/qemu/files/qemu-1.5.3-openpty.patch
73 new file mode 100644
74 index 0000000..5c71c5b
75 --- /dev/null
76 +++ b/app-emulation/qemu/files/qemu-1.5.3-openpty.patch
77 @@ -0,0 +1,12 @@
78 +Patch taken from sabotage linux
79 +--- qemu-1.7.0.org/util/qemu-openpty.c
80 ++++ qemu-1.7.0/util/qemu-openpty.c
81 +@@ -47,6 +47,8 @@
82 + #elif defined CONFIG_SOLARIS
83 + # include <termios.h>
84 + # include <stropts.h>
85 ++#else
86 ++# include <termios.h>
87 + #endif
88 +
89 + #ifdef __sun__
90
91 diff --git a/app-emulation/qemu/files/qemu-1.7.0-ffsll.patch b/app-emulation/qemu/files/qemu-1.7.0-ffsll.patch
92 new file mode 100644
93 index 0000000..481bd72
94 --- /dev/null
95 +++ b/app-emulation/qemu/files/qemu-1.7.0-ffsll.patch
96 @@ -0,0 +1,19 @@
97 +taken from sabotage linux
98 +--- qemu-1.7.0.org/hw/virtio/vhost.c
99 ++++ qemu-1.7.0/hw/virtio/vhost.c
100 +@@ -22,6 +22,15 @@
101 + #include "exec/address-spaces.h"
102 + #include "hw/virtio/virtio-bus.h"
103 +
104 ++#ifndef HAVE_FFSLL
105 ++static int ffsll(long long i) {
106 ++ unsigned long long x = i & -i;
107 ++ if (x <= 0xffffffff) return ffs (i);
108 ++ else return 32 + ffs (i >> 32);
109 ++}
110 ++#endif
111 ++
112 ++
113 + static void vhost_dev_sync_region(struct vhost_dev *dev,
114 + MemoryRegionSection *section,
115 + uint64_t mfirst, uint64_t mlast,
116
117 diff --git a/app-emulation/qemu/files/qemu-1.7.0-sigset_t.patch b/app-emulation/qemu/files/qemu-1.7.0-sigset_t.patch
118 new file mode 100644
119 index 0000000..1d5d173
120 --- /dev/null
121 +++ b/app-emulation/qemu/files/qemu-1.7.0-sigset_t.patch
122 @@ -0,0 +1,12 @@
123 +taken from sabotage linux
124 +--- qemu-1.7.0.org/linux-user/syscall.c
125 ++++ qemu-1.7.0/linux-user/syscall.c
126 +@@ -400,7 +400,7 @@
127 + #endif
128 + #define __NR_sys_ppoll __NR_ppoll
129 + _syscall5(int, sys_ppoll, struct pollfd *, fds, nfds_t, nfds,
130 +- struct timespec *, timeout, const __sigset_t *, sigmask,
131 ++ struct timespec *, timeout, const sigset_t *, sigmask,
132 + size_t, sigsetsize)
133 + #endif
134 +
135
136 diff --git a/app-emulation/qemu/files/qemu-9999-cflags.patch b/app-emulation/qemu/files/qemu-9999-cflags.patch
137 new file mode 100644
138 index 0000000..08a6c9f
139 --- /dev/null
140 +++ b/app-emulation/qemu/files/qemu-9999-cflags.patch
141 @@ -0,0 +1,13 @@
142 +diff --git a/configure b/configure
143 +index 82f6e71..7e19aaf 100755
144 +--- a/configure
145 ++++ b/configure
146 +@@ -3131,8 +3131,6 @@ fi
147 + if test "$gcov" = "yes" ; then
148 + CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
149 + LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
150 +-elif test "$debug" = "no" ; then
151 +- CFLAGS="-O2 -D_FORTIFY_SOURCE=2 $CFLAGS"
152 + fi
153 +
154 +
155
156 diff --git a/app-emulation/qemu/files/qemu-binfmt.initd-r1 b/app-emulation/qemu/files/qemu-binfmt.initd-r1
157 new file mode 100644
158 index 0000000..4b1dba5
159 --- /dev/null
160 +++ b/app-emulation/qemu/files/qemu-binfmt.initd-r1
161 @@ -0,0 +1,129 @@
162 +#!/sbin/runscript
163 +# Copyright 1999-2013 Gentoo Foundation
164 +# Distributed under the terms of the GNU General Public License v2
165 +# $Header: /var/cvsroot/gentoo-x86/app-emulation/qemu/files/qemu-binfmt.initd-r1,v 1.3 2013/02/17 22:05:22 vapier Exp $
166 +
167 +# enable automatic i386/ARM/M68K/MIPS/SPARC/PPC/s390 program execution by the kernel
168 +
169 +depend() {
170 + after procfs
171 +}
172 +
173 +start() {
174 + ebegin "Registering qemu-user binaries"
175 +
176 + if [ ! -d /proc/sys/fs/binfmt_misc ] ; then
177 + modprobe -q binfmt_misc
178 + fi
179 +
180 + if [ ! -d /proc/sys/fs/binfmt_misc ] ; then
181 + eend $? "You need support for 'misc binaries' in your kernel!" || return
182 + fi
183 +
184 + if [ ! -f /proc/sys/fs/binfmt_misc/register ] ; then
185 + mount -t binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc >/dev/null 2>&1
186 + eend $? || return
187 + fi
188 +
189 + # probe cpu type
190 + cpu=`uname -m`
191 + case "$cpu" in
192 + i386|i486|i586|i686|i86pc|BePC|x86_64)
193 + cpu="i386"
194 + ;;
195 + m68k)
196 + cpu="m68k"
197 + ;;
198 + mips*)
199 + cpu="mips"
200 + ;;
201 + "Power Macintosh"|ppc|ppc64)
202 + cpu="ppc"
203 + ;;
204 + armv[4-9]*)
205 + cpu="arm"
206 + ;;
207 + sparc*)
208 + cpu="sparc"
209 + ;;
210 + esac
211 +
212 + # register the interpreter for each cpu except for the native one
213 + if [ $cpu != "i386" -a -x "/usr/bin/qemu-i386" ] ; then
214 + echo ':i386:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-i386:P' > /proc/sys/fs/binfmt_misc/register
215 + echo ':i486:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-i386:P' > /proc/sys/fs/binfmt_misc/register
216 + fi
217 + if [ $cpu != "alpha" -a -x "/usr/bin/qemu-alpha" ] ; then
218 + echo ':alpha:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x26\x90:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-alpha:P' > /proc/sys/fs/binfmt_misc/register
219 + fi
220 + if [ $cpu != "arm" -a -x "/usr/bin/qemu-arm" ] ; then
221 + echo ':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\x00\xff\xfe\xff\xff\xff:/usr/bin/qemu-arm:P' > /proc/sys/fs/binfmt_misc/register
222 + fi
223 + if [ $cpu != "arm" -a -x "/usr/bin/qemu-armeb" ] ; then
224 + echo ':armeb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-armeb:P' > /proc/sys/fs/binfmt_misc/register
225 + fi
226 + if [ $cpu != "sparc" -a -x "/usr/bin/qemu-sparc" ] ; then
227 + echo ':sparc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-sparc:P' > /proc/sys/fs/binfmt_misc/register
228 + fi
229 + if [ $cpu != "ppc" -a -x "/usr/bin/qemu-ppc" ] ; then
230 + echo ':ppc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-ppc:P' > /proc/sys/fs/binfmt_misc/register
231 + fi
232 + if [ $cpu != "m68k" -a -x "/usr/bin/qemu-m68k" ] ; then
233 + echo 'Please check cpu value and header information for m68k!'
234 + echo ':m68k:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-m68k:P' > /proc/sys/fs/binfmt_misc/register
235 + fi
236 + if [ $cpu != "mips" -a -x "/usr/bin/qemu-mips" ] ; then
237 + # FIXME: We could use the other endianness on a MIPS host.
238 + echo ':mips:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-mips:P' > /proc/sys/fs/binfmt_misc/register
239 + fi
240 + if [ $cpu != "mips" -a -x "/usr/bin/qemu-mipsel" ] ; then
241 + echo ':mipsel:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-mipsel:P' > /proc/sys/fs/binfmt_misc/register
242 + fi
243 + if [ $cpu != "mips" -a -x "/usr/bin/qemu-mipsn32" ] ; then
244 + echo ':mipsn32:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-mipsn32:P' > /proc/sys/fs/binfmt_misc/register
245 + fi
246 + if [ $cpu != "mips" -a -x "/usr/bin/qemu-mipsn32el" ] ; then
247 + echo ':mipsn32el:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-mipsn32el:P' > /proc/sys/fs/binfmt_misc/register
248 + fi
249 + if [ $cpu != "mips" -a -x "/usr/bin/qemu-mips64" ] ; then
250 + echo ':mips64:M::\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-mips64:P' > /proc/sys/fs/binfmt_misc/register
251 + fi
252 + if [ $cpu != "mips" -a -x "/usr/bin/qemu-mips64el" ] ; then
253 + echo ':mips64el:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-mips64el:P' > /proc/sys/fs/binfmt_misc/register
254 + fi
255 + if [ $cpu != "sh" -a -x "/usr/bin/qemu-sh4" ] ; then
256 + echo ':sh4:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a\x00:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-sh4:P' > /proc/sys/fs/binfmt_misc/register
257 + fi
258 + if [ $cpu != "sh" -a -x "/usr/bin/qemu-sh4eb" ] ; then
259 + echo ':sh4eb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-sh4eb:P' > /proc/sys/fs/binfmt_misc/register
260 + fi
261 + if [ $cpu != "s390x" -a -x "/usr/local/bin/qemu-s390x" ] ; then
262 + echo ':s390x:M::\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x16:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-s390x:P' > /proc/sys/fs/binfmt_misc/register
263 + fi
264 + eend $?
265 +}
266 +
267 +stop() {
268 + ebegin "Unregistering qemu-user binaries"
269 + local arches
270 +
271 + arches="${arches} i386 i486"
272 + arches="${arches} alpha"
273 + arches="${arches} arm armeb"
274 + arches="${arches} sparc"
275 + arches="${arches} ppc"
276 + arches="${arches} m68k"
277 + arches="${arches} mips mipsel mipsn32 mipsn32el mips64 mips64el"
278 + arches="${arches} sh4 sh4eb"
279 + arches="${arches} s390x"
280 +
281 + for a in ${arches}; do
282 + if [ -f /proc/sys/fs/binfmt_misc/$a ] ; then
283 + echo '-1' > /proc/sys/fs/binfmt_misc/$a
284 + fi
285 + done
286 +
287 + eend $?
288 +}
289 +
290 +# vim: ts=4 :
291
292 diff --git a/app-emulation/qemu/files/qemu-kvm-1.4 b/app-emulation/qemu/files/qemu-kvm-1.4
293 new file mode 100644
294 index 0000000..08da00b
295 --- /dev/null
296 +++ b/app-emulation/qemu/files/qemu-kvm-1.4
297 @@ -0,0 +1,3 @@
298 +#!/bin/sh
299 +
300 +exec /usr/bin/qemu-system-x86_64 -machine accel=kvm "$@"
301
302 diff --git a/app-emulation/qemu/metadata.xml b/app-emulation/qemu/metadata.xml
303 new file mode 100644
304 index 0000000..b80eaf7
305 --- /dev/null
306 +++ b/app-emulation/qemu/metadata.xml
307 @@ -0,0 +1,52 @@
308 +<?xml version="1.0" encoding="UTF-8"?>
309 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
310 +<pkgmetadata>
311 + <herd>qemu</herd>
312 + <maintainer>
313 + <email>cardoe@g.o</email>
314 + <name>Doug Goldstein</name>
315 + </maintainer>
316 + <use>
317 + <flag name='accessibility'>Adds support for braille displays using brltty</flag>
318 + <flag name='aio'>Enables support for Linux's Async IO</flag>
319 + <flag name='alsa'>Enable alsa output for sound emulation</flag>
320 + <flag name='curl'>Support ISOs / -cdrom directives vis HTTP or HTTPS.</flag>
321 + <flag name='fdt'>Enables firmware device tree support</flag>
322 + <flag name='glusterfs'>Enables GlusterFS cluster fileystem via
323 + <pkg>sys-cluster/glusterfs</pkg></flag>
324 + <flag name='iscsi'>Enable direct iSCSI support via
325 + <pkg>net-libs/libiscsi</pkg> instead of indirectly via the Linux
326 + block layer that <pkg>sys-block/open-iscsi</pkg> does.</flag>
327 + <flag name='mixemu'>Enable audio mixer emulation. On Fedora, known to cause performance problems when using SDL output and ALSA. For OSS, locks the sound device from other applications.</flag>
328 + <flag name='ncurses'>Enable the ncurses-based console</flag>
329 + <flag name='pulseaudio'>Enable pulseaudio output for sound emulation</flag>
330 + <flag name='rbd'>Enable rados block device backend support, see http://ceph.newdream.net/wiki/QEMU-RBD</flag>
331 + <flag name='sdl'>Enable the SDL-based console</flag>
332 + <flag name='seccomp'>Utilize <pkg>sys-libs/libseccomp</pkg> to enable kernel filtering of system calls to prevent malicious guests from doing damage.</flag>
333 + <flag name='spice'>Enable Spice protocol support via <pkg>app-emulation/spice</pkg></flag>
334 + <flag name='ssh'>Enable SSH based block device support via <pkg>net-libs/libssh2</pkg></flag>
335 + <flag name='static-softmmu'>Builds the Software MMU (system) targets as static binaries</flag>
336 + <flag name='static-user'>Build the User targets as static binaries</flag>
337 + <flag name='static'>Enables both 'static-softmmu' and 'static-user'</flag>
338 + <flag name='systemtap'>Enable SystemTAP/DTrace tracing</flag>
339 + <flag name='tci'>Enable the TCG Interpreter which can speed up or slowdown workloads depending on the host and guest CPUs being emulated. In the future it will be a runtime option but for now its compile time.</flag>
340 + <flag name='tls'>Enable TLS support for the VNC console server.
341 + For 1.4 and newer this also enables WebSocket support.</flag>
342 + <flag name='jpeg'>Enable jpeg image support for the VNC console server</flag>
343 + <flag name='png'>Enable png image support for the VNC console server</flag>
344 + <flag name='usb'>Enable USB passthrough via <pkg>dev-libs/libusbx</pkg></flag>
345 + <flag name="usbredir">Use <pkg>sys-apps/usbredir</pkg> to redirect USB
346 + devices to another machine over TCP</flag>
347 + <flag name='uuid'>Enable UUID support in the vdi block driver</flag>
348 + <flag name='vde'>Enable VDE-based networking</flag>
349 + <flag name='vhost-net'>Enable accelerated networking using vhost-net, see http://www.linux-kvm.org/page/VhostNet</flag>
350 + <flag name='virtfs'>Enable VirtFS via virtio-9p-pci / fsdev. See http://wiki.qemu.org/Documentation/9psetup</flag>
351 + <flag name='xattr'>
352 + Add support for getting and setting POSIX extended attributes, through
353 + <pkg>sys-apps/attr</pkg>. Requisite for the virtfs backend.
354 + </flag>
355 + <flag name='xen'>Enables support for Xen backends</flag>
356 + <flag name='xfs'>Support xfsctl() notification and syncing for XFS backed
357 + virtual disks.</flag>
358 + </use>
359 +</pkgmetadata>
360
361 diff --git a/app-emulation/qemu/qemu-1.5.3-r99.ebuild b/app-emulation/qemu/qemu-1.5.3-r99.ebuild
362 new file mode 100644
363 index 0000000..dfd48ce
364 --- /dev/null
365 +++ b/app-emulation/qemu/qemu-1.5.3-r99.ebuild
366 @@ -0,0 +1,552 @@
367 +# Copyright 1999-2013 Gentoo Foundation
368 +# Distributed under the terms of the GNU General Public License v2
369 +# $Header: /var/cvsroot/gentoo-x86/app-emulation/qemu/qemu-1.5.3.ebuild,v 1.3 2013/09/15 09:29:18 ago Exp $
370 +
371 +EAPI=5
372 +
373 +PYTHON_COMPAT=( python{2_6,2_7} )
374 +PYTHON_REQ_USE="ncurses,readline"
375 +
376 +inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
377 + user udev fcaps readme.gentoo
378 +
379 +BACKPORTS=25d93791
380 +
381 +if [[ ${PV} = *9999* ]]; then
382 + EGIT_REPO_URI="git://git.qemu.org/qemu.git"
383 + inherit git-2
384 + SRC_URI=""
385 + KEYWORDS=""
386 +else
387 + SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
388 + ${BACKPORTS:+
389 + http://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
390 + KEYWORDS="amd64 arm x86"
391 +fi
392 +
393 +DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
394 +HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
395 +
396 +LICENSE="GPL-2 LGPL-2 BSD-2"
397 +SLOT="0"
398 +IUSE="accessibility +aio alsa bluetooth +caps +curl debug fdt glusterfs \
399 +gtk iscsi +jpeg \
400 +kernel_linux kernel_FreeBSD mixemu ncurses opengl +png pulseaudio python \
401 +rbd sasl +seccomp sdl selinux smartcard spice static static-softmmu \
402 +static-user systemtap tci test +threads tls usbredir +uuid vde +vhost-net \
403 +virtfs +vnc xattr xen xfs"
404 +
405 +COMMON_TARGETS="i386 x86_64 alpha arm cris m68k microblaze microblazeel mips
406 +mipsel mips64 mips64el or32 ppc ppc64 sh4 sh4eb sparc sparc64 s390x unicore32"
407 +IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb xtensa xtensaeb"
408 +IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 sparc32plus"
409 +
410 +# Setup the default SoftMMU targets, while using the loops
411 +# below to setup the other targets.
412 +REQUIRED_USE="|| ("
413 +
414 +for target in ${IUSE_SOFTMMU_TARGETS}; do
415 + IUSE="${IUSE} qemu_softmmu_targets_${target}"
416 + REQUIRED_USE="${REQUIRED_USE} qemu_softmmu_targets_${target}"
417 +done
418 +
419 +for target in ${IUSE_USER_TARGETS}; do
420 + IUSE="${IUSE} qemu_user_targets_${target}"
421 + REQUIRED_USE="${REQUIRED_USE} qemu_user_targets_${target}"
422 +done
423 +REQUIRED_USE="${REQUIRED_USE} )"
424 +
425 +# Block USE flag configurations known to not work
426 +REQUIRED_USE="${REQUIRED_USE}
427 + python? ( ${PYTHON_REQUIRED_USE} )
428 + static? ( static-softmmu static-user )
429 + static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk )
430 + virtfs? ( xattr )"
431 +
432 +# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
433 +LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
434 + sys-apps/pciutils[static-libs(+)]
435 + sys-libs/zlib[static-libs(+)]
436 + >=x11-libs/pixman-0.28.0[static-libs(+)]
437 + aio? ( dev-libs/libaio[static-libs(+)] )
438 + caps? ( sys-libs/libcap-ng[static-libs(+)] )
439 + curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
440 + fdt? ( >=sys-apps/dtc-1.2.0[static-libs(+)] <sys-apps/dtc-1.4.0[static-libs(+)] )
441 + glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
442 + jpeg? ( virtual/jpeg[static-libs(+)] )
443 + ncurses? ( sys-libs/ncurses[static-libs(+)] )
444 + png? ( media-libs/libpng[static-libs(+)] )
445 + rbd? ( sys-cluster/ceph[static-libs(+)] )
446 + sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
447 + sdl? ( >=media-libs/libsdl-1.2.11[static-libs(+)] )
448 + seccomp? ( >=sys-libs/libseccomp-1.0.1[static-libs(+)] )
449 + spice? ( >=app-emulation/spice-0.12.0[static-libs(+)] )
450 + tls? ( net-libs/gnutls[static-libs(+)] )
451 + uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
452 + vde? ( net-misc/vde[static-libs(+)] )
453 + xattr? ( sys-apps/attr[static-libs(+)] )
454 + xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
455 +RDEPEND="!static-softmmu? ( ${LIB_DEPEND//\[static-libs(+)]} )
456 + static-user? ( >=dev-libs/glib-2.0[static-libs(+)] )
457 + qemu_softmmu_targets_i386? (
458 + >=sys-firmware/ipxe-1.0.0_p20130624
459 + ~sys-firmware/seabios-1.7.2.2
460 + ~sys-firmware/sgabios-0.1_pre8
461 + ~sys-firmware/vgabios-0.7a
462 + )
463 + qemu_softmmu_targets_x86_64? (
464 + >=sys-firmware/ipxe-1.0.0_p20130624
465 + ~sys-firmware/seabios-1.7.2.2
466 + ~sys-firmware/sgabios-0.1_pre8
467 + ~sys-firmware/vgabios-0.7a
468 + )
469 + accessibility? ( app-accessibility/brltty )
470 + alsa? ( >=media-libs/alsa-lib-1.0.13 )
471 + bluetooth? ( net-wireless/bluez )
472 + gtk? (
473 + x11-libs/gtk+:3
474 + x11-libs/vte:2.90
475 + )
476 + iscsi? ( net-libs/libiscsi )
477 + opengl? ( virtual/opengl )
478 + pulseaudio? ( media-sound/pulseaudio )
479 + python? ( ${PYTHON_DEPS} )
480 + sdl? ( media-libs/libsdl[X] )
481 + selinux? ( sec-policy/selinux-qemu )
482 + smartcard? ( dev-libs/nss !app-emulation/libcacard )
483 + spice? ( >=app-emulation/spice-protocol-0.12.3 )
484 + systemtap? ( dev-util/systemtap )
485 + usbredir? ( >=sys-apps/usbredir-0.6 )
486 + virtfs? ( sys-libs/libcap )
487 + xen? ( app-emulation/xen-tools )"
488 +
489 +DEPEND="${RDEPEND}
490 + dev-lang/perl
491 + =dev-lang/python-2*
492 + sys-apps/texinfo
493 + virtual/pkgconfig
494 + kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
495 + static-softmmu? ( ${LIB_DEPEND} )
496 + test? (
497 + dev-libs/glib[utils]
498 + sys-devel/bc
499 + )"
500 +
501 +STRIP_MASK="/usr/share/qemu/palcode-clipper"
502 +
503 +QA_PREBUILT="
504 + usr/share/qemu/openbios-ppc
505 + usr/share/qemu/openbios-sparc64
506 + usr/share/qemu/openbios-sparc32
507 + usr/share/qemu/palcode-clipper
508 + usr/share/qemu/s390-ccw.img"
509 +
510 +QA_WX_LOAD="usr/bin/qemu-i386
511 + usr/bin/qemu-x86_64
512 + usr/bin/qemu-alpha
513 + usr/bin/qemu-arm
514 + usr/bin/qemu-cris
515 + usr/bin/qemu-m68k
516 + usr/bin/qemu-microblaze
517 + usr/bin/qemu-microblazeel
518 + usr/bin/qemu-mips
519 + usr/bin/qemu-mipsel
520 + usr/bin/qemu-or32
521 + usr/bin/qemu-ppc
522 + usr/bin/qemu-ppc64
523 + usr/bin/qemu-ppc64abi32
524 + usr/bin/qemu-sh4
525 + usr/bin/qemu-sh4eb
526 + usr/bin/qemu-sparc
527 + usr/bin/qemu-sparc64
528 + usr/bin/qemu-armeb
529 + usr/bin/qemu-sparc32plus
530 + usr/bin/qemu-s390x
531 + usr/bin/qemu-unicore32"
532 +
533 +DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
534 +you have the kernel module loaded before running kvm. The easiest way to
535 +ensure that the kernel module is loaded is to load it on boot.\n
536 +For AMD CPUs the module is called 'kvm-amd'\n
537 +For Intel CPUs the module is called 'kvm-intel'\n
538 +Please review /etc/conf.d/modules for how to load these\n\n
539 +Make sure your user is in the 'kvm' group\n
540 +Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
541 +
542 +qemu_support_kvm() {
543 + if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
544 + use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
545 + use qemu_softmmu_targets_s390x; then
546 + return 0
547 + fi
548 +
549 + return 1
550 +}
551 +
552 +pkg_pretend() {
553 + if use kernel_linux && kernel_is lt 2 6 25; then
554 + eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
555 + elif use kernel_linux; then
556 + if ! linux_config_exists; then
557 + eerror "Unable to check your kernel for KVM support"
558 + else
559 + CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
560 + ERROR_KVM="You must enable KVM in your kernel to continue"
561 + ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
562 + ERROR_KVM_AMD+=" your kernel configuration."
563 + ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
564 + ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
565 + ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
566 + ERROR_TUN+=" into your kernel or loaded as a module to use the"
567 + ERROR_TUN+=" virtual network device if using -net tap."
568 + ERROR_BRIDGE="You will also need support for 802.1d"
569 + ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
570 + use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
571 + ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
572 + ERROR_VHOST_NET+=" support"
573 +
574 + if use amd64 || use x86 || use amd64-linux || use x86-linux; then
575 + CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
576 + fi
577 +
578 + use python && CONFIG_CHECK+=" ~DEBUG_FS"
579 + ERROR_DEBUG_FS="debugFS support required for kvm_stat"
580 +
581 + # Now do the actual checks setup above
582 + check_extra_config
583 + fi
584 + fi
585 +}
586 +
587 +pkg_setup() {
588 + enewgroup kvm 78
589 +
590 + python_export_best
591 +}
592 +
593 +src_prepare() {
594 + # Alter target makefiles to accept CFLAGS set via flag-o
595 + sed -i 's/^\(C\|OP_C\|HELPER_C\)FLAGS=/\1FLAGS+=/' \
596 + Makefile Makefile.target || die
597 +
598 + epatch "${FILESDIR}"/qemu-9999-cflags.patch
599 + epatch "${FILESDIR}"/qemu-1.5.3-openpty.patch
600 + epatch "${FILESDIR}"/qemu-1.7.0-sigset_t.patch
601 + epatch "${FILESDIR}"/qemu-1.7.0-ffsll.patch
602 + [[ -n ${BACKPORTS} ]] && \
603 + EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
604 + epatch
605 +
606 + append-flags "-Dflock64=flock -D__SIGRTMIN=32 -D__SIGRTMAX=\(NSIG-1\)"
607 + append-flags "-DF_EXLCK=4 -DF_SHLCK=8"
608 +
609 + # Fix ld and objcopy being called directly
610 + tc-export LD OBJCOPY
611 +
612 + # Verbose builds
613 + MAKEOPTS+=" V=1"
614 +
615 + epatch_user
616 +}
617 +
618 +##
619 +# configures qemu based on the build directory and the build type
620 +# we are using.
621 +#
622 +qemu_src_configure() {
623 + debug-print-function $FUNCNAME "$@"
624 +
625 + local buildtype=$1
626 + local builddir=$2
627 + local conf_opts audio_opts
628 + local static_flag="static-${buildtype}"
629 +
630 + conf_opts="--prefix=/usr"
631 + conf_opts+=" --sysconfdir=/etc"
632 + conf_opts+=" --libdir=/usr/$(get_libdir)"
633 + conf_opts+=" --docdir=/usr/share/doc/${PF}/html"
634 + conf_opts+=" --disable-bsd-user"
635 + conf_opts+=" --disable-guest-agent"
636 + conf_opts+=" --disable-strip"
637 + conf_opts+=" --disable-werror"
638 + conf_opts+=" --python=${PYTHON}"
639 +
640 + # audio options
641 + audio_opts="oss"
642 + use alsa && audio_opts="alsa,${audio_opts}"
643 + use sdl && audio_opts="sdl,${audio_opts}"
644 + use pulseaudio && audio_opts="pa,${audio_opts}"
645 +
646 + if [[ ${buildtype} == "user" ]]; then
647 + conf_opts+=" --enable-linux-user"
648 + conf_opts+=" --disable-system"
649 + conf_opts+=" --target-list=${user_targets}"
650 + conf_opts+=" --disable-blobs"
651 + conf_opts+=" --disable-bluez"
652 + conf_opts+=" --disable-curses"
653 + conf_opts+=" --disable-kvm"
654 + conf_opts+=" --disable-libiscsi"
655 + conf_opts+=" --disable-glusterfs"
656 + conf_opts+=" $(use_enable seccomp)"
657 + conf_opts+=" --disable-sdl"
658 + conf_opts+=" --disable-smartcard-nss"
659 + conf_opts+=" --disable-tools"
660 + conf_opts+=" --disable-vde"
661 + fi
662 +
663 + if [[ ${buildtype} == "softmmu" ]]; then
664 + conf_opts+=" --disable-linux-user"
665 + conf_opts+=" --enable-system"
666 + conf_opts+=" --with-system-pixman"
667 + conf_opts+=" --target-list=${softmmu_targets}"
668 + conf_opts+=" $(use_enable bluetooth bluez)"
669 + conf_opts+=" $(use_enable gtk)"
670 + use gtk && conf_opts+=" --with-gtkabi=3.0"
671 + conf_opts+=" $(use_enable sdl)"
672 + conf_opts+=" $(use_enable aio linux-aio)"
673 + conf_opts+=" $(use_enable accessibility brlapi)"
674 + conf_opts+=" $(use_enable caps cap-ng)"
675 + conf_opts+=" $(use_enable curl)"
676 + conf_opts+=" $(use_enable fdt)"
677 + conf_opts+=" $(use_enable glusterfs)"
678 + conf_opts+=" $(use_enable iscsi libiscsi)"
679 + conf_opts+=" $(use_enable jpeg vnc-jpeg)"
680 + conf_opts+=" $(use_enable kernel_linux kvm)"
681 + conf_opts+=" $(use_enable kernel_linux nptl)"
682 + conf_opts+=" $(use_enable ncurses curses)"
683 + conf_opts+=" $(use_enable opengl glx)"
684 + conf_opts+=" $(use_enable png vnc-png)"
685 + conf_opts+=" $(use_enable rbd)"
686 + conf_opts+=" $(use_enable sasl vnc-sasl)"
687 + conf_opts+=" $(use_enable seccomp)"
688 + conf_opts+=" $(use_enable smartcard smartcard-nss)"
689 + conf_opts+=" $(use_enable spice)"
690 + conf_opts+=" $(use_enable tls vnc-tls)"
691 + conf_opts+=" $(use_enable tls vnc-ws)"
692 + conf_opts+=" $(use_enable usbredir usb-redir)"
693 + conf_opts+=" $(use_enable uuid)"
694 + conf_opts+=" $(use_enable vde)"
695 + conf_opts+=" $(use_enable vhost-net)"
696 + conf_opts+=" $(use_enable virtfs)"
697 + conf_opts+=" $(use_enable vnc)"
698 + conf_opts+=" $(use_enable xattr attr)"
699 + conf_opts+=" $(use_enable xen)"
700 + conf_opts+=" $(use_enable xen xen-pci-passthrough)"
701 + conf_opts+=" $(use_enable xfs xfsctl)"
702 + use mixemu && conf_opts+=" --enable-mixemu"
703 + conf_opts+=" --audio-drv-list=${audio_opts}"
704 + conf_opts+=" --enable-migration-from-qemu-kvm"
705 + fi
706 +
707 + conf_opts+=" $(use_enable debug debug-info)"
708 + conf_opts+=" $(use_enable debug debug-tcg)"
709 + conf_opts+=" --enable-docs"
710 + conf_opts+=" $(use_enable tci tcg-interpreter)"
711 +
712 + # Add support for SystemTAP
713 + use systemtap && conf_opts="${conf_opts} --enable-trace-backend=dtrace"
714 +
715 + # Add support for static builds
716 + use ${static_flag} && conf_opts="${conf_opts} --static --disable-pie"
717 +
718 + # We always want to attempt to build with PIE support as it results
719 + # in a more secure binary. But it doesn't work with static or if
720 + # the current GCC doesn't have PIE support.
721 + if ! use ${static_flag} && gcc-specs-pie; then
722 + conf_opts="${conf_opts} --enable-pie"
723 + fi
724 +
725 + einfo "./configure ${conf_opts}"
726 + cd ${builddir}
727 + ../configure \
728 + --cc="$(tc-getCC)" \
729 + --host-cc="$(tc-getBUILD_CC)" \
730 + ${conf_opts} \
731 + || die "configure failed"
732 +
733 + # FreeBSD's kernel does not support QEMU assigning/grabbing
734 + # host USB devices yet
735 + use kernel_FreeBSD && \
736 + sed -E -e "s|^(HOST_USB=)bsd|\1stub|" -i "${S}"/config-host.mak
737 +}
738 +
739 +src_configure() {
740 + softmmu_targets=
741 + user_targets=
742 +
743 + for target in ${IUSE_SOFTMMU_TARGETS} ; do
744 + use "qemu_softmmu_targets_${target}" && \
745 + softmmu_targets="${softmmu_targets},${target}-softmmu"
746 + done
747 +
748 + for target in ${IUSE_USER_TARGETS} ; do
749 + use "qemu_user_targets_${target}" && \
750 + user_targets="${user_targets},${target}-linux-user"
751 + done
752 +
753 + [[ -n ${softmmu_targets} ]] && \
754 + einfo "Building the following softmmu targets: ${softmmu_targets}"
755 +
756 + [[ -n ${user_targets} ]] && \
757 + einfo "Building the following user targets: ${user_targets}"
758 +
759 + if [[ -n ${softmmu_targets} ]]; then
760 + mkdir "${S}/softmmu-build"
761 + qemu_src_configure "softmmu" "${S}/softmmu-build"
762 + fi
763 +
764 + if [[ -n ${user_targets} ]]; then
765 + mkdir "${S}/user-build"
766 + qemu_src_configure "user" "${S}/user-build"
767 + fi
768 +}
769 +
770 +src_compile() {
771 + if [[ -n ${user_targets} ]]; then
772 + cd "${S}/user-build"
773 + default
774 + fi
775 +
776 + if [[ -n ${softmmu_targets} ]]; then
777 + cd "${S}/softmmu-build"
778 + default
779 + fi
780 +}
781 +
782 +src_test() {
783 + cd "${S}/softmmu-build"
784 + emake -j1 check
785 + emake -j1 check-report.html
786 +}
787 +
788 +qemu_python_install() {
789 + python_domodule "${S}/QMP/qmp.py"
790 +
791 + python_doscript "${S}/scripts/kvm/kvm_stat"
792 + python_doscript "${S}/scripts/kvm/vmxcap"
793 + python_doscript "${S}/QMP/qmp-shell"
794 + python_doscript "${S}/QMP/qemu-ga-client"
795 +}
796 +
797 +src_install() {
798 + if [[ -n ${user_targets} ]]; then
799 + cd "${S}/user-build"
800 + emake DESTDIR="${ED}" install
801 +
802 + # Install binfmt handler init script for user targets
803 + newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
804 + fi
805 +
806 + if [[ -n ${softmmu_targets} ]]; then
807 + cd "${S}/softmmu-build"
808 + emake DESTDIR="${ED}" install
809 +
810 + if use test; then
811 + dohtml check-report.html
812 + fi
813 +
814 + if use kernel_linux; then
815 + udev_dorules "${FILESDIR}"/65-kvm.rules
816 + fi
817 +
818 + if use qemu_softmmu_targets_x86_64 ; then
819 + newbin "${FILESDIR}/qemu-kvm-1.4" qemu-kvm
820 + ewarn "The deprecated '/usr/bin/kvm' symlink is no longer installed"
821 + ewarn "You should use '/usr/bin/qemu-kvm', you may need to edit"
822 + ewarn "your libvirt configs or other wrappers for ${PN}"
823 + elif use x86 || use amd64; then
824 + elog "You disabled QEMU_SOFTMMU_TARGETS=x86_64, this disables install"
825 + elog "of the /usr/bin/qemu-kvm script."
826 + fi
827 +
828 + if use python; then
829 + python_foreach_impl qemu_python_install
830 + fi
831 + fi
832 +
833 + # Install config file example for qemu-bridge-helper
834 + insinto "/etc/qemu"
835 + doins "${FILESDIR}/bridge.conf"
836 +
837 + # Remove the docdir placed qmp-commands.txt
838 + mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/QMP/"
839 +
840 + cd "${S}"
841 + dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
842 + newdoc pc-bios/README README.pc-bios
843 + dodoc QMP/qmp-commands.txt QMP/qmp-events.txt QMP/qmp-spec.txt
844 +
845 + # Remove SeaBIOS since we're using the SeaBIOS packaged one
846 + rm "${ED}/usr/share/qemu/bios.bin"
847 + if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
848 + dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
849 + fi
850 +
851 + # Remove vgabios since we're using the vgabios packaged one
852 + rm "${ED}/usr/share/qemu/vgabios.bin"
853 + rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
854 + rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
855 + rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
856 + rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
857 + if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
858 + dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
859 + dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
860 + dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
861 + dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
862 + dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
863 + fi
864 +
865 + # Remove sgabios since we're using the sgabios packaged one
866 + rm "${ED}/usr/share/qemu/sgabios.bin"
867 + if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
868 + dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
869 + fi
870 +
871 + # Remove iPXE since we're using the iPXE packaged one
872 + rm "${ED}"/usr/share/qemu/pxe-*.rom
873 + if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
874 + dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
875 + dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
876 + dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
877 + dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
878 + dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
879 + dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
880 + fi
881 +
882 + qemu_support_kvm && readme.gentoo_create_doc
883 +}
884 +
885 +pkg_postinst() {
886 + local virtfs_caps=
887 +
888 + if qemu_support_kvm; then
889 + readme.gentoo_print_elog
890 + ewarn "Migration from qemu-kvm instances and loading qemu-kvm created"
891 + ewarn "save states will be removed in the next release (1.6.x)"
892 + ewarn
893 + ewarn "It is recommended that you migrate any VMs that may be running"
894 + ewarn "on qemu-kvm to a host with a newer qemu and regenerate"
895 + ewarn "any saved states with a newer qemu."
896 + ewarn
897 + ewarn "qemu-kvm was the primary qemu provider in Gentoo through 1.2.x"
898 + fi
899 +
900 + virtfs_caps+="cap_chown,cap_dac_override,cap_fowner,cap_fsetid,"
901 + virtfs_caps+="cap_setgid,cap_mknod,cap_setuid"
902 +
903 + fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
904 + use virtfs && fcaps ${virtfs_caps} /usr/bin/virtfs-proxy-helper
905 +}
906 +
907 +pkg_info() {
908 + echo "Using:"
909 + echo " $(best_version app-emulation/spice-protocol)"
910 + echo " $(best_version sys-firmware/ipxe)"
911 + echo " $(best_version sys-firmware/seabios)"
912 + if has_version sys-firmware/seabios[binary]; then
913 + echo " USE=binary"
914 + else
915 + echo " USE=''"
916 + fi
917 + echo " $(best_version sys-firmware/vgabios)"
918 +}