]> git.pld-linux.org Git - packages/qemu.git/blob - qemu.spec
- bconds can be confusing sometimes
[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.0pre7
18 %define         _rel    0.4
19 Summary:        QEMU CPU Emulator
20 Summary(pl):    QEMU - emulator procesora
21 Name:           qemu
22 Version:        0.8.1
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:  67d924324a5ab79d017bd97a1e767285
29 Source1:        http://fabrice.bellard.free.fr/qemu/k%{name}-%{_kqemu_version}.tar.gz
30 # NoSource1-md5:        3b77edbada790f924456aa4675edd0be
31 NoSource:       1
32 Patch0:         %{name}-nostatic.patch
33 Patch1:         %{name}-cc.patch
34 Patch2:         %{name}-longjmp.patch
35 Patch3:         %{name}-dot.patch
36
37 Patch5:         %{name}-gcc4_x86.patch
38 Patch6:         %{name}-gcc4_ppc.patch
39 Patch7:         %{name}-parallel.patch
40 Patch8:         %{name}-nosdlgui.patch
41 Patch9:         %{name}-ifup.patch
42 Patch10:        %{name}-gcc33.patch
43
44 URL:            http://fabrice.bellard.free.fr/qemu/
45 BuildRequires:  SDL-devel >= 1.2.1
46 BuildRequires:  alsa-lib-devel
47 %{!?with_gcc4:BuildRequires:    gcc < 5:4.0}
48 %if %{with kqemu} && %{with dist_kernel}
49 BuildRequires:  kernel-module-build >= 3:2.6.7
50 %endif
51 BuildRequires:  rpmbuild(macros) >= 1.217
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/proll.elf
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
133 %if %{with gcc4}
134 %patch5 -p0
135 %patch6 -p1
136 %endif
137 # probably not needed
138 # %patch7 -p1
139 %{?with_nosdlgui:%patch8 -p1}
140 %patch9 -p1
141 %patch10 -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         %{?with_gcc4:--disable-gcc-check} \
212         %{!?with_kqemu:--disable-kqemu} \
213         --enable-alsa \
214         --interp-prefix=%{_libdir}/%{name}
215 %{__make}
216 %endif
217
218 %install
219 rm -rf $RPM_BUILD_ROOT
220
221 %if %{with userspace}
222 %{__make} install \
223         DESTDIR=$RPM_BUILD_ROOT
224
225 install -d $RPM_BUILD_ROOT/sbin
226 cat <<'EOF' > $RPM_BUILD_ROOT/sbin/qemu-ifup
227 #!/bin/sh
228 if [ -f /etc/sysconfig/qemu ]; then
229         . /etc/sysconfig/qemu
230 fi
231 # of course this will work only for one interface. a lot possible to involve
232 sudo /sbin/ifconfig $1 ${INTERFACE_ADDR:-172.20.0.1}
233 EOF
234 %endif
235
236 %if %{with kernel}
237 install -d $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}{,smp}/misc
238 install -d $RPM_BUILD_ROOT/etc/{modprobe.d/%{_kernel_ver}{,smp},udev/rules.d}
239 install kqemu-%{_kqemu_version}/kqemu-mod-up.ko $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/misc/kqemu.ko
240 install modprobe.conf $RPM_BUILD_ROOT/etc/modprobe.d/%{_kernel_ver}/kqemu.conf
241 %if %{with smp} && %{with dist_kernel}
242 install kqemu-%{_kqemu_version}/kqemu-mod-smp.ko $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}smp/misc/kqemu.ko
243 install modprobe.conf $RPM_BUILD_ROOT/etc/modprobe.d/%{_kernel_ver}smp/kqemu.conf
244 %endif
245 install udev.conf $RPM_BUILD_ROOT/etc/udev/rules.d/kqemu.rules
246 %endif
247
248 # already packaged
249 rm -rf $RPM_BUILD_ROOT%{_docdir}/qemu/qemu-{doc,tech}.html
250
251 %clean
252 rm -rf $RPM_BUILD_ROOT
253
254 %if %{with kernel}
255 %post
256 %banner %{name} -e <<EOF
257 To enable qemu accelerator (kqemu), the kqemu kernel module must be loaded:
258 modprobe kqemu
259 EOF
260 %endif
261
262 %post   -n kernel-misc-kqemu
263 %depmod %{_kernel_ver}
264
265 %postun -n kernel-misc-kqemu
266 %depmod %{_kernel_ver}
267
268 %post   -n kernel-smp-misc-kqemu
269 %depmod %{_kernel_ver}smp
270
271 %postun -n kernel-smp-misc-kqemu
272 %depmod %{_kernel_ver}smp
273
274 %if %{with userspace}
275 %files
276 %defattr(644,root,root,755)
277 %doc README qemu-doc.html qemu-tech.html
278 %attr(755,root,root) /sbin/qemu-ifup
279 %attr(755,root,root) %{_bindir}/*
280 %{_datadir}/qemu
281 %{_mandir}/man1/qemu.1*
282 %{_mandir}/man1/qemu-img.1*
283 %endif
284
285 %if %{with kernel}
286 %files -n kernel-misc-kqemu
287 %defattr(644,root,root,755)
288 %doc kqemu-%{_kqemu_version}/LICENSE
289 %config(noreplace) %verify(not md5 mtime size) /etc/udev/rules.d/kqemu.rules
290 %config(noreplace) %verify(not md5 mtime size) /etc/modprobe.d/%{_kernel_ver}/kqemu.conf
291 /lib/modules/%{_kernel_ver}/misc/kqemu.ko*
292
293 %if %{with smp} && %{with dist_kernel}
294 %files -n kernel-smp-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}smp/kqemu.conf
299 /lib/modules/%{_kernel_ver}smp/misc/kqemu.ko*
300 %endif
301 %endif
This page took 0.042025 seconds and 3 git commands to generate.