]> git.pld-linux.org Git - packages/qemu.git/blob - qemu.spec
- add kernel epoch, adapterized
[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 %define         _rel    1.1
18 Summary:        QEMU CPU Emulator
19 Summary(pl):    QEMU - emulator procesora
20 Name:           qemu
21 Version:        0.8.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:  eb175b26583280706fe7e4d8910d320d
28 %if %{with kqemu}
29 Source1:        http://fabrice.bellard.free.fr/qemu/k%{name}-%{_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 >= 3: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. It can also be used to
78   provide virtual hosting of several virtual PC on a single server.
79
80 %description -l pl
81 QEMU to szybki(!) emulator procesora. Poprzez u¿ycie dynamicznego
82 t³umaczenia osi±ga rozs±dn± szybko¶æ i jest ³atwy do przeportowania,
83 aby dzia³a³ na kolejnych procesorach. QEMU ma dwa tryby pracy:
84
85 - Emulacja trybu u¿ytkownika. W tym trybie QEMU mo¿e uruchamiaæ
86   procesy linuksowe skompilowane dla jednego procesora na innym
87   procesorze. Linuksowe wywo³ania systemowe s± t³umaczone ze wzglêdu na
88   niezgodno¶æ kolejno¶ci bajtów w s³owie i 32/64-bitowego rozmiaru
89   s³owa. Wine (emulacja Windows) i DOSEMU (emulacja DOS-a) to g³ówne
90   cele QEMU.
91
92 - Pe³na emulacja systemu. W tym trybie QEMU emuluje ca³y system,
93   w³±czaj±c w to procesor i ró¿ne urz±dzenia peryferyjne. Mo¿e byæ tak¿e
94   u¿ywane do wirtualnego hostowania kilku wirtualnych pecetów na
95   pojedynczym serwerze.
96
97 %package -n kernel-misc-kqemu
98 Summary:        kqemu - kernel module
99 Summary(pl):    kqemu - modu³ j±dra
100 Version:        %{_kqemu_version}
101 Release:        %{_rel}@%{_kernel_ver_str}
102 Group:          Base/Kernel
103 %{?with_dist_kernel:%requires_releq_kernel_up}
104 License:        Free to use, non-distributable
105 Requires(post,postun):  /sbin/depmod
106
107 %description -n kernel-misc-kqemu
108 kqemu - kernel module.
109
110 %description -n kernel-misc-kqemu -l pl
111 kqemu - modu³ j±dra.
112
113 %package -n kernel-smp-misc-kqemu
114 Summary:        kqemu - SMP kernel module
115 Summary(pl):    kqemu - modu³ j±dra SMP
116 Version:        %{_kqemu_version}
117 Release:        %{_rel}@%{_kernel_ver_str}
118 Group:          Base/Kernel
119 %{?with_dist_kernel:%requires_releq_kernel_up}
120 License:        Free to use, non-distributable
121 Requires(post,postun):  /sbin/depmod
122
123 %description -n kernel-smp-misc-kqemu
124 kqemu - SMP kernel module.
125
126 %description -n kernel-smp-misc-kqemu -l pl
127 kqemu - modu³ j±dra SMP.
128
129 %prep
130 %setup -q %{?with_kqemu:-a1}
131 %patch0 -p1
132 %patch1 -p1
133 %patch2 -p1
134 %patch3 -p1
135 %patch4 -p1
136 %if %{with gcc4}
137 %patch5 -p0
138 %patch6 -p1
139 %endif
140 # probably not needed
141 # %patch7 -p1
142 %{?with_nosdlgui:%patch8 -p1}
143 %patch9 -p1
144 %patch10 -p1
145 %patch11 -p0
146
147 %{__sed} -i -e 's/sdl_static=yes/sdl_static=no/' configure
148 %{__sed} -i 's/.*MAKE) -C kqemu$//' Makefile
149
150 # cannot use optflags on x86 - they cause "no register to spill" errors
151 %if %{with cflags_passing}
152 %{__sed} -i -e 's/-Wall -O2 -g/-Wall %{rpmcflags}/' Makefile Makefile.target
153 %else
154 %{__sed} -i 's/-Wall -O2 -g/-Wall -O2/' Makefile Makefile.target
155 %endif
156
157 %{?with_kqemu:echo -n > kqemu/install.sh}
158
159 %build
160 %if %{with kernel}
161 cd kqemu
162 mv -f kqemu-linux.c{,.orig}
163 for cfg in %{?with_dist_kernel:%{?with_smp:smp} up}%{!?with_dist_kernel:nondist}; do
164         if [ ! -r "%{_kernelsrcdir}/config-$cfg" ]; then
165                 exit 1
166         fi
167         install -d o/include/linux
168         ln -sf %{_kernelsrcdir}/config-$cfg o/.config
169         ln -sf %{_kernelsrcdir}/Module.symvers-$cfg o/Module.symvers
170         ln -sf %{_kernelsrcdir}/include/linux/autoconf-$cfg.h o/include/linux/autoconf.h
171 %if %{with dist_kernel}
172         %{__make} -C %{_kernelsrcdir} O=$PWD/o prepare scripts
173 %else
174         install -d o/include/config
175         touch o/include/config/MARKER
176         ln -sf %{_kernelsrcdir}/scripts o/scripts
177 %endif
178         if grep -q "^CONFIG_PREEMPT_RT=y$" o/.config; then
179                 sed 's/SPIN_LOCK_UNLOCKED/SPIN_LOCK_UNLOCKED(kqemu_lock)/' \
180                         kqemu-linux.c.orig > kqemu-linux.c
181         else
182                 cat kqemu-linux.c.orig > kqemu-linux.c
183         fi
184
185         %{__make} -C %{_kernelsrcdir} modules \
186                 CC="%{__cc}" CPP="%{__cpp}" \
187                 M=$PWD O=$PWD/o \
188                 %{?with_verbose:V=1}
189         mv kqemu.ko kqemu-mod-$cfg.ko
190 done
191 cd -
192 %endif
193
194 %if %{with userspace}
195 # --extra-cflags don't work (overridden by CFLAGS in Makefile*)
196 # they can be passed if the cflags_passing bcond is used
197 ./configure \
198         --prefix=%{_prefix} \
199         --cc="%{__cc}" \
200         %{?with_gcc4:--disable-gcc-check} \
201         %{!?with_kqemu:--disable-kqemu} \
202         --enable-alsa \
203         --make="%{__make}" \
204         --interp-prefix=%{_libdir}/%{name}
205 %{__make}
206 %endif
207
208 %install
209 rm -rf $RPM_BUILD_ROOT
210
211 %if %{with userspace}
212 %{__make} install \
213         DESTDIR=$RPM_BUILD_ROOT
214
215 install -d $RPM_BUILD_ROOT/sbin
216 cat <<'EOF' > $RPM_BUILD_ROOT/sbin/qemu-ifup
217 #!/bin/sh
218 if [ -f /etc/sysconfig/qemu ]; then
219         . /etc/sysconfig/qemu
220 fi
221 # of course this will work only for one interface. a lot possible to involve
222 sudo /sbin/ifconfig $1 ${INTERFACE_ADDR:-172.20.0.1}
223 EOF
224 %endif
225
226 %if %{with kernel}
227 install -d $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}{,smp}/misc
228 install kqemu/kqemu-mod-up.ko $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/misc/kqemu.ko
229 %if %{with smp} && %{with dist_kernel}
230 install kqemu/kqemu-mod-smp.ko $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}smp/misc/kqemu.ko
231 %endif
232 %endif
233
234 # This dir is unneeded
235 rm -rf $RPM_BUILD_ROOT%{_docdir}/qemu
236
237 %clean
238 rm -rf $RPM_BUILD_ROOT
239
240 %if %{with kqemu}
241 %post
242 %banner %{name} -e <<EOF
243 To enable qemu accelerator (kqemu), the kqemu kernel module must be loaded:
244 modprobe kqemu
245 EOF
246 %endif
247
248 %post   -n kernel-misc-kqemu
249 %depmod %{_kernel_ver}
250 %banner %{name}-module -e <<EOF
251 To autoload kqemu module, add to /etc/modprobe.conf:
252 alias char-major-250 kqemu
253 EOF
254
255 %postun -n kernel-misc-kqemu
256 %depmod %{_kernel_ver}
257
258 %post   -n kernel-smp-misc-kqemu
259 %depmod %{_kernel_ver}smp
260 %banner %{name}-module -e <<EOF
261 To autoload kqemu module, add to /etc/modprobe.conf:
262 alias char-major-250 kqemu
263 EOF
264
265 %postun -n kernel-smp-misc-kqemu
266 %depmod %{_kernel_ver}smp
267
268 %if %{with userspace}
269 %files
270 %defattr(644,root,root,755)
271 %doc README qemu-doc.html qemu-tech.html
272 %attr(755,root,root) /sbin/qemu-ifup
273 %attr(755,root,root) %{_bindir}/*
274 %{_datadir}/qemu
275 %{_mandir}/man1/qemu.1*
276 %{_mandir}/man1/qemu-img.1*
277 # FIXME: maybe better moved this into dev.spec
278 %if %{with kqemu}
279 %dev(c,250,0) %attr(666,root,root) /dev/kqemu
280 %endif
281 %endif
282
283 %if %{with kernel}
284 %files -n kernel-misc-kqemu
285 %defattr(644,root,root,755)
286 %doc kqemu/LICENSE
287 /lib/modules/%{_kernel_ver}/misc/kqemu.ko*
288
289 %if %{with smp} && %{with dist_kernel}
290 %files -n kernel-smp-misc-kqemu
291 %defattr(644,root,root,755)
292 %doc kqemu/LICENSE
293 /lib/modules/%{_kernel_ver}smp/misc/kqemu.ko*
294 %endif
295 %endif
This page took 0.168876 seconds and 3 git commands to generate.