]> git.pld-linux.org Git - packages/qemu.git/blame - qemu.spec
- updated url
[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)
63dabd29 11# Note that gcc4 build is very problematic and not supported by qemu team
cfa8e5c4 12%bcond_with gcc4 # use gcc4 patches (broke build on gcc33)
8bb1261c 13%bcond_without dist_kernel # without distribution kernel
b337f190 14%bcond_without kernel # build kqemu KERNEL MODULES
dc54e1a6 15%bcond_without userspace # don't build userspace utilities
007877cb 16
007877cb
ER
17# no kernel kqemu module for ppc
18%ifarch ppc
19%undefine with_kqemu
20%undefine with_kernel
21%endif
22
942ea5b0
ER
23%if %{without kernel}
24%undefine with_dist_kernel
25%endif
80bac37e
ER
26%if "%{_alt_kernel}" != "%{nil}"
27%undefine with_userspace
28%endif
942ea5b0
ER
29%if %{without userspace}
30# nothing to be placed to debuginfo package
31%define _enable_debug_packages 0
32%endif
33
34%define rel 9
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
54Patch4: %{pname}-gcc4_x86.patch
55Patch5: %{pname}-gcc4_ppc.patch
56Patch6: %{pname}-nosdlgui.patch
81a493f2 57# Proof of concept, for reference, do not remove
80bac37e 58Patch8: %{pname}-kde_virtual_workspaces_hack.patch
e05988b9 59# http://gwenole.beauchesne.info/en/projects/qemu
80bac37e
ER
60Patch9: %{pname}-0.8.0-gcc4-hacks.patch
61Patch11: %{pname}-0.7.2-gcc4-opts.patch
62#Patch12: %{pname}-0.7.2-dyngen-check-stack-clobbers.patch
63Patch13: %{pname}-dosguest.patch
c9c22e78
ER
64Patch14: %{pname}-ppc_old_binutils.patch
65Patch15: %{pname}-isa-bios-ram.patch
66# below one fixes problems with passing ram size to bios/bootloader
67# which affects coreboot/linuxbios
68Patch16: %{pname}-piix-ram-size.patch
c4b12b8b
ER
69Patch17: %{pname}-CVE-2008-0928.patch
70Patch18: %{pname}-CVE-2008-2004.patch
a05bb760 71URL: http://bellard.org/qemu/
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
21c5c008 79%{!?with_gcc4:BuildRequires: gcc < 5:4.0}
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
27439af0 147%if %{with gcc4}
e05988b9 148%patch9 -p1
e05988b9 149%patch11 -p1
b337f190 150#%patch12 -p1
e05988b9 151#%patch4 -p0
8d073aaa 152%patch5 -p1
27439af0 153%endif
8d073aaa 154%{?with_nosdlgui:%patch6 -p1}
81a493f2 155#%patch8 -p1
0b920c52
156
157%{__sed} -i -e 's/sdl_static=yes/sdl_static=no/' configure
8bb1261c 158%{__sed} -i 's/.*MAKE) -C kqemu$//' Makefile
cd19124e 159
c3048014 160# cannot use optflags on x86 - they cause "no register to spill" errors
0b920c52
161%if %{with cflags_passing}
162%{__sed} -i -e 's/-Wall -O2 -g/-Wall %{rpmcflags}/' Makefile Makefile.target
57d8430f
KK
163%else
164%{__sed} -i 's/-Wall -O2 -g/-Wall -O2/' Makefile Makefile.target
0b920c52 165%endif
c3048014 166
2dad6a94 167%if %{with kernel}
80bac37e 168echo -n > kqemu-%{kqemu_version}/install.sh
c33439fc
ER
169
170cat <<'EOF' > modprobe.conf
171# enable dynamic major
172options kqemu major=0
173# for autoloading from static dev
174#alias char-major-250 kqemu
175EOF
176
177cat <<'EOF' > udev.conf
178KERNEL=="kqemu", NAME="%k", MODE="0666"
179EOF
0d2efd95 180
c9c22e78
ER
181%if %{with dosguest}
182%patch13 -p1
183%endif
184%patch14 -p1
185%patch15 -p1
186%patch16 -p1
c4b12b8b
ER
187%patch17 -p2
188%patch18 -p0
c9c22e78 189
80bac37e 190cd kqemu-%{kqemu_version}
c1e4b9fd
ER
191%{__sed} -i 's#include ../config-host.mak##' ./common/Makefile
192%ifarch %{x8664}
193%{__sed} -i 's/^#ARCH=x86_64/ARCH=x86_64/' ./common/Makefile
c9c22e78 194%{__make} -C common -j1
0d2efd95 195mv -f kqemu-mod-x86_64.o{,.bin}
c1e4b9fd
ER
196%else
197%{__sed} -i 's/^#ARCH=i386/ARCH=i386/' ./common/Makefile
c9c22e78 198%{__make} -C common -j1
c1e4b9fd
ER
199mv -f kqemu-mod-i386.o{,.bin}
200%endif
201
35648466 202mv -f kqemu-linux.c{,.orig}
0d2efd95 203cat > Makefile <<'EOF'
204obj-m := kqemu.o
205kqemu-objs:= kqemu-linux.o kqemu-mod.o
206
207$(obj)/kqemu-mod.o: $(src)/kqemu-mod-$(ARCH).o.bin
df1c9a9c 208 cp $< $@
0d2efd95 209EOF
80bac37e
ER
210cd -
211%endif
212
80bac37e
ER
213%build
214%if %{with kernel}
215cd kqemu-%{kqemu_version}
59d7e27b 216%build_kernel_modules -m kqemu <<'EOF'
bd6addfd 217if grep -q "CONFIG_PREEMPT_RT" o/.config; then
59d7e27b 218 sed 's/SPIN_LOCK_UNLOCKED/SPIN_LOCK_UNLOCKED(kqemu_lock)/' \
219 kqemu-linux.c.orig > kqemu-linux.c
220else
221 cat kqemu-linux.c.orig > kqemu-linux.c
222fi
223EOF
8bb1261c 224cd -
4b0669f5 225%endif
a62a2d89 226
8bb1261c 227%if %{with userspace}
c3048014 228# --extra-cflags don't work (overridden by CFLAGS in Makefile*)
0b920c52 229# they can be passed if the cflags_passing bcond is used
8bd2aee2 230./configure \
231 --prefix=%{_prefix} \
867764ba 232 --cc="%{__cc}" \
c33439fc
ER
233 --host-cc="%{__cc}" \
234 --make="%{__make}" \
a64911c4 235%if %{without kqemu}
8d073aaa
ER
236 --disable-kqemu \
237%endif
21c5c008 238 %{?with_gcc4:--disable-gcc-check} \
21c5c008 239 --enable-alsa \
80bac37e 240 --interp-prefix=%{_libdir}/%{pname}
8bb1261c 241%{__make}
4b0669f5 242%endif
cd19124e 243
244%install
245rm -rf $RPM_BUILD_ROOT
5a2da1d0 246
8bb1261c 247%if %{with userspace}
cd19124e 248%{__make} install \
249 DESTDIR=$RPM_BUILD_ROOT
ac6e5743 250
a91fea76 251install -d $RPM_BUILD_ROOT%{_sysconfdir}
252cat <<'EOF' > $RPM_BUILD_ROOT%{_sysconfdir}/qemu-ifup
ac6e5743 253#!/bin/sh
a91fea76 254
ac6e5743 255EOF
8bb1261c 256%endif
cd19124e 257
8bb1261c 258%if %{with kernel}
80bac37e 259%install_kernel_modules -m kqemu-%{kqemu_version}/kqemu -d misc
c33439fc 260install -d $RPM_BUILD_ROOT/etc/{modprobe.d/%{_kernel_ver}{,smp},udev/rules.d}
c33439fc 261install modprobe.conf $RPM_BUILD_ROOT/etc/modprobe.d/%{_kernel_ver}/kqemu.conf
c33439fc 262install udev.conf $RPM_BUILD_ROOT/etc/udev/rules.d/kqemu.rules
4b0669f5 263%endif
a62a2d89 264
c33439fc
ER
265# already packaged
266rm -rf $RPM_BUILD_ROOT%{_docdir}/qemu/qemu-{doc,tech}.html
267
cd19124e 268%clean
269rm -rf $RPM_BUILD_ROOT
270
2dad6a94 271%if %{with kernel}
8bb1261c 272%post
80bac37e 273%banner %{pname} -e <<EOF
8bb1261c 274To enable qemu accelerator (kqemu), the kqemu kernel module must be loaded:
4b0669f5 275modprobe kqemu
276EOF
277%endif
278
59d7e27b 279%post -n kernel%{_alt_kernel}-misc-kqemu
8bb1261c
KK
280%depmod %{_kernel_ver}
281
59d7e27b 282%postun -n kernel%{_alt_kernel}-misc-kqemu
8bb1261c
KK
283%depmod %{_kernel_ver}
284
8bb1261c 285%if %{with userspace}
cd19124e 286%files
287%defattr(644,root,root,755)
867764ba 288%doc README qemu-doc.html qemu-tech.html
a91fea76 289%attr(755,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/qemu-ifup
003e2129 290%attr(755,root,root) %{_bindir}/*
291%{_datadir}/qemu
cd19124e 292%{_mandir}/man1/qemu.1*
867764ba 293%{_mandir}/man1/qemu-img.1*
8bb1261c
KK
294%endif
295
296%if %{with kernel}
59d7e27b 297%files -n kernel%{_alt_kernel}-misc-kqemu
8bb1261c 298%defattr(644,root,root,755)
80bac37e 299%doc kqemu-%{kqemu_version}/LICENSE
c33439fc 300%config(noreplace) %verify(not md5 mtime size) /etc/udev/rules.d/kqemu.rules
bfcb25b9 301%config(noreplace) %verify(not md5 mtime size) /etc/modprobe.d/%{_kernel_ver}/kqemu.conf
b0b3ca8d 302/lib/modules/%{_kernel_ver}/misc/kqemu.ko*
8bb1261c 303%endif
This page took 0.120171 seconds and 4 git commands to generate.