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