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