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