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