]> git.pld-linux.org Git - packages/qemu.git/blame - qemu.spec
- release 19
[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
b0ed57e1 34%define rel 19
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/
d1ae30a6 69%if %{with kernel} && %{with dist_kernel}
70BuildRequires: kernel%{_alt_kernel}-module-build >= 3:2.6.7
a154aede 71BuildRequires: rpmbuild(macros) >= 1.379
d1ae30a6 72%endif
73%if %{with userspace}
867764ba 74BuildRequires: SDL-devel >= 1.2.1
b0b3ca8d 75BuildRequires: alsa-lib-devel
e900aba9 76BuildRequires: compat-gcc-34
2fb8ea02 77BuildRequires: perl-tools-pod
8bb1261c 78BuildRequires: sed >= 4.0
cad677a4 79BuildRequires: tetex
80BuildRequires: which
d1ae30a6 81%endif
8bb1261c 82Requires: SDL >= 1.2.1
2ef13cb9 83# sparc is currently unsupported (missing cpu_get_real_ticks() impl in vl.c)
007877cb 84ExclusiveArch: %{ix86} %{x8664} %{?with_userspace:ppc}
cd19124e 85BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
86
a154aede
ER
87# some SPARC boot image in ELF format
88%define _noautostrip .*%{_datadir}/qemu/openbios-sparc32
89
cd19124e 90%description
91QEMU is a FAST! processor emulator. By using dynamic translation it
92achieves a reasonnable speed while being easy to port on new host
93CPUs. QEMU has two operating modes:
94
95- User mode emulation. In this mode, QEMU can launch Linux processes
96 compiled for one CPU on another CPU. Linux system calls are converted
97 because of endianness and 32/64 bit mismatches. Wine (Windows
98 emulation) and DOSEMU (DOS emulation) are the main targets for QEMU.
99
100- Full system emulation. In this mode, QEMU emulates a full system,
8799423b
ER
101 including a processor and various peripherials. It can also be used to
102 provide virtual hosting of several virtual PC on a single server.
cd19124e 103
27b30e9c
JR
104%description -l pl.UTF-8
105QEMU to szybki(!) emulator procesora. Poprzez użycie dynamicznego
106tłumaczenia osiąga rozsądną szybkość i jest łatwy do przeportowania,
107aby działał na kolejnych procesorach. QEMU ma dwa tryby pracy:
5a2da1d0 108
27b30e9c 109- Emulacja trybu użytkownika. W tym trybie QEMU może uruchamiać
5a2da1d0 110 procesy linuksowe skompilowane dla jednego procesora na innym
27b30e9c
JR
111 procesorze. Linuksowe wywołania systemowe są tłumaczone ze względu na
112 niezgodność kolejności bajtów w słowie i 32/64-bitowego rozmiaru
113 słowa. Wine (emulacja Windows) i DOSEMU (emulacja DOS-a) to główne
5a2da1d0
JB
114 cele QEMU.
115
27b30e9c
JR
116- Pełna emulacja systemu. W tym trybie QEMU emuluje cały system,
117 włączając w to procesor i różne urządzenia peryferyjne. Może być także
118 używane do wirtualnego hostowania kilku wirtualnych pecetów na
8799423b 119 pojedynczym serwerze.
5a2da1d0 120
59d7e27b 121%package -n kernel%{_alt_kernel}-misc-kqemu
8bb1261c 122Summary: kqemu - kernel module
eec0535a 123Summary(pl.UTF-8): kqemu - moduł jądra
80bac37e 124Version: %{kqemu_version}
007877cb 125Release: %{rel}@%{_kernel_ver_str}
8bb1261c 126Group: Base/Kernel
04d100ab 127%{?with_dist_kernel:%requires_releq_kernel}
8f93639f 128License: GPL v2
04d100ab 129Obsoletes: kernel%{_alt_kernel}-smp-misc-kqemu
8bb1261c 130Requires(post,postun): /sbin/depmod
39b50bf0 131Requires: module-init-tools >= 3.2.2-2
8bb1261c 132
59d7e27b 133%description -n kernel%{_alt_kernel}-misc-kqemu
8bb1261c
KK
134kqemu - kernel module.
135
27b30e9c
JR
136%description -n kernel%{_alt_kernel}-misc-kqemu -l pl.UTF-8
137kqemu - moduł jądra.
8bb1261c 138
cd19124e 139%prep
80bac37e 140%setup -q -n %{pname}-%{qemu_version} %{?with_kernel:-a1}
968e3e81
JB
141%patch0 -p1
142%patch1 -p1
d8d8cede 143%patch3 -p1
8d073aaa 144%{?with_nosdlgui:%patch6 -p1}
81a493f2 145#%patch8 -p1
0b920c52
146
147%{__sed} -i -e 's/sdl_static=yes/sdl_static=no/' configure
8bb1261c 148%{__sed} -i 's/.*MAKE) -C kqemu$//' Makefile
cd19124e 149
c3048014 150# cannot use optflags on x86 - they cause "no register to spill" errors
0b920c52
151%if %{with cflags_passing}
152%{__sed} -i -e 's/-Wall -O2 -g/-Wall %{rpmcflags}/' Makefile Makefile.target
57d8430f
KK
153%else
154%{__sed} -i 's/-Wall -O2 -g/-Wall -O2/' Makefile Makefile.target
0b920c52 155%endif
c3048014 156
2dad6a94 157%if %{with kernel}
80bac37e 158echo -n > kqemu-%{kqemu_version}/install.sh
c33439fc
ER
159
160cat <<'EOF' > modprobe.conf
161# enable dynamic major
162options kqemu major=0
163# for autoloading from static dev
164#alias char-major-250 kqemu
165EOF
166
167cat <<'EOF' > udev.conf
168KERNEL=="kqemu", NAME="%k", MODE="0666"
169EOF
0d2efd95 170
c9c22e78
ER
171%if %{with dosguest}
172%patch13 -p1
173%endif
174%patch14 -p1
175%patch15 -p1
176%patch16 -p1
c4b12b8b
ER
177%patch17 -p2
178%patch18 -p0
d41f53f1 179%patch19 -p0
8aeb34b3 180%patch20 -p1
c9c22e78 181
80bac37e 182cd kqemu-%{kqemu_version}
c1e4b9fd
ER
183%{__sed} -i 's#include ../config-host.mak##' ./common/Makefile
184%ifarch %{x8664}
185%{__sed} -i 's/^#ARCH=x86_64/ARCH=x86_64/' ./common/Makefile
c9c22e78 186%{__make} -C common -j1
0d2efd95 187mv -f kqemu-mod-x86_64.o{,.bin}
c1e4b9fd
ER
188%else
189%{__sed} -i 's/^#ARCH=i386/ARCH=i386/' ./common/Makefile
c9c22e78 190%{__make} -C common -j1
c1e4b9fd
ER
191mv -f kqemu-mod-i386.o{,.bin}
192%endif
193
35648466 194mv -f kqemu-linux.c{,.orig}
0d2efd95 195cat > Makefile <<'EOF'
196obj-m := kqemu.o
197kqemu-objs:= kqemu-linux.o kqemu-mod.o
198
199$(obj)/kqemu-mod.o: $(src)/kqemu-mod-$(ARCH).o.bin
df1c9a9c 200 cp $< $@
0d2efd95 201EOF
80bac37e
ER
202cd -
203%endif
204
80bac37e
ER
205%build
206%if %{with kernel}
207cd kqemu-%{kqemu_version}
59d7e27b 208%build_kernel_modules -m kqemu <<'EOF'
bd6addfd 209if grep -q "CONFIG_PREEMPT_RT" o/.config; then
59d7e27b 210 sed 's/SPIN_LOCK_UNLOCKED/SPIN_LOCK_UNLOCKED(kqemu_lock)/' \
211 kqemu-linux.c.orig > kqemu-linux.c
212else
213 cat kqemu-linux.c.orig > kqemu-linux.c
214fi
215EOF
8bb1261c 216cd -
4b0669f5 217%endif
a62a2d89 218
8bb1261c 219%if %{with userspace}
c3048014 220# --extra-cflags don't work (overridden by CFLAGS in Makefile*)
0b920c52 221# they can be passed if the cflags_passing bcond is used
8bd2aee2 222./configure \
223 --prefix=%{_prefix} \
e900aba9
AM
224 --cc="%{__ucc}" \
225 --host-cc="%{__ucc}" \
c33439fc 226 --make="%{__make}" \
a64911c4 227%if %{without kqemu}
8d073aaa
ER
228 --disable-kqemu \
229%endif
21c5c008 230 --enable-alsa \
80bac37e 231 --interp-prefix=%{_libdir}/%{pname}
8bb1261c 232%{__make}
4b0669f5 233%endif
cd19124e 234
235%install
236rm -rf $RPM_BUILD_ROOT
5a2da1d0 237
8bb1261c 238%if %{with userspace}
cd19124e 239%{__make} install \
240 DESTDIR=$RPM_BUILD_ROOT
ac6e5743 241
a91fea76 242install -d $RPM_BUILD_ROOT%{_sysconfdir}
243cat <<'EOF' > $RPM_BUILD_ROOT%{_sysconfdir}/qemu-ifup
ac6e5743 244#!/bin/sh
a91fea76 245
ac6e5743 246EOF
8bb1261c 247%endif
cd19124e 248
8bb1261c 249%if %{with kernel}
80bac37e 250%install_kernel_modules -m kqemu-%{kqemu_version}/kqemu -d misc
c33439fc 251install -d $RPM_BUILD_ROOT/etc/{modprobe.d/%{_kernel_ver}{,smp},udev/rules.d}
c33439fc 252install modprobe.conf $RPM_BUILD_ROOT/etc/modprobe.d/%{_kernel_ver}/kqemu.conf
c33439fc 253install udev.conf $RPM_BUILD_ROOT/etc/udev/rules.d/kqemu.rules
4b0669f5 254%endif
a62a2d89 255
c33439fc
ER
256# already packaged
257rm -rf $RPM_BUILD_ROOT%{_docdir}/qemu/qemu-{doc,tech}.html
258
cd19124e 259%clean
260rm -rf $RPM_BUILD_ROOT
261
2dad6a94 262%if %{with kernel}
8bb1261c 263%post
80bac37e 264%banner %{pname} -e <<EOF
8bb1261c 265To enable qemu accelerator (kqemu), the kqemu kernel module must be loaded:
4b0669f5 266modprobe kqemu
267EOF
268%endif
269
59d7e27b 270%post -n kernel%{_alt_kernel}-misc-kqemu
8bb1261c
KK
271%depmod %{_kernel_ver}
272
59d7e27b 273%postun -n kernel%{_alt_kernel}-misc-kqemu
8bb1261c
KK
274%depmod %{_kernel_ver}
275
8bb1261c 276%if %{with userspace}
cd19124e 277%files
278%defattr(644,root,root,755)
867764ba 279%doc README qemu-doc.html qemu-tech.html
a91fea76 280%attr(755,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/qemu-ifup
003e2129 281%attr(755,root,root) %{_bindir}/*
282%{_datadir}/qemu
cd19124e 283%{_mandir}/man1/qemu.1*
867764ba 284%{_mandir}/man1/qemu-img.1*
8bb1261c
KK
285%endif
286
287%if %{with kernel}
59d7e27b 288%files -n kernel%{_alt_kernel}-misc-kqemu
8bb1261c 289%defattr(644,root,root,755)
80bac37e 290%doc kqemu-%{kqemu_version}/LICENSE
c33439fc 291%config(noreplace) %verify(not md5 mtime size) /etc/udev/rules.d/kqemu.rules
bfcb25b9 292%config(noreplace) %verify(not md5 mtime size) /etc/modprobe.d/%{_kernel_ver}/kqemu.conf
b0b3ca8d 293/lib/modules/%{_kernel_ver}/misc/kqemu.ko*
8bb1261c 294%endif
This page took 2.635573 seconds and 4 git commands to generate.