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