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