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