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