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