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