]> git.pld-linux.org Git - packages/qemu.git/blob - qemu.spec
- supply /sbin/qemu-ifup script
[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.1
18 %define         _rel    1.4
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:  b0c80d2c082049a5b8ccbc7f55fe165b
25 %if %{with kqemu}
26 Source1:        http://fabrice.bellard.free.fr/qemu/kqemu-%{version}-1.tar.gz
27 # NoSource1-md5:        012498dac620eb8c212bf5f622414dd0
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 %endif
139
140 %{?with_kqemu:echo -n > kqemu/install.sh}
141
142 %build
143 %if %{with kernel}
144 cd kqemu
145 for cfg in %{?with_dist_kernel:%{?with_smp:smp} up}%{!?with_dist_kernel:nondist}; do
146         if [ ! -r "%{_kernelsrcdir}/config-$cfg" ]; then
147                 exit 1
148         fi
149         rm -rf include
150         install -d include/{linux,config}
151         ln -sf %{_kernelsrcdir}/config-$cfg .config
152         ln -sf %{_kernelsrcdir}/include/linux/autoconf-$cfg.h include/linux/autoconf.h
153         ln -sf %{_kernelsrcdir}/include/asm-%{_target_base_arch} include/asm
154 %if %{without dist_kernel}
155         ln -sf %{_kernelsrcdir}/scripts
156 %endif
157         touch include/config/MARKER
158         %{__make} -C %{_kernelsrcdir} clean \
159                 RCS_FIND_IGNORE="-name 'kqemu-mod-*.*' -o" \
160                 M=$PWD O=$PWD
161         %{__make} -C %{_kernelsrcdir} modules \
162                 M=$PWD O=$PWD
163         mv kqemu.ko kqemu-mod-$cfg.ko
164 done
165 cd -
166 %endif
167
168 %if %{with userspace}
169 # --extra-cflags don't work (overridden by CFLAGS in Makefile*)
170 # they can be passed if the cflags_passing bcond is used
171 ./configure \
172         --prefix=%{_prefix} \
173         --cc="%{__cc}" \
174         %{!?with_kqemu:--disable-kqemu} \
175         --make="%{__make}"
176 %{__make}
177 %endif
178
179 %install
180 rm -rf $RPM_BUILD_ROOT
181
182 %if %{with userspace}
183 %{__make} install \
184         DESTDIR=$RPM_BUILD_ROOT
185
186 install -d $RPM_BUILD_ROOT/sbin
187 cat <<'EOF' > $RPM_BUILD_ROOT/sbin/qemu-ifup
188 #!/bin/sh
189 if [ -f /etc/sysconfig/qemu ]; then
190         . /etc/sysconfig/qemu
191 fi
192 # of course this will work only for one interface. a lot possible to involve
193 sudo /sbin/ifconfig $1 ${INTERFACE_ADDR:-172.20.0.1}
194 EOF
195 %endif
196
197 %if %{with kernel}
198 install -d $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}{,smp}/misc
199 install kqemu/kqemu-mod-up.ko $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/misc/kqemu.ko
200 %if %{with smp} && %{with dist_kernel}
201 install kqemu/kqemu-mod-smp.ko $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}smp/misc/kqemu.ko
202 %endif
203 %endif
204
205 # This dir is unneeded
206 rm -rf $RPM_BUILD_ROOT/usr/share/doc/qemu
207
208 %clean
209 rm -rf $RPM_BUILD_ROOT
210
211 %if %{with kqemu}
212 %post
213 %banner %{name} -e << EOF
214 To enable qemu accelerator (kqemu), the kqemu kernel module must be loaded:
215 modprobe kqemu
216 EOF
217 %endif
218
219 %post   -n kernel-misc-kqemu
220 %depmod %{_kernel_ver}
221
222 %postun -n kernel-misc-kqemu
223 %depmod %{_kernel_ver}
224
225 %post   -n kernel-smp-misc-kqemu
226 %depmod %{_kernel_ver}smp
227
228 %postun -n kernel-smp-misc-kqemu
229 %depmod %{_kernel_ver}smp
230
231 %if %{with userspace}
232 %files
233 %defattr(644,root,root,755)
234 %doc README qemu-doc.html qemu-tech.html
235 %attr(755,root,root) /sbin/qemu-ifup
236 %attr(755,root,root) %{_bindir}/*
237 %{_datadir}/qemu
238 %{_mandir}/man1/qemu.1*
239 %{_mandir}/man1/qemu-img.1*
240 # FIXME: maybe better moved this into dev.spec
241 %if %{with kqemu}
242 %dev(c,250,0) %attr(666,root,root) /dev/kqemu
243 %endif
244 %endif
245
246 %if %{with kernel}
247 %files -n kernel-misc-kqemu
248 %defattr(644,root,root,755)
249 /lib/modules/%{_kernel_ver}/misc/kqemu.ko*
250
251 %if %{with smp} && %{with dist_kernel}
252 %files -n kernel-smp-misc-kqemu
253 %defattr(644,root,root,755)
254 /lib/modules/%{_kernel_ver}smp/misc/kqemu.ko*
255 %endif
256 %endif
This page took 0.055192 seconds and 4 git commands to generate.