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