]>
Commit | Line | Data |
---|---|---|
6aef4654 | 1 | # |
0b920c52 MŁ |
2 | # TODO: |
3 | # - wait till the gcc bug http://gcc.gnu.org/PR16185 is fixed. | |
4 | # | |
6aef4654 | 5 | # Conditional build: |
8f93639f | 6 | %bcond_without kqemu # disable KQEMU ACCELERATOR support in QEMU |
161ffd93 | 7 | %bcond_with cflags_passing # with passing rpmcflags to Makefiles |
a6d3659e | 8 | %bcond_with nosdlgui # do not use SDL gui (use X11 instead) |
63dabd29 AM |
9 | # Note that gcc4 build is very problematic and not supported by qemu team |
10 | %bcond_with gcc4 # use gcc4 patches (broke build on gcc33) | |
8bb1261c | 11 | %bcond_without dist_kernel # without distribution kernel |
b337f190 | 12 | %bcond_without kernel # build kqemu KERNEL MODULES |
3a6eaa3b | 13 | %bcond_without up # don't build up module |
8bb1261c KK |
14 | %bcond_without smp # don't build SMP module |
15 | %bcond_without userspace # don't build userspace utilities | |
39b50bf0 | 16 | # |
3a6eaa3b | 17 | |
b337f190 | 18 | %define _kqemu_version 1.3.0pre11 |
19 | %define _rel 1 | |
cd19124e | 20 | Summary: QEMU CPU Emulator |
eec0535a | 21 | Summary(pl.UTF-8): QEMU - emulator procesora |
cd19124e | 22 | Name: qemu |
b337f190 | 23 | Version: 0.9.0 |
8bb1261c | 24 | Release: %{_rel}%{?with_kqemu:k} |
5a2da1d0 JB |
25 | License: GPL |
26 | Group: Applications/Emulators | |
867764ba | 27 | #Source0Download: http://fabrice.bellard.free.fr/qemu/download.html |
cd19124e | 28 | Source0: http://fabrice.bellard.free.fr/qemu/%{name}-%{version}.tar.gz |
b337f190 | 29 | # Source0-md5: ab11a03ba30cf4a70641f0f170473d69 |
c33439fc | 30 | Source1: http://fabrice.bellard.free.fr/qemu/k%{name}-%{_kqemu_version}.tar.gz |
b337f190 | 31 | # Source1-md5: 970521874ef8b1ba4598925ace5936c3 |
8bd2aee2 | 32 | Patch0: %{name}-nostatic.patch |
c33439fc | 33 | Patch1: %{name}-cc.patch |
d8d8cede | 34 | Patch3: %{name}-dot.patch |
8d073aaa ER |
35 | Patch4: %{name}-gcc4_x86.patch |
36 | Patch5: %{name}-gcc4_ppc.patch | |
37 | Patch6: %{name}-nosdlgui.patch | |
38 | Patch7: %{name}-ifup.patch | |
81a493f2 MM |
39 | # Proof of concept, for reference, do not remove |
40 | Patch8: %{name}-kde_virtual_workspaces_hack.patch | |
e05988b9 AM |
41 | # http://gwenole.beauchesne.info/en/projects/qemu |
42 | Patch9: %{name}-0.8.0-gcc4-hacks.patch | |
e05988b9 | 43 | Patch11: %{name}-0.7.2-gcc4-opts.patch |
b337f190 | 44 | #Patch12: %{name}-0.7.2-dyngen-check-stack-clobbers.patch |
cd19124e | 45 | URL: http://fabrice.bellard.free.fr/qemu/ |
d1ae30a6 | 46 | %if %{with kernel} && %{with dist_kernel} |
47 | BuildRequires: kernel%{_alt_kernel}-module-build >= 3:2.6.7 | |
9ea49998 | 48 | BuildRequires: rpmbuild(macros) >= 1.330 |
d1ae30a6 | 49 | %endif |
50 | %if %{with userspace} | |
867764ba | 51 | BuildRequires: SDL-devel >= 1.2.1 |
b0b3ca8d | 52 | BuildRequires: alsa-lib-devel |
21c5c008 | 53 | %{!?with_gcc4:BuildRequires: gcc < 5:4.0} |
2fb8ea02 | 54 | BuildRequires: perl-tools-pod |
2fb8ea02 | 55 | BuildRequires: tetex |
8bb1261c | 56 | BuildRequires: sed >= 4.0 |
d1ae30a6 | 57 | %endif |
8bb1261c | 58 | Requires: SDL >= 1.2.1 |
2ef13cb9 | 59 | # sparc is currently unsupported (missing cpu_get_real_ticks() impl in vl.c) |
39b50bf0 | 60 | ExclusiveArch: %{ix86} %{x8664} %{!?with_kqemu:ppc} |
cd19124e | 61 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
62 | ||
867764ba | 63 | # some SPARC boot image in ELF format |
ca55b10f | 64 | %define _noautostrip .*%{_datadir}/qemu/openbios-sparc32 |
867764ba | 65 | |
cd19124e | 66 | %description |
67 | QEMU is a FAST! processor emulator. By using dynamic translation it | |
68 | achieves a reasonnable speed while being easy to port on new host | |
69 | CPUs. QEMU has two operating modes: | |
70 | ||
71 | - User mode emulation. In this mode, QEMU can launch Linux processes | |
72 | compiled for one CPU on another CPU. Linux system calls are converted | |
73 | because of endianness and 32/64 bit mismatches. Wine (Windows | |
74 | emulation) and DOSEMU (DOS emulation) are the main targets for QEMU. | |
75 | ||
76 | - Full system emulation. In this mode, QEMU emulates a full system, | |
8799423b ER |
77 | including a processor and various peripherials. It can also be used to |
78 | provide virtual hosting of several virtual PC on a single server. | |
cd19124e | 79 | |
27b30e9c JR |
80 | %description -l pl.UTF-8 |
81 | QEMU to szybki(!) emulator procesora. Poprzez użycie dynamicznego | |
82 | tłumaczenia osiąga rozsądną szybkość i jest łatwy do przeportowania, | |
83 | aby działał na kolejnych procesorach. QEMU ma dwa tryby pracy: | |
5a2da1d0 | 84 | |
27b30e9c | 85 | - Emulacja trybu użytkownika. W tym trybie QEMU może uruchamiać |
5a2da1d0 | 86 | procesy linuksowe skompilowane dla jednego procesora na innym |
27b30e9c JR |
87 | procesorze. Linuksowe wywołania systemowe są tłumaczone ze względu na |
88 | niezgodność kolejności bajtów w słowie i 32/64-bitowego rozmiaru | |
89 | słowa. Wine (emulacja Windows) i DOSEMU (emulacja DOS-a) to główne | |
5a2da1d0 JB |
90 | cele QEMU. |
91 | ||
27b30e9c JR |
92 | - Pełna emulacja systemu. W tym trybie QEMU emuluje cały system, |
93 | włączając w to procesor i różne urządzenia peryferyjne. Może być także | |
94 | używane do wirtualnego hostowania kilku wirtualnych pecetów na | |
8799423b | 95 | pojedynczym serwerze. |
5a2da1d0 | 96 | |
59d7e27b | 97 | %package -n kernel%{_alt_kernel}-misc-kqemu |
8bb1261c | 98 | Summary: kqemu - kernel module |
eec0535a | 99 | Summary(pl.UTF-8): kqemu - moduł jądra |
b4eae133 | 100 | Version: %{_kqemu_version} |
8bb1261c KK |
101 | Release: %{_rel}@%{_kernel_ver_str} |
102 | Group: Base/Kernel | |
103 | %{?with_dist_kernel:%requires_releq_kernel_up} | |
8f93639f | 104 | License: GPL v2 |
8bb1261c | 105 | Requires(post,postun): /sbin/depmod |
39b50bf0 | 106 | Requires: module-init-tools >= 3.2.2-2 |
8bb1261c | 107 | |
59d7e27b | 108 | %description -n kernel%{_alt_kernel}-misc-kqemu |
8bb1261c KK |
109 | kqemu - kernel module. |
110 | ||
27b30e9c JR |
111 | %description -n kernel%{_alt_kernel}-misc-kqemu -l pl.UTF-8 |
112 | kqemu - moduł jądra. | |
8bb1261c | 113 | |
59d7e27b | 114 | %package -n kernel%{_alt_kernel}-smp-misc-kqemu |
8bb1261c | 115 | Summary: kqemu - SMP kernel module |
eec0535a | 116 | Summary(pl.UTF-8): kqemu - moduł jądra SMP |
b4eae133 | 117 | Version: %{_kqemu_version} |
8bb1261c KK |
118 | Release: %{_rel}@%{_kernel_ver_str} |
119 | Group: Base/Kernel | |
483ed99a | 120 | %{?with_dist_kernel:%requires_releq_kernel_smp} |
8f93639f | 121 | License: GPL v2 |
8bb1261c | 122 | Requires(post,postun): /sbin/depmod |
39b50bf0 | 123 | Requires: module-init-tools >= 3.2.2-2 |
8bb1261c | 124 | |
59d7e27b | 125 | %description -n kernel%{_alt_kernel}-smp-misc-kqemu |
8bb1261c KK |
126 | kqemu - SMP kernel module. |
127 | ||
27b30e9c JR |
128 | %description -n kernel%{_alt_kernel}-smp-misc-kqemu -l pl.UTF-8 |
129 | kqemu - moduł jądra SMP. | |
8bb1261c | 130 | |
cd19124e | 131 | %prep |
3073459a | 132 | %if %{with kernel} |
3a6eaa3b | 133 | %if %{with dist_kernel} && %{without up} && %{without smp} |
134 | %{error:%{name}: If building kernel module You need to enable at least one of up or smp} | |
135 | exit 1 | |
136 | %endif | |
3073459a | 137 | %endif |
3a6eaa3b | 138 | |
2dad6a94 | 139 | %setup -q %{?with_kernel:-a1} |
968e3e81 JB |
140 | %patch0 -p1 |
141 | %patch1 -p1 | |
d8d8cede | 142 | %patch3 -p1 |
27439af0 | 143 | %if %{with gcc4} |
e05988b9 | 144 | %patch9 -p1 |
e05988b9 | 145 | %patch11 -p1 |
b337f190 | 146 | #%patch12 -p1 |
e05988b9 | 147 | #%patch4 -p0 |
8d073aaa | 148 | %patch5 -p1 |
27439af0 | 149 | %endif |
8d073aaa ER |
150 | %{?with_nosdlgui:%patch6 -p1} |
151 | %patch7 -p1 | |
81a493f2 | 152 | #%patch8 -p1 |
0b920c52 MŁ |
153 | |
154 | %{__sed} -i -e 's/sdl_static=yes/sdl_static=no/' configure | |
8bb1261c | 155 | %{__sed} -i 's/.*MAKE) -C kqemu$//' Makefile |
cd19124e | 156 | |
c3048014 | 157 | # cannot use optflags on x86 - they cause "no register to spill" errors |
0b920c52 MŁ |
158 | %if %{with cflags_passing} |
159 | %{__sed} -i -e 's/-Wall -O2 -g/-Wall %{rpmcflags}/' Makefile Makefile.target | |
57d8430f KK |
160 | %else |
161 | %{__sed} -i 's/-Wall -O2 -g/-Wall -O2/' Makefile Makefile.target | |
0b920c52 | 162 | %endif |
c3048014 | 163 | |
2dad6a94 | 164 | %if %{with kernel} |
39b50bf0 | 165 | echo -n > kqemu-%{_kqemu_version}/install.sh |
c33439fc ER |
166 | |
167 | cat <<'EOF' > modprobe.conf | |
168 | # enable dynamic major | |
169 | options kqemu major=0 | |
170 | # for autoloading from static dev | |
171 | #alias char-major-250 kqemu | |
172 | EOF | |
173 | ||
174 | cat <<'EOF' > udev.conf | |
175 | KERNEL=="kqemu", NAME="%k", MODE="0666" | |
176 | EOF | |
39b50bf0 | 177 | %endif |
6aef4654 | 178 | |
cd19124e | 179 | %build |
8bb1261c | 180 | %if %{with kernel} |
39b50bf0 | 181 | cd kqemu-%{_kqemu_version} |
0d2efd95 | 182 | |
c1e4b9fd ER |
183 | %{__sed} -i 's#include ../config-host.mak##' ./common/Makefile |
184 | %ifarch %{x8664} | |
185 | %{__sed} -i 's/^#ARCH=x86_64/ARCH=x86_64/' ./common/Makefile | |
186 | %{__make} -C common | |
0d2efd95 | 187 | mv -f kqemu-mod-x86_64.o{,.bin} |
c1e4b9fd ER |
188 | %else |
189 | %{__sed} -i 's/^#ARCH=i386/ARCH=i386/' ./common/Makefile | |
190 | %{__make} -C common | |
191 | mv -f kqemu-mod-i386.o{,.bin} | |
192 | %endif | |
193 | ||
35648466 | 194 | mv -f kqemu-linux.c{,.orig} |
0d2efd95 | 195 | cat > Makefile <<'EOF' |
196 | obj-m := kqemu.o | |
197 | kqemu-objs:= kqemu-linux.o kqemu-mod.o | |
198 | ||
199 | $(obj)/kqemu-mod.o: $(src)/kqemu-mod-$(ARCH).o.bin | |
df1c9a9c | 200 | cp $< $@ |
0d2efd95 | 201 | EOF |
202 | ||
59d7e27b | 203 | %build_kernel_modules -m kqemu <<'EOF' |
bd6addfd | 204 | if grep -q "CONFIG_PREEMPT_RT" o/.config; then |
59d7e27b | 205 | sed 's/SPIN_LOCK_UNLOCKED/SPIN_LOCK_UNLOCKED(kqemu_lock)/' \ |
206 | kqemu-linux.c.orig > kqemu-linux.c | |
207 | else | |
208 | cat kqemu-linux.c.orig > kqemu-linux.c | |
209 | fi | |
210 | EOF | |
8bb1261c | 211 | cd - |
4b0669f5 | 212 | %endif |
a62a2d89 | 213 | |
8bb1261c | 214 | %if %{with userspace} |
c3048014 | 215 | # --extra-cflags don't work (overridden by CFLAGS in Makefile*) |
0b920c52 | 216 | # they can be passed if the cflags_passing bcond is used |
8bd2aee2 | 217 | ./configure \ |
218 | --prefix=%{_prefix} \ | |
867764ba | 219 | --cc="%{__cc}" \ |
c33439fc ER |
220 | --host-cc="%{__cc}" \ |
221 | --make="%{__make}" \ | |
8d073aaa ER |
222 | %if %{with kqemu} |
223 | --kernel-path=%{_kernelsrcdir} \ | |
224 | %else | |
225 | --disable-kqemu \ | |
226 | %endif | |
21c5c008 | 227 | %{?with_gcc4:--disable-gcc-check} \ |
21c5c008 | 228 | --enable-alsa \ |
27439af0 | 229 | --interp-prefix=%{_libdir}/%{name} |
8bb1261c | 230 | %{__make} |
4b0669f5 | 231 | %endif |
cd19124e | 232 | |
233 | %install | |
234 | rm -rf $RPM_BUILD_ROOT | |
5a2da1d0 | 235 | |
8bb1261c | 236 | %if %{with userspace} |
cd19124e | 237 | %{__make} install \ |
238 | DESTDIR=$RPM_BUILD_ROOT | |
ac6e5743 ER |
239 | |
240 | install -d $RPM_BUILD_ROOT/sbin | |
241 | cat <<'EOF' > $RPM_BUILD_ROOT/sbin/qemu-ifup | |
242 | #!/bin/sh | |
243 | if [ -f /etc/sysconfig/qemu ]; then | |
244 | . /etc/sysconfig/qemu | |
245 | fi | |
246 | # of course this will work only for one interface. a lot possible to involve | |
247 | sudo /sbin/ifconfig $1 ${INTERFACE_ADDR:-172.20.0.1} | |
248 | EOF | |
8bb1261c | 249 | %endif |
cd19124e | 250 | |
8bb1261c | 251 | %if %{with kernel} |
59d7e27b | 252 | %install_kernel_modules -m kqemu-%{_kqemu_version}/kqemu -d misc |
c33439fc | 253 | install -d $RPM_BUILD_ROOT/etc/{modprobe.d/%{_kernel_ver}{,smp},udev/rules.d} |
c33439fc | 254 | install modprobe.conf $RPM_BUILD_ROOT/etc/modprobe.d/%{_kernel_ver}/kqemu.conf |
8bb1261c | 255 | %if %{with smp} && %{with dist_kernel} |
c33439fc | 256 | install modprobe.conf $RPM_BUILD_ROOT/etc/modprobe.d/%{_kernel_ver}smp/kqemu.conf |
8bb1261c | 257 | %endif |
c33439fc | 258 | install udev.conf $RPM_BUILD_ROOT/etc/udev/rules.d/kqemu.rules |
4b0669f5 | 259 | %endif |
a62a2d89 | 260 | |
c33439fc ER |
261 | # already packaged |
262 | rm -rf $RPM_BUILD_ROOT%{_docdir}/qemu/qemu-{doc,tech}.html | |
263 | ||
cd19124e | 264 | %clean |
265 | rm -rf $RPM_BUILD_ROOT | |
266 | ||
2dad6a94 | 267 | %if %{with kernel} |
8bb1261c | 268 | %post |
f8982f2f | 269 | %banner %{name} -e <<EOF |
8bb1261c | 270 | To enable qemu accelerator (kqemu), the kqemu kernel module must be loaded: |
4b0669f5 | 271 | modprobe kqemu |
272 | EOF | |
273 | %endif | |
274 | ||
59d7e27b | 275 | %post -n kernel%{_alt_kernel}-misc-kqemu |
8bb1261c KK |
276 | %depmod %{_kernel_ver} |
277 | ||
59d7e27b | 278 | %postun -n kernel%{_alt_kernel}-misc-kqemu |
8bb1261c KK |
279 | %depmod %{_kernel_ver} |
280 | ||
59d7e27b | 281 | %post -n kernel%{_alt_kernel}-smp-misc-kqemu |
8bb1261c KK |
282 | %depmod %{_kernel_ver}smp |
283 | ||
59d7e27b | 284 | %postun -n kernel%{_alt_kernel}-smp-misc-kqemu |
8bb1261c KK |
285 | %depmod %{_kernel_ver}smp |
286 | ||
8bb1261c | 287 | %if %{with userspace} |
cd19124e | 288 | %files |
289 | %defattr(644,root,root,755) | |
867764ba | 290 | %doc README qemu-doc.html qemu-tech.html |
ac6e5743 | 291 | %attr(755,root,root) /sbin/qemu-ifup |
003e2129 | 292 | %attr(755,root,root) %{_bindir}/* |
293 | %{_datadir}/qemu | |
cd19124e | 294 | %{_mandir}/man1/qemu.1* |
867764ba | 295 | %{_mandir}/man1/qemu-img.1* |
8bb1261c KK |
296 | %endif |
297 | ||
298 | %if %{with kernel} | |
59d7e27b | 299 | %files -n kernel%{_alt_kernel}-misc-kqemu |
8bb1261c | 300 | %defattr(644,root,root,755) |
39b50bf0 | 301 | %doc kqemu-%{_kqemu_version}/LICENSE |
c33439fc | 302 | %config(noreplace) %verify(not md5 mtime size) /etc/udev/rules.d/kqemu.rules |
bfcb25b9 | 303 | %config(noreplace) %verify(not md5 mtime size) /etc/modprobe.d/%{_kernel_ver}/kqemu.conf |
b0b3ca8d | 304 | /lib/modules/%{_kernel_ver}/misc/kqemu.ko* |
8bb1261c KK |
305 | |
306 | %if %{with smp} && %{with dist_kernel} | |
59d7e27b | 307 | %files -n kernel%{_alt_kernel}-smp-misc-kqemu |
8bb1261c | 308 | %defattr(644,root,root,755) |
39b50bf0 | 309 | %doc kqemu-%{_kqemu_version}/LICENSE |
c33439fc | 310 | %config(noreplace) %verify(not md5 mtime size) /etc/udev/rules.d/kqemu.rules |
bfcb25b9 | 311 | %config(noreplace) %verify(not md5 mtime size) /etc/modprobe.d/%{_kernel_ver}smp/kqemu.conf |
b0b3ca8d | 312 | /lib/modules/%{_kernel_ver}smp/misc/kqemu.ko* |
8bb1261c KK |
313 | %endif |
314 | %endif |