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