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