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