]> git.pld-linux.org Git - packages/qemu.git/blob - qemu.spec
806fc342bf70a8c3dda81be0e6c794541d6469c3
[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_without  kqemu                   # disable QEMU accelerator support
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_with     kernel                  # build kqemu kernel modules
14 %bcond_without  smp                     # don't build SMP module
15 %bcond_without  userspace               # don't build userspace utilities
16 #
17 %define _kqemu_version  1.3.0pre9
18 %define         _rel    0.4
19 Summary:        QEMU CPU Emulator
20 Summary(pl):    QEMU - emulator procesora
21 Name:           qemu
22 Version:        0.8.2
23 Release:        %{_rel}%{?with_kqemu:k}
24 License:        GPL
25 Group:          Applications/Emulators
26 #Source0Download: http://fabrice.bellard.free.fr/qemu/download.html
27 Source0:        http://fabrice.bellard.free.fr/qemu/%{name}-%{version}.tar.gz
28 # Source0-md5:  5b3a89eb2f256a8a6f3bb07f7b3f1b07
29 Source1:        http://fabrice.bellard.free.fr/qemu/k%{name}-%{_kqemu_version}.tar.gz
30 # Source1-md5:  27888c3220844ad360a6a23345fa1bcb
31 NoSource:       1
32 Patch0:         %{name}-nostatic.patch
33 Patch1:         %{name}-cc.patch
34 Patch2:         %{name}-longjmp.patch
35 Patch3:         %{name}-dot.patch
36 Patch4:         %{name}-gcc4_x86.patch
37 Patch5:         %{name}-gcc4_ppc.patch
38 Patch6:         %{name}-nosdlgui.patch
39 Patch7:         %{name}-ifup.patch
40 Patch8: %{name}-gcc33.patch
41 Patch9:         %{name}-parallel.patch
42 URL:            http://fabrice.bellard.free.fr/qemu/
43 BuildRequires:  SDL-devel >= 1.2.1
44 BuildRequires:  alsa-lib-devel
45 %{!?with_gcc4:BuildRequires:    gcc < 5:4.0}
46 %if %{with kqemu} && %{with dist_kernel}
47 BuildRequires:  kernel-module-build >= 3:2.6.7
48 %endif
49 BuildRequires:  perl-tools-pod
50 BuildRequires:  rpmbuild(macros) >= 1.217
51 BuildRequires:  tetex
52 BuildRequires:  sed >= 4.0
53 Requires:       SDL >= 1.2.1
54 # sparc is currently unsupported (missing cpu_get_real_ticks() impl in vl.c)
55 ExclusiveArch:  %{ix86} %{x8664} %{!?with_kqemu:ppc}
56 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
57
58 # some SPARC boot image in ELF format
59 %define         _noautostrip    .*%{_datadir}/qemu/openbios-sparc32
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. It can also be used to
73   provide virtual hosting of several virtual PC on a single server.
74
75 %description -l pl
76 QEMU to szybki(!) emulator procesora. Poprzez u¿ycie dynamicznego
77 t³umaczenia osi±ga rozs±dn± szybko¶æ i jest ³atwy do przeportowania,
78 aby dzia³a³ na kolejnych procesorach. QEMU ma dwa tryby pracy:
79
80 - Emulacja trybu u¿ytkownika. W tym trybie QEMU mo¿e uruchamiaæ
81   procesy linuksowe skompilowane dla jednego procesora na innym
82   procesorze. Linuksowe wywo³ania systemowe s± t³umaczone ze wzglêdu na
83   niezgodno¶æ kolejno¶ci bajtów w s³owie i 32/64-bitowego rozmiaru
84   s³owa. Wine (emulacja Windows) i DOSEMU (emulacja DOS-a) to g³ówne
85   cele QEMU.
86
87 - Pe³na emulacja systemu. W tym trybie QEMU emuluje ca³y system,
88   w³±czaj±c w to procesor i ró¿ne urz±dzenia peryferyjne. Mo¿e byæ tak¿e
89   u¿ywane do wirtualnego hostowania kilku wirtualnych pecetów na
90   pojedynczym serwerze.
91
92 %package -n kernel-misc-kqemu
93 Summary:        kqemu - kernel module
94 Summary(pl):    kqemu - modu³ j±dra
95 Version:        %{_kqemu_version}
96 Release:        %{_rel}@%{_kernel_ver_str}
97 Group:          Base/Kernel
98 %{?with_dist_kernel:%requires_releq_kernel_up}
99 License:        Free to use, non-distributable
100 Requires(post,postun):  /sbin/depmod
101 Requires:       module-init-tools >= 3.2.2-2
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 Requires:       module-init-tools >= 3.2.2-2
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_kernel:-a1}
128 %patch0 -p1
129 %patch1 -p1
130 %patch2 -p1
131 %patch3 -p1
132 %if %{with gcc4}
133 %patch4 -p0
134 %patch5 -p1
135 %endif
136 %{?with_nosdlgui:%patch6 -p1}
137 %patch7 -p1
138 # probably not needed
139 #%patch8 -p1
140 # probably not needed
141 #%%patch9 -p1
142
143 %{__sed} -i -e 's/sdl_static=yes/sdl_static=no/' configure
144 %{__sed} -i 's/.*MAKE) -C kqemu$//' Makefile
145
146 # cannot use optflags on x86 - they cause "no register to spill" errors
147 %if %{with cflags_passing}
148 %{__sed} -i -e 's/-Wall -O2 -g/-Wall %{rpmcflags}/' Makefile Makefile.target
149 %else
150 %{__sed} -i 's/-Wall -O2 -g/-Wall -O2/' Makefile Makefile.target
151 %endif
152
153 %if %{with kernel}
154 echo -n > kqemu-%{_kqemu_version}/install.sh
155
156 cat <<'EOF' > modprobe.conf
157 # enable dynamic major
158 options kqemu major=0
159 # for autoloading from static dev
160 #alias char-major-250 kqemu
161 EOF
162
163 cat <<'EOF' > udev.conf
164 KERNEL=="kqemu", NAME="%k", MODE="0666"
165 EOF
166 %endif
167
168 %build
169 %if %{with kernel}
170 cd kqemu-%{_kqemu_version}
171 mv -f kqemu-linux.c{,.orig}
172 for cfg in %{?with_dist_kernel:%{?with_smp:smp} up}%{!?with_dist_kernel:nondist}; do
173         if [ ! -r "%{_kernelsrcdir}/config-$cfg" ]; then
174                 exit 1
175         fi
176         install -d o/include/linux
177         ln -sf %{_kernelsrcdir}/config-$cfg o/.config
178         ln -sf %{_kernelsrcdir}/Module.symvers-$cfg o/Module.symvers
179         ln -sf %{_kernelsrcdir}/include/linux/autoconf-$cfg.h o/include/linux/autoconf.h
180 %if %{with dist_kernel}
181         %{__make} -C %{_kernelsrcdir} O=$PWD/o prepare scripts
182 %else
183         install -d o/include/config
184         touch o/include/config/MARKER
185         ln -sf %{_kernelsrcdir}/scripts o/scripts
186 %endif
187         if grep -q "^CONFIG_PREEMPT_RT=y$" o/.config; then
188                 sed 's/SPIN_LOCK_UNLOCKED/SPIN_LOCK_UNLOCKED(kqemu_lock)/' \
189                         kqemu-linux.c.orig > kqemu-linux.c
190         else
191                 cat kqemu-linux.c.orig > kqemu-linux.c
192         fi
193
194         %{__make} -C %{_kernelsrcdir} modules \
195                 CC="%{__cc}" CPP="%{__cpp}" \
196                 M=$PWD O=$PWD/o \
197                 %{?with_verbose:V=1}
198         mv kqemu.ko kqemu-mod-$cfg.ko
199 done
200 cd -
201 %endif
202
203 %if %{with userspace}
204 # --extra-cflags don't work (overridden by CFLAGS in Makefile*)
205 # they can be passed if the cflags_passing bcond is used
206 ./configure \
207         --prefix=%{_prefix} \
208         --cc="%{__cc}" \
209         --host-cc="%{__cc}" \
210         --make="%{__make}" \
211 %if %{with kqemu}
212         --kernel-path=%{_kernelsrcdir} \
213 %else
214         --disable-kqemu \
215 %endif
216         %{?with_gcc4:--disable-gcc-check} \
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 kernel}
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 %endif
288
289 %if %{with kernel}
290 %files -n kernel-misc-kqemu
291 %defattr(644,root,root,755)
292 %doc kqemu-%{_kqemu_version}/LICENSE
293 %config(noreplace) %verify(not md5 mtime size) /etc/udev/rules.d/kqemu.rules
294 %config(noreplace) %verify(not md5 mtime size) /etc/modprobe.d/%{_kernel_ver}/kqemu.conf
295 /lib/modules/%{_kernel_ver}/misc/kqemu.ko*
296
297 %if %{with smp} && %{with dist_kernel}
298 %files -n kernel-smp-misc-kqemu
299 %defattr(644,root,root,755)
300 %doc kqemu-%{_kqemu_version}/LICENSE
301 %config(noreplace) %verify(not md5 mtime size) /etc/udev/rules.d/kqemu.rules
302 %config(noreplace) %verify(not md5 mtime size) /etc/modprobe.d/%{_kernel_ver}smp/kqemu.conf
303 /lib/modules/%{_kernel_ver}smp/misc/kqemu.ko*
304 %endif
305 %endif
This page took 0.106654 seconds and 2 git commands to generate.