]> git.pld-linux.org Git - packages/qemu.git/blob - qemu.spec
- updated to 0.8.1
[packages/qemu.git] / qemu.spec
1 #
2 # TODO:
3 # - wait till the gcc bug http://gcc.gnu.org/PR16185 is fixed.
4 # - kqemu could be distributable if somebody bothers to contact qemu
5 #   author http://fabrice.bellard.free.fr/qemu/qemu-accel.html
6 #
7 # Conditional build:
8 %bcond_with     kqemu                   # with QEMU accelerator module
9 %bcond_with     cflags_passing          # with passing rpmcflags to Makefiles
10 %bcond_with     nosdlgui                # do not use SDL gui (use X11 instead)
11 %bcond_with     gcc4                    # use gcc4 patches (broke build on gcc33)
12 %bcond_without  dist_kernel             # without distribution kernel
13 %bcond_without  kernel                  # don't build kernel modules
14 %bcond_without  smp                     # don't build SMP module
15 %bcond_without  userspace               # don't build userspace utilities
16 #
17 %if %{without kqemu}
18 %undefine       with_kernel
19 %endif
20 #
21 %define _kqemu_version  1.3.0pre7
22 %define         _rel    0.2
23 Summary:        QEMU CPU Emulator
24 Summary(pl):    QEMU - emulator procesora
25 Name:           qemu
26 Version:        0.8.1
27 Release:        %{_rel}%{?with_kqemu:k}
28 License:        GPL
29 Group:          Applications/Emulators
30 #Source0Download: http://fabrice.bellard.free.fr/qemu/download.html
31 Source0:        http://fabrice.bellard.free.fr/qemu/%{name}-%{version}.tar.gz
32 # Source0-md5:  67d924324a5ab79d017bd97a1e767285
33 Source1:        http://fabrice.bellard.free.fr/qemu/k%{name}-%{_kqemu_version}.tar.gz
34 # NoSource1-md5:        3b77edbada790f924456aa4675edd0be
35 NoSource:       1
36 Patch0:         %{name}-nostatic.patch
37 Patch1:         %{name}-cc.patch
38 Patch2:         %{name}-longjmp.patch
39 Patch3:         %{name}-dot.patch
40
41 Patch5:         %{name}-gcc4_x86.patch
42 Patch6:         %{name}-gcc4_ppc.patch
43 Patch7:         %{name}-parallel.patch
44 Patch8:         %{name}-nosdlgui.patch
45 Patch9:         %{name}-ifup.patch
46 Patch10:        %{name}-gcc33.patch
47
48 URL:            http://fabrice.bellard.free.fr/qemu/
49 BuildRequires:  SDL-devel >= 1.2.1
50 BuildRequires:  alsa-lib-devel
51 %{!?with_gcc4:BuildRequires:    gcc < 5:4.0}
52 %if %{with kqemu} && %{with dist_kernel}
53 BuildRequires:  kernel-module-build >= 3:2.6.7
54 %endif
55 BuildRequires:  rpmbuild(macros) >= 1.217
56 BuildRequires:  sed >= 4.0
57 Requires:       SDL >= 1.2.1
58 # sparc is currently unsupported (missing cpu_get_real_ticks() impl in vl.c)
59 ExclusiveArch:  %{ix86} %{x8664} %{!?with_kqemu:ppc}
60 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
61
62 # some SPARC boot image in ELF format
63 %define         _noautostrip    .*%{_datadir}/qemu/proll.elf
64
65 %description
66 QEMU is a FAST! processor emulator. By using dynamic translation it
67 achieves a reasonnable speed while being easy to port on new host
68 CPUs. QEMU has two operating modes:
69
70 - User mode emulation. In this mode, QEMU can launch Linux processes
71   compiled for one CPU on another CPU. Linux system calls are converted
72   because of endianness and 32/64 bit mismatches. Wine (Windows
73   emulation) and DOSEMU (DOS emulation) are the main targets for QEMU.
74
75 - Full system emulation. In this mode, QEMU emulates a full system,
76   including a processor and various peripherials. It can also be used to
77   provide virtual hosting of several 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 na
87   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. Mo¿e byæ tak¿e
93   u¿ywane do wirtualnego hostowania kilku wirtualnych pecetów na
94   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 Requires:       module-init-tools >= 3.2.2-2
106
107 %description -n kernel-misc-kqemu
108 kqemu - kernel module.
109
110 %description -n kernel-misc-kqemu -l pl
111 kqemu - modu³ j±dra.
112
113 %package -n kernel-smp-misc-kqemu
114 Summary:        kqemu - SMP kernel module
115 Summary(pl):    kqemu - modu³ j±dra SMP
116 Version:        %{_kqemu_version}
117 Release:        %{_rel}@%{_kernel_ver_str}
118 Group:          Base/Kernel
119 %{?with_dist_kernel:%requires_releq_kernel_up}
120 License:        Free to use, non-distributable
121 Requires(post,postun):  /sbin/depmod
122 Requires:       module-init-tools >= 3.2.2-2
123
124 %description -n kernel-smp-misc-kqemu
125 kqemu - SMP kernel module.
126
127 %description -n kernel-smp-misc-kqemu -l pl
128 kqemu - modu³ j±dra SMP.
129
130 %prep
131 %setup -q %{?with_kqemu:-a1}
132 %patch0 -p1
133 %patch1 -p1
134 %patch2 -p1
135 %patch3 -p1
136
137 %if %{with gcc4}
138 %patch5 -p0
139 %patch6 -p1
140 %endif
141 # probably not needed
142 # %patch7 -p1
143 %{?with_nosdlgui:%patch8 -p1}
144 %patch9 -p1
145 %patch10 -p1
146
147 %{__sed} -i -e 's/sdl_static=yes/sdl_static=no/' configure
148 %{__sed} -i 's/.*MAKE) -C kqemu$//' Makefile
149
150 # cannot use optflags on x86 - they cause "no register to spill" errors
151 %if %{with cflags_passing}
152 %{__sed} -i -e 's/-Wall -O2 -g/-Wall %{rpmcflags}/' Makefile Makefile.target
153 %else
154 %{__sed} -i 's/-Wall -O2 -g/-Wall -O2/' Makefile Makefile.target
155 %endif
156
157 %if %{with kqemu}
158 echo -n > kqemu-%{_kqemu_version}/install.sh
159
160 cat <<'EOF' > modprobe.conf
161 # enable dynamic major
162 options kqemu major=0
163 # for autoloading from static dev
164 #alias char-major-250 kqemu
165 EOF
166
167 cat <<'EOF' > udev.conf
168 KERNEL=="kqemu", NAME="%k", MODE="0666"
169 EOF
170 %endif
171
172 %build
173 %if %{with kernel}
174 cd kqemu-%{_kqemu_version}
175 mv -f kqemu-linux.c{,.orig}
176 for cfg in %{?with_dist_kernel:%{?with_smp:smp} up}%{!?with_dist_kernel:nondist}; do
177         if [ ! -r "%{_kernelsrcdir}/config-$cfg" ]; then
178                 exit 1
179         fi
180         install -d o/include/linux
181         ln -sf %{_kernelsrcdir}/config-$cfg o/.config
182         ln -sf %{_kernelsrcdir}/Module.symvers-$cfg o/Module.symvers
183         ln -sf %{_kernelsrcdir}/include/linux/autoconf-$cfg.h o/include/linux/autoconf.h
184 %if %{with dist_kernel}
185         %{__make} -C %{_kernelsrcdir} O=$PWD/o prepare scripts
186 %else
187         install -d o/include/config
188         touch o/include/config/MARKER
189         ln -sf %{_kernelsrcdir}/scripts o/scripts
190 %endif
191         if grep -q "^CONFIG_PREEMPT_RT=y$" o/.config; then
192                 sed 's/SPIN_LOCK_UNLOCKED/SPIN_LOCK_UNLOCKED(kqemu_lock)/' \
193                         kqemu-linux.c.orig > kqemu-linux.c
194         else
195                 cat kqemu-linux.c.orig > kqemu-linux.c
196         fi
197
198         %{__make} -C %{_kernelsrcdir} modules \
199                 CC="%{__cc}" CPP="%{__cpp}" \
200                 M=$PWD O=$PWD/o \
201                 %{?with_verbose:V=1}
202         mv kqemu.ko kqemu-mod-$cfg.ko
203 done
204 cd -
205 %endif
206
207 %if %{with userspace}
208 # --extra-cflags don't work (overridden by CFLAGS in Makefile*)
209 # they can be passed if the cflags_passing bcond is used
210 ./configure \
211         --prefix=%{_prefix} \
212         --cc="%{__cc}" \
213         --host-cc="%{__cc}" \
214         --make="%{__make}" \
215         %{?with_gcc4:--disable-gcc-check} \
216         %{!?with_kqemu:--disable-kqemu} \
217         --enable-alsa \
218         --interp-prefix=%{_libdir}/%{name}
219 %{__make}
220 %endif
221
222 %install
223 rm -rf $RPM_BUILD_ROOT
224
225 %if %{with userspace}
226 %{__make} install \
227         DESTDIR=$RPM_BUILD_ROOT
228
229 install -d $RPM_BUILD_ROOT/sbin
230 cat <<'EOF' > $RPM_BUILD_ROOT/sbin/qemu-ifup
231 #!/bin/sh
232 if [ -f /etc/sysconfig/qemu ]; then
233         . /etc/sysconfig/qemu
234 fi
235 # of course this will work only for one interface. a lot possible to involve
236 sudo /sbin/ifconfig $1 ${INTERFACE_ADDR:-172.20.0.1}
237 EOF
238 %endif
239
240 %if %{with kernel}
241 install -d $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}{,smp}/misc
242 install -d $RPM_BUILD_ROOT/etc/{modprobe.d/%{_kernel_ver}{,smp},udev/rules.d}
243 install kqemu-%{_kqemu_version}/kqemu-mod-up.ko $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/misc/kqemu.ko
244 install modprobe.conf $RPM_BUILD_ROOT/etc/modprobe.d/%{_kernel_ver}/kqemu.conf
245 %if %{with smp} && %{with dist_kernel}
246 install kqemu-%{_kqemu_version}/kqemu-mod-smp.ko $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}smp/misc/kqemu.ko
247 install modprobe.conf $RPM_BUILD_ROOT/etc/modprobe.d/%{_kernel_ver}smp/kqemu.conf
248 %endif
249 install udev.conf $RPM_BUILD_ROOT/etc/udev/rules.d/kqemu.rules
250 %endif
251
252 # already packaged
253 rm -rf $RPM_BUILD_ROOT%{_docdir}/qemu/qemu-{doc,tech}.html
254
255 %clean
256 rm -rf $RPM_BUILD_ROOT
257
258 %if %{with kqemu}
259 %post
260 %banner %{name} -e <<EOF
261 To enable qemu accelerator (kqemu), the kqemu kernel module must be loaded:
262 modprobe kqemu
263 EOF
264 %endif
265
266 %post   -n kernel-misc-kqemu
267 %depmod %{_kernel_ver}
268
269 %postun -n kernel-misc-kqemu
270 %depmod %{_kernel_ver}
271
272 %post   -n kernel-smp-misc-kqemu
273 %depmod %{_kernel_ver}smp
274
275 %postun -n kernel-smp-misc-kqemu
276 %depmod %{_kernel_ver}smp
277
278 %if %{with userspace}
279 %files
280 %defattr(644,root,root,755)
281 %doc README qemu-doc.html qemu-tech.html
282 %attr(755,root,root) /sbin/qemu-ifup
283 %attr(755,root,root) %{_bindir}/*
284 %{_datadir}/qemu
285 %{_mandir}/man1/qemu.1*
286 %{_mandir}/man1/qemu-img.1*
287 # FIXME: maybe better moved this into dev.spec
288 %if %{with kqemu}
289 %dev(c,250,0) %attr(666,root,root) /dev/kqemu
290 %endif
291 %endif
292
293 %if %{with kernel}
294 %files -n kernel-misc-kqemu
295 %defattr(644,root,root,755)
296 %doc kqemu-%{_kqemu_version}/LICENSE
297 %config(noreplace) %verify(not md5 mtime size) /etc/udev/rules.d/kqemu.rules
298 %config(noreplace) %verify(not md5 mtime size) /etc/modprobe.d/%{_kernel_ver}/kqemu.conf
299 /lib/modules/%{_kernel_ver}/misc/kqemu.ko*
300
301 %if %{with smp} && %{with dist_kernel}
302 %files -n kernel-smp-misc-kqemu
303 %defattr(644,root,root,755)
304 %doc kqemu-%{_kqemu_version}/LICENSE
305 %config(noreplace) %verify(not md5 mtime size) /etc/udev/rules.d/kqemu.rules
306 %config(noreplace) %verify(not md5 mtime size) /etc/modprobe.d/%{_kernel_ver}smp/kqemu.conf
307 /lib/modules/%{_kernel_ver}smp/misc/kqemu.ko*
308 %endif
309 %endif
This page took 0.058351 seconds and 4 git commands to generate.