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