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