]> git.pld-linux.org Git - packages/qemu.git/blob - qemu.spec
- up to 0.11.1
[packages/qemu.git] / qemu.spec
1 #
2 # TODO:
3 # - update patches
4 #
5 # Conditional build:
6 %bcond_without  kqemu                   # disable KQEMU ACCELERATOR support in QEMU
7 %bcond_with     cflags_passing          # with passing rpmcflags to Makefiles
8 %bcond_with     dosguest                # add special patch when use with DOS as guest os
9 %bcond_with     nosdlgui                # do not use SDL gui (use X11 instead)
10 %bcond_without  dist_kernel             # without distribution kernel
11 %bcond_without  kernel                  # build kqemu KERNEL MODULES
12 %bcond_without  userspace               # don't build userspace utilities
13
14 # no kernel kqemu module for ppc
15 %ifarch ppc
16 %undefine      with_kqemu
17 %undefine      with_kernel
18 %endif
19
20 %if %{without kernel}
21 %undefine       with_dist_kernel
22 %endif
23 %if "%{_alt_kernel}" != "%{nil}"
24 %undefine       with_userspace
25 %endif
26 %if %{without userspace}
27 # nothing to be placed to debuginfo package
28 %define         _enable_debug_packages  0
29 %endif
30
31 %define         rel     1
32
33 %define         kqemu_version   1.4.0pre1
34 %define         qemu_version    0.11.1
35 %define         pname   qemu
36 Summary:        QEMU CPU Emulator
37 Summary(pl.UTF-8):      QEMU - emulator procesora
38 Name:           %{pname}%{_alt_kernel}
39 Version:        %{qemu_version}
40 Release:        %{rel}%{?with_kqemu:k}
41 License:        GPL
42 Group:          Applications/Emulators
43 # Source0Download: http://fabrice.bellard.free.fr/qemu/download.html
44 Source0:        http://download.savannah.gnu.org/releases/qemu/%{pname}-%{version}.tar.gz
45 # Source0-md5:  193285b0bcf655a7f7577d05ffcb82b1
46 Source1:        http://www.nongnu.org/qemu/k%{pname}-%{kqemu_version}.tar.gz
47 # Source1-md5:  d738d8ca7332211ab716ec3213d82ee1
48 Patch0:         %{pname}-ncurses.patch
49 Patch6:         %{pname}-nosdlgui.patch
50 # Proof of concept, for reference, do not remove
51 Patch8:         %{pname}-kde_virtual_workspaces_hack.patch
52 #Patch12:       %{pname}-0.7.2-dyngen-check-stack-clobbers.patch
53 Patch13:        %{pname}-dosguest.patch
54 Patch14:        %{pname}-ppc_old_binutils.patch
55 Patch15:        %{pname}-isa-bios-ram.patch
56 # below one fixes problems with passing ram size to bios/bootloader
57 # which affects coreboot/linuxbios
58 Patch16:        %{pname}-piix-ram-size.patch
59 URL:            http://www.nongnu.org/qemu/
60 %if %{with kernel} && %{with dist_kernel}
61 BuildRequires:  kernel%{_alt_kernel}-module-build >= 3:2.6.7
62 BuildRequires:  rpmbuild(macros) >= 1.379
63 %endif
64 %if %{with userspace}
65 BuildRequires:  SDL-devel >= 1.2.1
66 BuildRequires:  alsa-lib-devel
67 BuildRequires:  bluez-libs-devel
68 BuildRequires:  gnutls-devel
69 BuildRequires:  ncurses-devel
70 BuildRequires:  perl-tools-pod
71 BuildRequires:  pkgconfig
72 BuildRequires:  sed >= 4.0
73 BuildRequires:  texi2html
74 BuildRequires:  texinfo-texi2dvi
75 BuildRequires:  which
76 BuildRequires:  xorg-lib-libX11-devel
77 %endif
78 Requires:       SDL >= 1.2.1
79 # sparc is currently unsupported (missing cpu_get_real_ticks() impl in vl.c)
80 ExclusiveArch:  %{ix86} %{x8664} %{?with_userspace:ppc}
81 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
82
83 # some PPC/SPARC boot image in ELF format
84 %define         _noautostrip    .*%{_datadir}/qemu/openbios-.*
85
86 %description
87 QEMU is a FAST! processor emulator. By using dynamic translation it
88 achieves a reasonnable speed while being easy to port on new host
89 CPUs. QEMU has two operating modes:
90
91 - User mode emulation. In this mode, QEMU can launch Linux processes
92   compiled for one CPU on another CPU. Linux system calls are converted
93   because of endianness and 32/64 bit mismatches. Wine (Windows
94   emulation) and DOSEMU (DOS emulation) are the main targets for QEMU.
95
96 - Full system emulation. In this mode, QEMU emulates a full system,
97   including a processor and various peripherials. It can also be used to
98   provide virtual hosting of several virtual PC on a single server.
99
100 %description -l pl.UTF-8
101 QEMU to szybki(!) emulator procesora. Poprzez użycie dynamicznego
102 tłumaczenia osiąga rozsądną szybkość i jest łatwy do przeportowania,
103 aby działał na kolejnych procesorach. QEMU ma dwa tryby pracy:
104
105 - Emulacja trybu użytkownika. W tym trybie QEMU może uruchamiać
106   procesy linuksowe skompilowane dla jednego procesora na innym
107   procesorze. Linuksowe wywołania systemowe są tłumaczone ze względu na
108   niezgodność kolejności bajtów w słowie i 32/64-bitowego rozmiaru
109   słowa. Wine (emulacja Windows) i DOSEMU (emulacja DOS-a) to główne
110   cele QEMU.
111
112 - Pełna emulacja systemu. W tym trybie QEMU emuluje cały system,
113   włączając w to procesor i różne urządzenia peryferyjne. Może być także
114   używane do wirtualnego hostowania kilku wirtualnych pecetów na
115   pojedynczym serwerze.
116
117 %package -n kernel%{_alt_kernel}-misc-kqemu
118 Summary:        kqemu - kernel module
119 Summary(pl.UTF-8):      kqemu - moduł jądra
120 Version:        %{kqemu_version}
121 Release:        %{rel}@%{_kernel_ver_str}
122 Group:          Base/Kernel
123 %{?with_dist_kernel:%requires_releq_kernel}
124 License:        GPL v2
125 Obsoletes:      kernel%{_alt_kernel}-smp-misc-kqemu
126 Requires(post,postun):  /sbin/depmod
127 Requires:       module-init-tools >= 3.2.2-2
128
129 %description -n kernel%{_alt_kernel}-misc-kqemu
130 kqemu - kernel module.
131
132 %description -n kernel%{_alt_kernel}-misc-kqemu -l pl.UTF-8
133 kqemu - moduł jądra.
134
135 %prep
136 %setup -q -n %{pname}-%{qemu_version} %{?with_kernel:-a1}
137 %patch0 -p0
138 %{?with_nosdlgui:%patch6 -p1}
139 #%patch8 -p1
140
141 %{__sed} -i -e 's/sdl_static=yes/sdl_static=no/' configure
142 %{__sed} -i 's/.*MAKE) -C kqemu$//' Makefile
143
144 # cannot use optflags on x86 - they cause "no register to spill" errors
145 %if %{with cflags_passing}
146 %{__sed} -i -e 's/-Wall -O2 -g/-Wall %{rpmcflags}/' Makefile Makefile.target
147 %else
148 %{__sed} -i 's/-Wall -O2 -g/-Wall -O2/' Makefile Makefile.target
149 %endif
150
151 %if %{with kernel}
152 echo -n > kqemu-%{kqemu_version}/install.sh
153
154 cat <<'EOF' > modprobe.conf
155 # enable dynamic major
156 options kqemu major=0
157 # for autoloading from static dev
158 #alias char-major-250 kqemu
159 EOF
160
161 cat <<'EOF' > udev.conf
162 KERNEL=="kqemu", NAME="%k", MODE="0666"
163 EOF
164
165 %if %{with dosguest}
166 %patch13 -p1
167 %endif
168 %patch14 -p1
169 #%patch15 -p1
170 %patch16 -p1
171
172 cd kqemu-%{kqemu_version}
173 %{__sed} -i 's#include ../config-host.mak##' ./common/Makefile
174 %ifarch %{x8664}
175 %{__sed} -i 's/^#ARCH=x86_64/ARCH=x86_64/' ./common/Makefile
176 %{__make} -C common -j1
177 mv -f kqemu-mod-x86_64.o{,.bin}
178 %else
179 %{__sed} -i 's/^#ARCH=i386/ARCH=i386/' ./common/Makefile
180 %{__make} -C common -j1
181 mv -f kqemu-mod-i386.o{,.bin}
182 %endif
183
184 mv -f kqemu-linux.c{,.orig}
185 cat > Makefile <<'EOF'
186 obj-m := kqemu.o
187 kqemu-objs:= kqemu-linux.o kqemu-mod.o
188
189 $(obj)/kqemu-mod.o: $(src)/kqemu-mod-$(ARCH).o.bin
190         cp $< $@
191 EOF
192 cd -
193 %endif
194
195 %build
196 %if %{with kernel}
197 cd kqemu-%{kqemu_version}
198 %build_kernel_modules -m kqemu <<'EOF'
199 if grep -q "CONFIG_PREEMPT_RT" o/.config; then
200         sed 's/SPIN_LOCK_UNLOCKED/SPIN_LOCK_UNLOCKED(kqemu_lock)/' \
201                 kqemu-linux.c.orig > kqemu-linux.c
202 else
203         cat kqemu-linux.c.orig > kqemu-linux.c
204 fi
205 EOF
206 cd -
207 %endif
208
209 %if %{with userspace}
210 # --extra-cflags don't work (overridden by CFLAGS in Makefile*)
211 # they can be passed if the cflags_passing bcond is used
212 ./configure \
213         --prefix=%{_prefix} \
214         --cc="%{__cc}" \
215         --host-cc="%{__cc}" \
216         --make="%{__make}" \
217 %if %{without kqemu}
218         --disable-kqemu \
219 %endif
220         --enable-mixemu \
221         --audio-drv-list="alsa" \
222         --interp-prefix=%{_libdir}/%{pname}
223 %{__make}
224 %endif
225
226 %install
227 rm -rf $RPM_BUILD_ROOT
228
229 %if %{with userspace}
230 %{__make} install \
231         DESTDIR=$RPM_BUILD_ROOT
232
233 install -d $RPM_BUILD_ROOT%{_sysconfdir}
234 cat <<'EOF' > $RPM_BUILD_ROOT%{_sysconfdir}/qemu-ifup
235 #!/bin/sh
236
237 EOF
238 %endif
239
240 %if %{with kernel}
241 %install_kernel_modules -m kqemu-%{kqemu_version}/kqemu -d misc
242 install -d $RPM_BUILD_ROOT/etc/{modprobe.d/%{_kernel_ver}{,smp},udev/rules.d}
243 install modprobe.conf $RPM_BUILD_ROOT/etc/modprobe.d/%{_kernel_ver}/kqemu.conf
244 install udev.conf $RPM_BUILD_ROOT/etc/udev/rules.d/kqemu.rules
245 %endif
246
247 # already packaged
248 rm -rf $RPM_BUILD_ROOT%{_docdir}/qemu/qemu-{doc,tech}.html
249
250 %clean
251 rm -rf $RPM_BUILD_ROOT
252
253 %if %{with kernel}
254 %post
255 %banner %{pname} -e <<EOF
256 To enable qemu accelerator (kqemu), the kqemu kernel module must be loaded:
257 modprobe kqemu
258 EOF
259 %endif
260
261 %post   -n kernel%{_alt_kernel}-misc-kqemu
262 %depmod %{_kernel_ver}
263
264 %postun -n kernel%{_alt_kernel}-misc-kqemu
265 %depmod %{_kernel_ver}
266
267 %if %{with userspace}
268 %files
269 %defattr(644,root,root,755)
270 %doc README qemu-doc.html qemu-tech.html
271 %attr(755,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/qemu-ifup
272 %attr(755,root,root) %{_bindir}/*
273 %{_datadir}/qemu
274 %{_mandir}/man1/qemu.1*
275 %{_mandir}/man1/qemu-img.1*
276 %{_mandir}/man8/qemu-nbd.8*
277 %endif
278
279 %if %{with kernel}
280 %files -n kernel%{_alt_kernel}-misc-kqemu
281 %defattr(644,root,root,755)
282 %doc kqemu-%{kqemu_version}/LICENSE
283 %config(noreplace) %verify(not md5 mtime size) /etc/udev/rules.d/kqemu.rules
284 %config(noreplace) %verify(not md5 mtime size) /etc/modprobe.d/%{_kernel_ver}/kqemu.conf
285 /lib/modules/%{_kernel_ver}/misc/kqemu.ko*
286 %endif
This page took 0.048279 seconds and 4 git commands to generate.