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