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