]> git.pld-linux.org Git - packages/qemu.git/blob - qemu.spec
1da6e5aebd010607d5c0c48d0ebeceb1e1d28838
[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} 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 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         rm -rf include
168         install -d include/{linux,config}
169         ln -sf %{_kernelsrcdir}/config-$cfg .config
170         ln -sf %{_kernelsrcdir}/include/linux/autoconf-$cfg.h include/linux/autoconf.h
171         ln -sf %{_kernelsrcdir}/include/asm-%{_target_base_arch} include/asm
172         ln -sf %{_kernelsrcdir}/Module.symvers-$cfg Module.symvers
173 %if %{without dist_kernel}
174         ln -sf %{_kernelsrcdir}/scripts
175 %endif
176         touch include/config/MARKER
177         %{__make} -C %{_kernelsrcdir} clean \
178                 RCS_FIND_IGNORE="-name 'kqemu-mod-*.*' -o" \
179                 M=$PWD O=$PWD
180         %{__make} -C %{_kernelsrcdir} modules \
181                 M=$PWD O=$PWD
182         mv kqemu.ko kqemu-mod-$cfg.ko
183 done
184 cd -
185 %endif
186
187 %if %{with userspace}
188 # --extra-cflags don't work (overridden by CFLAGS in Makefile*)
189 # they can be passed if the cflags_passing bcond is used
190 ./configure \
191         --prefix=%{_prefix} \
192         --cc="%{__cc}" \
193         %{?with_gcc4:--disable-gcc-check} \
194         %{!?with_kqemu:--disable-kqemu} \
195         --enable-alsa \
196         --make="%{__make}" \
197         --interp-prefix=%{_libdir}/%{name}
198 %{__make}
199 %endif
200
201 %install
202 rm -rf $RPM_BUILD_ROOT
203
204 %if %{with userspace}
205 %{__make} install \
206         DESTDIR=$RPM_BUILD_ROOT
207
208 install -d $RPM_BUILD_ROOT/sbin
209 cat <<'EOF' > $RPM_BUILD_ROOT/sbin/qemu-ifup
210 #!/bin/sh
211 if [ -f /etc/sysconfig/qemu ]; then
212         . /etc/sysconfig/qemu
213 fi
214 # of course this will work only for one interface. a lot possible to involve
215 sudo /sbin/ifconfig $1 ${INTERFACE_ADDR:-172.20.0.1}
216 EOF
217 %endif
218
219 %if %{with kernel}
220 install -d $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}{,smp}/misc
221 install kqemu/kqemu-mod-up.ko $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/misc/kqemu.ko
222 %if %{with smp} && %{with dist_kernel}
223 install kqemu/kqemu-mod-smp.ko $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}smp/misc/kqemu.ko
224 %endif
225 %endif
226
227 # This dir is unneeded
228 rm -rf $RPM_BUILD_ROOT/usr/share/doc/qemu
229
230 %clean
231 rm -rf $RPM_BUILD_ROOT
232
233 %if %{with kqemu}
234 %post
235 %banner %{name} -e <<EOF
236 To enable qemu accelerator (kqemu), the kqemu kernel module must be loaded:
237 modprobe kqemu
238 EOF
239 %endif
240
241 %post   -n kernel-misc-kqemu
242 %depmod %{_kernel_ver}
243 %banner %{name}-module -e <<EOF
244 To autoload kqemu module, add to /etc/modprobe.conf:
245 alias char-major-250 kqemu
246 EOF
247
248 %postun -n kernel-misc-kqemu
249 %depmod %{_kernel_ver}
250
251 %post   -n kernel-smp-misc-kqemu
252 %depmod %{_kernel_ver}smp
253 %banner %{name}-module -e <<EOF
254 To autoload kqemu module, add to /etc/modprobe.conf:
255 alias char-major-250 kqemu
256 EOF
257
258 %postun -n kernel-smp-misc-kqemu
259 %depmod %{_kernel_ver}smp
260
261 %if %{with userspace}
262 %files
263 %defattr(644,root,root,755)
264 %doc README qemu-doc.html qemu-tech.html
265 %attr(755,root,root) /sbin/qemu-ifup
266 %attr(755,root,root) %{_bindir}/*
267 %{_datadir}/qemu
268 %{_mandir}/man1/qemu.1*
269 %{_mandir}/man1/qemu-img.1*
270 # FIXME: maybe better moved this into dev.spec
271 %if %{with kqemu}
272 %dev(c,250,0) %attr(666,root,root) /dev/kqemu
273 %endif
274 %endif
275
276 %if %{with kernel}
277 %files -n kernel-misc-kqemu
278 %defattr(644,root,root,755)
279 %doc kqemu/LICENSE
280 /lib/modules/%{_kernel_ver}/misc/kqemu.ko*
281
282 %if %{with smp} && %{with dist_kernel}
283 %files -n kernel-smp-misc-kqemu
284 %defattr(644,root,root,755)
285 %doc kqemu/LICENSE
286 /lib/modules/%{_kernel_ver}smp/misc/kqemu.ko*
287 %endif
288 %endif
This page took 0.072367 seconds and 2 git commands to generate.