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