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