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