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