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