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