]> git.pld-linux.org Git - packages/qemu.git/blob - qemu.spec
- release 15
[packages/qemu.git] / qemu.spec
1 #
2 # TODO:
3 # - wait till the gcc bug http://gcc.gnu.org/PR16185 is fixed.
4 # - update or drop gcc4 bcond patches
5 #
6 # Conditional build:
7 %bcond_without  kqemu                   # disable KQEMU ACCELERATOR support in QEMU
8 %bcond_with     cflags_passing          # with passing rpmcflags to Makefiles
9 %bcond_with     dosguest                # add special patch when use with DOS as guest os
10 %bcond_with     nosdlgui                # do not use SDL gui (use X11 instead)
11 %bcond_without  dist_kernel             # without distribution kernel
12 %bcond_without  kernel                  # build kqemu KERNEL MODULES
13 %bcond_without  userspace               # don't build userspace utilities
14
15 # no kernel kqemu module for ppc
16 %ifarch ppc
17 %undefine      with_kqemu
18 %undefine      with_kernel
19 %endif
20
21 %if %{without kernel}
22 %undefine       with_dist_kernel
23 %endif
24 %if "%{_alt_kernel}" != "%{nil}"
25 %undefine       with_userspace
26 %endif
27 %if %{without userspace}
28 # nothing to be placed to debuginfo package
29 %define         _enable_debug_packages  0
30 %endif
31
32 %define         __ucc   gcc-3.4
33
34 %define         rel     15
35
36 %define         kqemu_version   1.3.0pre11
37 %define         qemu_version    0.9.1
38 %define         pname   qemu
39 Summary:        QEMU CPU Emulator
40 Summary(pl.UTF-8):      QEMU - emulator procesora
41 Name:           %{pname}%{_alt_kernel}
42 Version:        %{qemu_version}
43 Release:        %{rel}%{?with_kqemu:k}
44 License:        GPL
45 Group:          Applications/Emulators
46 # Source0Download: http://fabrice.bellard.free.fr/qemu/download.html
47 Source0:        http://bellard.org/qemu/%{pname}-%{version}.tar.gz
48 # Source0-md5:  6591df8e9270eb358c881de4ebea1262
49 Source1:        http://bellard.org/qemu/k%{pname}-%{kqemu_version}.tar.gz
50 # Source1-md5:  970521874ef8b1ba4598925ace5936c3
51 Patch0:         %{pname}-nostatic.patch
52 Patch1:         %{pname}-cc.patch
53 Patch3:         %{pname}-dot.patch
54 Patch6:         %{pname}-nosdlgui.patch
55 # Proof of concept, for reference, do not remove
56 Patch8:         %{pname}-kde_virtual_workspaces_hack.patch
57 #Patch12:       %{pname}-0.7.2-dyngen-check-stack-clobbers.patch
58 Patch13:        %{pname}-dosguest.patch
59 Patch14:        %{pname}-ppc_old_binutils.patch
60 Patch15:        %{pname}-isa-bios-ram.patch
61 # below one fixes problems with passing ram size to bios/bootloader
62 # which affects coreboot/linuxbios
63 Patch16:        %{pname}-piix-ram-size.patch
64 Patch17:        %{pname}-CVE-2008-0928.patch
65 Patch18:        %{pname}-CVE-2008-2004.patch
66 Patch19:        %{pname}-gcc-workaround.patch
67 URL:            http://bellard.org/qemu/
68 %if %{with kernel} && %{with dist_kernel}
69 BuildRequires:  kernel%{_alt_kernel}-module-build >= 3:2.6.7
70 BuildRequires:  rpmbuild(macros) >= 1.379
71 %endif
72 %if %{with userspace}
73 BuildRequires:  SDL-devel >= 1.2.1
74 BuildRequires:  alsa-lib-devel
75 BuildRequires:  compat-gcc-34
76 BuildRequires:  perl-tools-pod
77 BuildRequires:  sed >= 4.0
78 BuildRequires:  tetex
79 BuildRequires:  which
80 %endif
81 Requires:       SDL >= 1.2.1
82 # sparc is currently unsupported (missing cpu_get_real_ticks() impl in vl.c)
83 ExclusiveArch:  %{ix86} %{x8664} %{?with_userspace:ppc}
84 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
85
86 # some SPARC boot image in ELF format
87 %define         _noautostrip    .*%{_datadir}/qemu/openbios-sparc32
88
89 %description
90 QEMU is a FAST! processor emulator. By using dynamic translation it
91 achieves a reasonnable speed while being easy to port on new host
92 CPUs. 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,
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.
102
103 %description -l pl.UTF-8
104 QEMU to szybki(!) emulator procesora. Poprzez użycie dynamicznego
105 tłumaczenia osiąga rozsądną szybkość i jest łatwy do przeportowania,
106 aby działał na kolejnych procesorach. QEMU ma dwa tryby pracy:
107
108 - Emulacja trybu użytkownika. W tym trybie QEMU może uruchamiać
109   procesy linuksowe skompilowane dla jednego procesora na innym
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
113   cele QEMU.
114
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
118   pojedynczym serwerze.
119
120 %package -n kernel%{_alt_kernel}-misc-kqemu
121 Summary:        kqemu - kernel module
122 Summary(pl.UTF-8):      kqemu - moduł jądra
123 Version:        %{kqemu_version}
124 Release:        %{rel}@%{_kernel_ver_str}
125 Group:          Base/Kernel
126 %{?with_dist_kernel:%requires_releq_kernel}
127 License:        GPL v2
128 Obsoletes:      kernel%{_alt_kernel}-smp-misc-kqemu
129 Requires(post,postun):  /sbin/depmod
130 Requires:       module-init-tools >= 3.2.2-2
131
132 %description -n kernel%{_alt_kernel}-misc-kqemu
133 kqemu - kernel module.
134
135 %description -n kernel%{_alt_kernel}-misc-kqemu -l pl.UTF-8
136 kqemu - moduł jądra.
137
138 %prep
139 %setup -q -n %{pname}-%{qemu_version} %{?with_kernel:-a1}
140 %patch0 -p1
141 %patch1 -p1
142 %patch3 -p1
143 %{?with_nosdlgui:%patch6 -p1}
144 #%patch8 -p1
145
146 %{__sed} -i -e 's/sdl_static=yes/sdl_static=no/' configure
147 %{__sed} -i 's/.*MAKE) -C kqemu$//' Makefile
148
149 # cannot use optflags on x86 - they cause "no register to spill" errors
150 %if %{with cflags_passing}
151 %{__sed} -i -e 's/-Wall -O2 -g/-Wall %{rpmcflags}/' Makefile Makefile.target
152 %else
153 %{__sed} -i 's/-Wall -O2 -g/-Wall -O2/' Makefile Makefile.target
154 %endif
155
156 %if %{with kernel}
157 echo -n > kqemu-%{kqemu_version}/install.sh
158
159 cat <<'EOF' > modprobe.conf
160 # enable dynamic major
161 options kqemu major=0
162 # for autoloading from static dev
163 #alias char-major-250 kqemu
164 EOF
165
166 cat <<'EOF' > udev.conf
167 KERNEL=="kqemu", NAME="%k", MODE="0666"
168 EOF
169
170 %if %{with dosguest}
171 %patch13 -p1
172 %endif
173 %patch14 -p1
174 %patch15 -p1
175 %patch16 -p1
176 %patch17 -p2
177 %patch18 -p0
178 %patch19 -p0
179
180 cd kqemu-%{kqemu_version}
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
184 %{__make} -C common -j1
185 mv -f kqemu-mod-x86_64.o{,.bin}
186 %else
187 %{__sed} -i 's/^#ARCH=i386/ARCH=i386/' ./common/Makefile
188 %{__make} -C common -j1
189 mv -f kqemu-mod-i386.o{,.bin}
190 %endif
191
192 mv -f kqemu-linux.c{,.orig}
193 cat > Makefile <<'EOF'
194 obj-m := kqemu.o
195 kqemu-objs:= kqemu-linux.o kqemu-mod.o
196
197 $(obj)/kqemu-mod.o: $(src)/kqemu-mod-$(ARCH).o.bin
198         cp $< $@
199 EOF
200 cd -
201 %endif
202
203 %build
204 %if %{with kernel}
205 cd kqemu-%{kqemu_version}
206 %build_kernel_modules -m kqemu <<'EOF'
207 if grep -q "CONFIG_PREEMPT_RT" o/.config; then
208         sed 's/SPIN_LOCK_UNLOCKED/SPIN_LOCK_UNLOCKED(kqemu_lock)/' \
209                 kqemu-linux.c.orig > kqemu-linux.c
210 else
211         cat kqemu-linux.c.orig > kqemu-linux.c
212 fi
213 EOF
214 cd -
215 %endif
216
217 %if %{with userspace}
218 # --extra-cflags don't work (overridden by CFLAGS in Makefile*)
219 # they can be passed if the cflags_passing bcond is used
220 ./configure \
221         --prefix=%{_prefix} \
222         --cc="%{__ucc}" \
223         --host-cc="%{__ucc}" \
224         --make="%{__make}" \
225 %if %{without kqemu}
226         --disable-kqemu \
227 %endif
228         --enable-alsa \
229         --interp-prefix=%{_libdir}/%{pname}
230 %{__make}
231 %endif
232
233 %install
234 rm -rf $RPM_BUILD_ROOT
235
236 %if %{with userspace}
237 %{__make} install \
238         DESTDIR=$RPM_BUILD_ROOT
239
240 install -d $RPM_BUILD_ROOT%{_sysconfdir}
241 cat <<'EOF' > $RPM_BUILD_ROOT%{_sysconfdir}/qemu-ifup
242 #!/bin/sh
243
244 EOF
245 %endif
246
247 %if %{with kernel}
248 %install_kernel_modules -m kqemu-%{kqemu_version}/kqemu -d misc
249 install -d $RPM_BUILD_ROOT/etc/{modprobe.d/%{_kernel_ver}{,smp},udev/rules.d}
250 install modprobe.conf $RPM_BUILD_ROOT/etc/modprobe.d/%{_kernel_ver}/kqemu.conf
251 install udev.conf $RPM_BUILD_ROOT/etc/udev/rules.d/kqemu.rules
252 %endif
253
254 # already packaged
255 rm -rf $RPM_BUILD_ROOT%{_docdir}/qemu/qemu-{doc,tech}.html
256
257 %clean
258 rm -rf $RPM_BUILD_ROOT
259
260 %if %{with kernel}
261 %post
262 %banner %{pname} -e <<EOF
263 To enable qemu accelerator (kqemu), the kqemu kernel module must be loaded:
264 modprobe kqemu
265 EOF
266 %endif
267
268 %post   -n kernel%{_alt_kernel}-misc-kqemu
269 %depmod %{_kernel_ver}
270
271 %postun -n kernel%{_alt_kernel}-misc-kqemu
272 %depmod %{_kernel_ver}
273
274 %if %{with userspace}
275 %files
276 %defattr(644,root,root,755)
277 %doc README qemu-doc.html qemu-tech.html
278 %attr(755,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/qemu-ifup
279 %attr(755,root,root) %{_bindir}/*
280 %{_datadir}/qemu
281 %{_mandir}/man1/qemu.1*
282 %{_mandir}/man1/qemu-img.1*
283 %endif
284
285 %if %{with kernel}
286 %files -n kernel%{_alt_kernel}-misc-kqemu
287 %defattr(644,root,root,755)
288 %doc kqemu-%{kqemu_version}/LICENSE
289 %config(noreplace) %verify(not md5 mtime size) /etc/udev/rules.d/kqemu.rules
290 %config(noreplace) %verify(not md5 mtime size) /etc/modprobe.d/%{_kernel_ver}/kqemu.conf
291 /lib/modules/%{_kernel_ver}/misc/kqemu.ko*
292 %endif
This page took 0.098362 seconds and 4 git commands to generate.