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