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