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