]> git.pld-linux.org Git - packages/qemu.git/blob - qemu.spec
- more BRs checked by configure to build documentation
[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.0pre7
18 %define         _rel    0.4
19 Summary:        QEMU CPU Emulator
20 Summary(pl):    QEMU - emulator procesora
21 Name:           qemu
22 Version:        0.8.1
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:  67d924324a5ab79d017bd97a1e767285
29 Source1:        http://fabrice.bellard.free.fr/qemu/k%{name}-%{_kqemu_version}.tar.gz
30 # NoSource1-md5:        3b77edbada790f924456aa4675edd0be
31 NoSource:       1
32 Patch0:         %{name}-nostatic.patch
33 Patch1:         %{name}-cc.patch
34 Patch2:         %{name}-longjmp.patch
35 Patch3:         %{name}-dot.patch
36 Patch4:         %{name}-gcc4_x86.patch
37 Patch5:         %{name}-gcc4_ppc.patch
38 Patch6:         %{name}-nosdlgui.patch
39 Patch7:         %{name}-ifup.patch
40 Patch8: %{name}-gcc33.patch
41 Patch9:         %{name}-parallel.patch
42 URL:            http://fabrice.bellard.free.fr/qemu/
43 BuildRequires:  SDL-devel >= 1.2.1
44 BuildRequires:  alsa-lib-devel
45 %{!?with_gcc4:BuildRequires:    gcc < 5:4.0}
46 %if %{with kqemu} && %{with dist_kernel}
47 BuildRequires:  kernel-module-build >= 3:2.6.7
48 %endif
49 BuildRequires:  perl-tools-pod
50 BuildRequires:  rpmbuild(macros) >= 1.217
51 BuildRequires:  tetex
52 BuildRequires:  sed >= 4.0
53 Requires:       SDL >= 1.2.1
54 # sparc is currently unsupported (missing cpu_get_real_ticks() impl in vl.c)
55 ExclusiveArch:  %{ix86} %{x8664} %{!?with_kqemu:ppc}
56 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
57
58 # some SPARC boot image in ELF format
59 %define         _noautostrip    .*%{_datadir}/qemu/proll.elf
60
61 %description
62 QEMU is a FAST! processor emulator. By using dynamic translation it
63 achieves a reasonnable speed while being easy to port on new host
64 CPUs. QEMU has two operating modes:
65
66 - User mode emulation. In this mode, QEMU can launch Linux processes
67   compiled for one CPU on another CPU. Linux system calls are converted
68   because of endianness and 32/64 bit mismatches. Wine (Windows
69   emulation) and DOSEMU (DOS emulation) are the main targets for QEMU.
70
71 - Full system emulation. In this mode, QEMU emulates a full system,
72   including a processor and various peripherials. It can also be used to
73   provide virtual hosting of several virtual PC on a single server.
74
75 %description -l pl
76 QEMU to szybki(!) emulator procesora. Poprzez u¿ycie dynamicznego
77 t³umaczenia osi±ga rozs±dn± szybko¶æ i jest ³atwy do przeportowania,
78 aby dzia³a³ na kolejnych procesorach. QEMU ma dwa tryby pracy:
79
80 - Emulacja trybu u¿ytkownika. W tym trybie QEMU mo¿e uruchamiaæ
81   procesy linuksowe skompilowane dla jednego procesora na innym
82   procesorze. Linuksowe wywo³ania systemowe s± t³umaczone ze wzglêdu na
83   niezgodno¶æ kolejno¶ci bajtów w s³owie i 32/64-bitowego rozmiaru
84   s³owa. Wine (emulacja Windows) i DOSEMU (emulacja DOS-a) to g³ówne
85   cele QEMU.
86
87 - Pe³na emulacja systemu. W tym trybie QEMU emuluje ca³y system,
88   w³±czaj±c w to procesor i ró¿ne urz±dzenia peryferyjne. Mo¿e byæ tak¿e
89   u¿ywane do wirtualnego hostowania kilku wirtualnych pecetów na
90   pojedynczym serwerze.
91
92 %package -n kernel-misc-kqemu
93 Summary:        kqemu - kernel module
94 Summary(pl):    kqemu - modu³ j±dra
95 Version:        %{_kqemu_version}
96 Release:        %{_rel}@%{_kernel_ver_str}
97 Group:          Base/Kernel
98 %{?with_dist_kernel:%requires_releq_kernel_up}
99 License:        Free to use, non-distributable
100 Requires(post,postun):  /sbin/depmod
101 Requires:       module-init-tools >= 3.2.2-2
102
103 %description -n kernel-misc-kqemu
104 kqemu - kernel module.
105
106 %description -n kernel-misc-kqemu -l pl
107 kqemu - modu³ j±dra.
108
109 %package -n kernel-smp-misc-kqemu
110 Summary:        kqemu - SMP kernel module
111 Summary(pl):    kqemu - modu³ j±dra SMP
112 Version:        %{_kqemu_version}
113 Release:        %{_rel}@%{_kernel_ver_str}
114 Group:          Base/Kernel
115 %{?with_dist_kernel:%requires_releq_kernel_up}
116 License:        Free to use, non-distributable
117 Requires(post,postun):  /sbin/depmod
118 Requires:       module-init-tools >= 3.2.2-2
119
120 %description -n kernel-smp-misc-kqemu
121 kqemu - SMP kernel module.
122
123 %description -n kernel-smp-misc-kqemu -l pl
124 kqemu - modu³ j±dra SMP.
125
126 %prep
127 %setup -q %{?with_kernel:-a1}
128 %patch0 -p1
129 %patch1 -p1
130 %patch2 -p1
131 %patch3 -p1
132 %if %{with gcc4}
133 %patch4 -p0
134 %patch5 -p1
135 %endif
136 %{?with_nosdlgui:%patch6 -p1}
137 %patch7 -p1
138 %patch8 -p1
139 # probably not needed
140 #%%patch9 -p1
141
142 %{__sed} -i -e 's/sdl_static=yes/sdl_static=no/' configure
143 %{__sed} -i 's/.*MAKE) -C kqemu$//' Makefile
144
145 # cannot use optflags on x86 - they cause "no register to spill" errors
146 %if %{with cflags_passing}
147 %{__sed} -i -e 's/-Wall -O2 -g/-Wall %{rpmcflags}/' Makefile Makefile.target
148 %else
149 %{__sed} -i 's/-Wall -O2 -g/-Wall -O2/' Makefile Makefile.target
150 %endif
151
152 %if %{with kernel}
153 echo -n > kqemu-%{_kqemu_version}/install.sh
154
155 cat <<'EOF' > modprobe.conf
156 # enable dynamic major
157 options kqemu major=0
158 # for autoloading from static dev
159 #alias char-major-250 kqemu
160 EOF
161
162 cat <<'EOF' > udev.conf
163 KERNEL=="kqemu", NAME="%k", MODE="0666"
164 EOF
165 %endif
166
167 %build
168 %if %{with kernel}
169 cd kqemu-%{_kqemu_version}
170 mv -f kqemu-linux.c{,.orig}
171 for cfg in %{?with_dist_kernel:%{?with_smp:smp} up}%{!?with_dist_kernel:nondist}; do
172         if [ ! -r "%{_kernelsrcdir}/config-$cfg" ]; then
173                 exit 1
174         fi
175         install -d o/include/linux
176         ln -sf %{_kernelsrcdir}/config-$cfg o/.config
177         ln -sf %{_kernelsrcdir}/Module.symvers-$cfg o/Module.symvers
178         ln -sf %{_kernelsrcdir}/include/linux/autoconf-$cfg.h o/include/linux/autoconf.h
179 %if %{with dist_kernel}
180         %{__make} -C %{_kernelsrcdir} O=$PWD/o prepare scripts
181 %else
182         install -d o/include/config
183         touch o/include/config/MARKER
184         ln -sf %{_kernelsrcdir}/scripts o/scripts
185 %endif
186         if grep -q "^CONFIG_PREEMPT_RT=y$" 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
193         %{__make} -C %{_kernelsrcdir} modules \
194                 CC="%{__cc}" CPP="%{__cpp}" \
195                 M=$PWD O=$PWD/o \
196                 %{?with_verbose:V=1}
197         mv kqemu.ko kqemu-mod-$cfg.ko
198 done
199 cd -
200 %endif
201
202 %if %{with userspace}
203 # --extra-cflags don't work (overridden by CFLAGS in Makefile*)
204 # they can be passed if the cflags_passing bcond is used
205 ./configure \
206         --prefix=%{_prefix} \
207         --cc="%{__cc}" \
208         --host-cc="%{__cc}" \
209         --make="%{__make}" \
210 %if %{with kqemu}
211         --kernel-path=%{_kernelsrcdir} \
212 %else
213         --disable-kqemu \
214 %endif
215         %{?with_gcc4:--disable-gcc-check} \
216         --enable-alsa \
217         --interp-prefix=%{_libdir}/%{name}
218 %{__make}
219 %endif
220
221 %install
222 rm -rf $RPM_BUILD_ROOT
223
224 %if %{with userspace}
225 %{__make} install \
226         DESTDIR=$RPM_BUILD_ROOT
227
228 install -d $RPM_BUILD_ROOT/sbin
229 cat <<'EOF' > $RPM_BUILD_ROOT/sbin/qemu-ifup
230 #!/bin/sh
231 if [ -f /etc/sysconfig/qemu ]; then
232         . /etc/sysconfig/qemu
233 fi
234 # of course this will work only for one interface. a lot possible to involve
235 sudo /sbin/ifconfig $1 ${INTERFACE_ADDR:-172.20.0.1}
236 EOF
237 %endif
238
239 %if %{with kernel}
240 install -d $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}{,smp}/misc
241 install -d $RPM_BUILD_ROOT/etc/{modprobe.d/%{_kernel_ver}{,smp},udev/rules.d}
242 install kqemu-%{_kqemu_version}/kqemu-mod-up.ko $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/misc/kqemu.ko
243 install modprobe.conf $RPM_BUILD_ROOT/etc/modprobe.d/%{_kernel_ver}/kqemu.conf
244 %if %{with smp} && %{with dist_kernel}
245 install kqemu-%{_kqemu_version}/kqemu-mod-smp.ko $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}smp/misc/kqemu.ko
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-misc-kqemu
266 %depmod %{_kernel_ver}
267
268 %postun -n kernel-misc-kqemu
269 %depmod %{_kernel_ver}
270
271 %post   -n kernel-smp-misc-kqemu
272 %depmod %{_kernel_ver}smp
273
274 %postun -n 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-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-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.047751 seconds and 3 git commands to generate.