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