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