]>
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 |
04d100ab | 14 | %bcond_without userspace # don't build userspace |
700ff264 | 15 | %bcond_with grsec_kernel # build for kernel-grsecurity |
007877cb ER |
16 | |
17 | %if %{without kernel} | |
18 | %undefine with_dist_kernel | |
19 | %endif | |
20 | %if %{with dist_kernel} && %{with grsec_kernel} | |
700ff264 ER |
21 | %define alt_kernel grsecurity |
22 | %endif | |
007877cb ER |
23 | |
24 | # no kernel kqemu module for ppc | |
25 | %ifarch ppc | |
26 | %undefine with_kqemu | |
27 | %undefine with_kernel | |
28 | %endif | |
29 | ||
80bac37e ER |
30 | %if "%{_alt_kernel}" != "%{nil}" |
31 | %undefine with_userspace | |
32 | %endif | |
3a6eaa3b | 33 | |
80bac37e | 34 | %define kqemu_version 1.3.0pre11 |
007877cb | 35 | %define qemu_version 0.9.1 |
80bac37e | 36 | %define pname qemu |
007877cb | 37 | |
ebc19970 | 38 | %define rel 6 |
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 | |
867764ba | 46 | #Source0Download: http://fabrice.bellard.free.fr/qemu/download.html |
80bac37e | 47 | Source0: http://fabrice.bellard.free.fr/qemu/%{pname}-%{version}.tar.gz |
3f5b9075 | 48 | # Source0-md5: 6591df8e9270eb358c881de4ebea1262 |
80bac37e | 49 | Source1: http://fabrice.bellard.free.fr/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 | |
54 | Patch4: %{pname}-gcc4_x86.patch | |
55 | Patch5: %{pname}-gcc4_ppc.patch | |
56 | Patch6: %{pname}-nosdlgui.patch | |
81a493f2 | 57 | # Proof of concept, for reference, do not remove |
80bac37e | 58 | Patch8: %{pname}-kde_virtual_workspaces_hack.patch |
e05988b9 | 59 | # http://gwenole.beauchesne.info/en/projects/qemu |
80bac37e ER |
60 | Patch9: %{pname}-0.8.0-gcc4-hacks.patch |
61 | Patch11: %{pname}-0.7.2-gcc4-opts.patch | |
62 | #Patch12: %{pname}-0.7.2-dyngen-check-stack-clobbers.patch | |
63 | Patch13: %{pname}-dosguest.patch | |
c9c22e78 ER |
64 | Patch14: %{pname}-ppc_old_binutils.patch |
65 | Patch15: %{pname}-isa-bios-ram.patch | |
66 | # below one fixes problems with passing ram size to bios/bootloader | |
67 | # which affects coreboot/linuxbios | |
68 | Patch16: %{pname}-piix-ram-size.patch | |
cd19124e | 69 | URL: http://fabrice.bellard.free.fr/qemu/ |
d1ae30a6 | 70 | %if %{with kernel} && %{with dist_kernel} |
71 | BuildRequires: kernel%{_alt_kernel}-module-build >= 3:2.6.7 | |
04d100ab | 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 |
21c5c008 | 77 | %{!?with_gcc4:BuildRequires: gcc < 5:4.0} |
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 | ||
867764ba | 88 | # some SPARC boot image in ELF format |
ca55b10f | 89 | %define _noautostrip .*%{_datadir}/qemu/openbios-sparc32 |
867764ba | 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 |
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 | 152 | %{?with_nosdlgui:%patch6 -p1} |
81a493f2 | 153 | #%patch8 -p1 |
0b920c52 MŁ |
154 | |
155 | %{__sed} -i -e 's/sdl_static=yes/sdl_static=no/' configure | |
8bb1261c | 156 | %{__sed} -i 's/.*MAKE) -C kqemu$//' Makefile |
cd19124e | 157 | |
c3048014 | 158 | # cannot use optflags on x86 - they cause "no register to spill" errors |
0b920c52 MŁ |
159 | %if %{with cflags_passing} |
160 | %{__sed} -i -e 's/-Wall -O2 -g/-Wall %{rpmcflags}/' Makefile Makefile.target | |
57d8430f KK |
161 | %else |
162 | %{__sed} -i 's/-Wall -O2 -g/-Wall -O2/' Makefile Makefile.target | |
0b920c52 | 163 | %endif |
c3048014 | 164 | |
2dad6a94 | 165 | %if %{with kernel} |
80bac37e | 166 | echo -n > kqemu-%{kqemu_version}/install.sh |
c33439fc ER |
167 | |
168 | cat <<'EOF' > modprobe.conf | |
169 | # enable dynamic major | |
170 | options kqemu major=0 | |
171 | # for autoloading from static dev | |
172 | #alias char-major-250 kqemu | |
173 | EOF | |
174 | ||
175 | cat <<'EOF' > udev.conf | |
176 | KERNEL=="kqemu", NAME="%k", MODE="0666" | |
177 | EOF | |
0d2efd95 | 178 | |
c9c22e78 ER |
179 | %if %{with dosguest} |
180 | %patch13 -p1 | |
181 | %endif | |
182 | %patch14 -p1 | |
183 | %patch15 -p1 | |
184 | %patch16 -p1 | |
185 | ||
80bac37e | 186 | cd kqemu-%{kqemu_version} |
c1e4b9fd ER |
187 | %{__sed} -i 's#include ../config-host.mak##' ./common/Makefile |
188 | %ifarch %{x8664} | |
189 | %{__sed} -i 's/^#ARCH=x86_64/ARCH=x86_64/' ./common/Makefile | |
c9c22e78 | 190 | %{__make} -C common -j1 |
0d2efd95 | 191 | mv -f kqemu-mod-x86_64.o{,.bin} |
c1e4b9fd ER |
192 | %else |
193 | %{__sed} -i 's/^#ARCH=i386/ARCH=i386/' ./common/Makefile | |
c9c22e78 | 194 | %{__make} -C common -j1 |
c1e4b9fd ER |
195 | mv -f kqemu-mod-i386.o{,.bin} |
196 | %endif | |
197 | ||
35648466 | 198 | mv -f kqemu-linux.c{,.orig} |
0d2efd95 | 199 | cat > Makefile <<'EOF' |
200 | obj-m := kqemu.o | |
201 | kqemu-objs:= kqemu-linux.o kqemu-mod.o | |
202 | ||
203 | $(obj)/kqemu-mod.o: $(src)/kqemu-mod-$(ARCH).o.bin | |
df1c9a9c | 204 | cp $< $@ |
0d2efd95 | 205 | EOF |
80bac37e ER |
206 | cd - |
207 | %endif | |
208 | ||
80bac37e ER |
209 | %build |
210 | %if %{with kernel} | |
211 | cd kqemu-%{kqemu_version} | |
59d7e27b | 212 | %build_kernel_modules -m kqemu <<'EOF' |
bd6addfd | 213 | if grep -q "CONFIG_PREEMPT_RT" o/.config; then |
59d7e27b | 214 | sed 's/SPIN_LOCK_UNLOCKED/SPIN_LOCK_UNLOCKED(kqemu_lock)/' \ |
215 | kqemu-linux.c.orig > kqemu-linux.c | |
216 | else | |
217 | cat kqemu-linux.c.orig > kqemu-linux.c | |
218 | fi | |
219 | EOF | |
8bb1261c | 220 | cd - |
4b0669f5 | 221 | %endif |
a62a2d89 | 222 | |
8bb1261c | 223 | %if %{with userspace} |
c3048014 | 224 | # --extra-cflags don't work (overridden by CFLAGS in Makefile*) |
0b920c52 | 225 | # they can be passed if the cflags_passing bcond is used |
8bd2aee2 | 226 | ./configure \ |
227 | --prefix=%{_prefix} \ | |
867764ba | 228 | --cc="%{__cc}" \ |
c33439fc ER |
229 | --host-cc="%{__cc}" \ |
230 | --make="%{__make}" \ | |
8d073aaa ER |
231 | %if %{with kqemu} |
232 | --kernel-path=%{_kernelsrcdir} \ | |
233 | %else | |
234 | --disable-kqemu \ | |
235 | %endif | |
21c5c008 | 236 | %{?with_gcc4:--disable-gcc-check} \ |
21c5c008 | 237 | --enable-alsa \ |
80bac37e | 238 | --interp-prefix=%{_libdir}/%{pname} |
8bb1261c | 239 | %{__make} |
4b0669f5 | 240 | %endif |
cd19124e | 241 | |
242 | %install | |
243 | rm -rf $RPM_BUILD_ROOT | |
5a2da1d0 | 244 | |
8bb1261c | 245 | %if %{with userspace} |
cd19124e | 246 | %{__make} install \ |
247 | DESTDIR=$RPM_BUILD_ROOT | |
ac6e5743 | 248 | |
a91fea76 | 249 | install -d $RPM_BUILD_ROOT%{_sysconfdir} |
250 | cat <<'EOF' > $RPM_BUILD_ROOT%{_sysconfdir}/qemu-ifup | |
ac6e5743 | 251 | #!/bin/sh |
a91fea76 | 252 | |
ac6e5743 | 253 | EOF |
8bb1261c | 254 | %endif |
cd19124e | 255 | |
8bb1261c | 256 | %if %{with kernel} |
80bac37e | 257 | %install_kernel_modules -m kqemu-%{kqemu_version}/kqemu -d misc |
c33439fc | 258 | install -d $RPM_BUILD_ROOT/etc/{modprobe.d/%{_kernel_ver}{,smp},udev/rules.d} |
c33439fc | 259 | install modprobe.conf $RPM_BUILD_ROOT/etc/modprobe.d/%{_kernel_ver}/kqemu.conf |
c33439fc | 260 | install udev.conf $RPM_BUILD_ROOT/etc/udev/rules.d/kqemu.rules |
4b0669f5 | 261 | %endif |
a62a2d89 | 262 | |
c33439fc ER |
263 | # already packaged |
264 | rm -rf $RPM_BUILD_ROOT%{_docdir}/qemu/qemu-{doc,tech}.html | |
265 | ||
cd19124e | 266 | %clean |
267 | rm -rf $RPM_BUILD_ROOT | |
268 | ||
2dad6a94 | 269 | %if %{with kernel} |
8bb1261c | 270 | %post |
80bac37e | 271 | %banner %{pname} -e <<EOF |
8bb1261c | 272 | To enable qemu accelerator (kqemu), the kqemu kernel module must be loaded: |
4b0669f5 | 273 | modprobe kqemu |
274 | EOF | |
275 | %endif | |
276 | ||
59d7e27b | 277 | %post -n kernel%{_alt_kernel}-misc-kqemu |
8bb1261c KK |
278 | %depmod %{_kernel_ver} |
279 | ||
59d7e27b | 280 | %postun -n kernel%{_alt_kernel}-misc-kqemu |
8bb1261c KK |
281 | %depmod %{_kernel_ver} |
282 | ||
8bb1261c | 283 | %if %{with userspace} |
cd19124e | 284 | %files |
285 | %defattr(644,root,root,755) | |
867764ba | 286 | %doc README qemu-doc.html qemu-tech.html |
a91fea76 | 287 | %attr(755,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/qemu-ifup |
003e2129 | 288 | %attr(755,root,root) %{_bindir}/* |
289 | %{_datadir}/qemu | |
cd19124e | 290 | %{_mandir}/man1/qemu.1* |
867764ba | 291 | %{_mandir}/man1/qemu-img.1* |
8bb1261c KK |
292 | %endif |
293 | ||
294 | %if %{with kernel} | |
59d7e27b | 295 | %files -n kernel%{_alt_kernel}-misc-kqemu |
8bb1261c | 296 | %defattr(644,root,root,755) |
80bac37e | 297 | %doc kqemu-%{kqemu_version}/LICENSE |
c33439fc | 298 | %config(noreplace) %verify(not md5 mtime size) /etc/udev/rules.d/kqemu.rules |
bfcb25b9 | 299 | %config(noreplace) %verify(not md5 mtime size) /etc/modprobe.d/%{_kernel_ver}/kqemu.conf |
b0b3ca8d | 300 | /lib/modules/%{_kernel_ver}/misc/kqemu.ko* |
8bb1261c | 301 | %endif |