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