]> git.pld-linux.org Git - packages/qemu.git/blame - qemu.spec
- rel 2
[packages/qemu.git] / qemu.spec
CommitLineData
6aef4654 1#
0b920c52 2# TODO:
98a1a188 3# - update patches
0b920c52 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)
8bb1261c 10%bcond_without dist_kernel # without distribution kernel
b337f190 11%bcond_without kernel # build kqemu KERNEL MODULES
dc54e1a6 12%bcond_without userspace # don't build userspace utilities
007877cb 13
007877cb
ER
14# no kernel kqemu module for ppc
15%ifarch ppc
16%undefine with_kqemu
17%undefine with_kernel
18%endif
19
942ea5b0
ER
20%if %{without kernel}
21%undefine with_dist_kernel
22%endif
80bac37e
ER
23%if "%{_alt_kernel}" != "%{nil}"
24%undefine with_userspace
25%endif
942ea5b0
ER
26%if %{without userspace}
27# nothing to be placed to debuginfo package
28%define _enable_debug_packages 0
29%endif
30
2055a99a 31%define rel 2
e900aba9 32
98a1a188 33%define kqemu_version 1.4.0pre1
dc9f9439 34%define qemu_version 0.11.1
80bac37e 35%define pname qemu
cd19124e 36Summary: QEMU CPU Emulator
eec0535a 37Summary(pl.UTF-8): QEMU - emulator procesora
80bac37e
ER
38Name: %{pname}%{_alt_kernel}
39Version: %{qemu_version}
007877cb 40Release: %{rel}%{?with_kqemu:k}
5a2da1d0
JB
41License: GPL
42Group: Applications/Emulators
c4b12b8b 43# Source0Download: http://fabrice.bellard.free.fr/qemu/download.html
98a1a188 44Source0: http://download.savannah.gnu.org/releases/qemu/%{pname}-%{version}.tar.gz
dc9f9439 45# Source0-md5: 193285b0bcf655a7f7577d05ffcb82b1
98a1a188
AM
46Source1: http://www.nongnu.org/qemu/k%{pname}-%{kqemu_version}.tar.gz
47# Source1-md5: d738d8ca7332211ab716ec3213d82ee1
b99b1652 48Patch0: %{pname}-ncurses.patch
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
b99b1652
AM
67BuildRequires: bluez-libs-devel
68BuildRequires: gnutls-devel
98a1a188 69BuildRequires: ncurses-devel
2fb8ea02 70BuildRequires: perl-tools-pod
ba84a935 71BuildRequires: pkgconfig
8bb1261c 72BuildRequires: sed >= 4.0
a1146336 73BuildRequires: texi2html
74BuildRequires: texinfo-texi2dvi
cad677a4 75BuildRequires: which
ba84a935 76BuildRequires: xorg-lib-libX11-devel
d1ae30a6 77%endif
8bb1261c 78Requires: SDL >= 1.2.1
2ef13cb9 79# sparc is currently unsupported (missing cpu_get_real_ticks() impl in vl.c)
007877cb 80ExclusiveArch: %{ix86} %{x8664} %{?with_userspace:ppc}
cd19124e 81BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
82
98a1a188
AM
83# some PPC/SPARC boot image in ELF format
84%define _noautostrip .*%{_datadir}/qemu/openbios-.*
a154aede 85
cd19124e 86%description
87QEMU is a FAST! processor emulator. By using dynamic translation it
88achieves a reasonnable speed while being easy to port on new host
89CPUs. QEMU has two operating modes:
90
91- User mode emulation. In this mode, QEMU can launch Linux processes
92 compiled for one CPU on another CPU. Linux system calls are converted
93 because of endianness and 32/64 bit mismatches. Wine (Windows
94 emulation) and DOSEMU (DOS emulation) are the main targets for QEMU.
95
96- Full system emulation. In this mode, QEMU emulates a full system,
8799423b
ER
97 including a processor and various peripherials. It can also be used to
98 provide virtual hosting of several virtual PC on a single server.
cd19124e 99
27b30e9c
JR
100%description -l pl.UTF-8
101QEMU to szybki(!) emulator procesora. Poprzez użycie dynamicznego
102tłumaczenia osiąga rozsądną szybkość i jest łatwy do przeportowania,
103aby działał na kolejnych procesorach. QEMU ma dwa tryby pracy:
5a2da1d0 104
27b30e9c 105- Emulacja trybu użytkownika. W tym trybie QEMU może uruchamiać
5a2da1d0 106 procesy linuksowe skompilowane dla jednego procesora na innym
27b30e9c
JR
107 procesorze. Linuksowe wywołania systemowe są tłumaczone ze względu na
108 niezgodność kolejności bajtów w słowie i 32/64-bitowego rozmiaru
109 słowa. Wine (emulacja Windows) i DOSEMU (emulacja DOS-a) to główne
5a2da1d0
JB
110 cele QEMU.
111
27b30e9c
JR
112- Pełna emulacja systemu. W tym trybie QEMU emuluje cały system,
113 włączając w to procesor i różne urządzenia peryferyjne. Może być także
114 używane do wirtualnego hostowania kilku wirtualnych pecetów na
8799423b 115 pojedynczym serwerze.
5a2da1d0 116
59d7e27b 117%package -n kernel%{_alt_kernel}-misc-kqemu
8bb1261c 118Summary: kqemu - kernel module
eec0535a 119Summary(pl.UTF-8): kqemu - moduł jądra
80bac37e 120Version: %{kqemu_version}
007877cb 121Release: %{rel}@%{_kernel_ver_str}
8bb1261c 122Group: Base/Kernel
04d100ab 123%{?with_dist_kernel:%requires_releq_kernel}
8f93639f 124License: GPL v2
04d100ab 125Obsoletes: kernel%{_alt_kernel}-smp-misc-kqemu
8bb1261c 126Requires(post,postun): /sbin/depmod
39b50bf0 127Requires: module-init-tools >= 3.2.2-2
8bb1261c 128
59d7e27b 129%description -n kernel%{_alt_kernel}-misc-kqemu
8bb1261c
KK
130kqemu - kernel module.
131
27b30e9c
JR
132%description -n kernel%{_alt_kernel}-misc-kqemu -l pl.UTF-8
133kqemu - moduł jądra.
8bb1261c 134
cd19124e 135%prep
80bac37e 136%setup -q -n %{pname}-%{qemu_version} %{?with_kernel:-a1}
b99b1652 137%patch0 -p0
8d073aaa 138%{?with_nosdlgui:%patch6 -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}
80bac37e 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
0d2efd95 164
c9c22e78
ER
165%if %{with dosguest}
166%patch13 -p1
167%endif
168%patch14 -p1
98a1a188 169#%patch15 -p1
c9c22e78
ER
170%patch16 -p1
171
80bac37e 172cd kqemu-%{kqemu_version}
c1e4b9fd
ER
173%{__sed} -i 's#include ../config-host.mak##' ./common/Makefile
174%ifarch %{x8664}
175%{__sed} -i 's/^#ARCH=x86_64/ARCH=x86_64/' ./common/Makefile
c9c22e78 176%{__make} -C common -j1
0d2efd95 177mv -f kqemu-mod-x86_64.o{,.bin}
c1e4b9fd
ER
178%else
179%{__sed} -i 's/^#ARCH=i386/ARCH=i386/' ./common/Makefile
c9c22e78 180%{__make} -C common -j1
c1e4b9fd
ER
181mv -f kqemu-mod-i386.o{,.bin}
182%endif
183
35648466 184mv -f kqemu-linux.c{,.orig}
0d2efd95 185cat > Makefile <<'EOF'
186obj-m := kqemu.o
187kqemu-objs:= kqemu-linux.o kqemu-mod.o
188
189$(obj)/kqemu-mod.o: $(src)/kqemu-mod-$(ARCH).o.bin
df1c9a9c 190 cp $< $@
0d2efd95 191EOF
80bac37e
ER
192cd -
193%endif
194
80bac37e
ER
195%build
196%if %{with kernel}
197cd kqemu-%{kqemu_version}
59d7e27b 198%build_kernel_modules -m kqemu <<'EOF'
bd6addfd 199if grep -q "CONFIG_PREEMPT_RT" o/.config; then
59d7e27b 200 sed 's/SPIN_LOCK_UNLOCKED/SPIN_LOCK_UNLOCKED(kqemu_lock)/' \
201 kqemu-linux.c.orig > kqemu-linux.c
202else
203 cat kqemu-linux.c.orig > kqemu-linux.c
204fi
205EOF
8bb1261c 206cd -
4b0669f5 207%endif
a62a2d89 208
8bb1261c 209%if %{with userspace}
c3048014 210# --extra-cflags don't work (overridden by CFLAGS in Makefile*)
0b920c52 211# they can be passed if the cflags_passing bcond is used
8bd2aee2 212./configure \
213 --prefix=%{_prefix} \
98a1a188
AM
214 --cc="%{__cc}" \
215 --host-cc="%{__cc}" \
c33439fc 216 --make="%{__make}" \
a64911c4 217%if %{without kqemu}
8d073aaa
ER
218 --disable-kqemu \
219%endif
b99b1652 220 --enable-mixemu \
98a1a188 221 --audio-drv-list="alsa" \
80bac37e 222 --interp-prefix=%{_libdir}/%{pname}
8bb1261c 223%{__make}
4b0669f5 224%endif
cd19124e 225
226%install
227rm -rf $RPM_BUILD_ROOT
5a2da1d0 228
8bb1261c 229%if %{with userspace}
cd19124e 230%{__make} install \
231 DESTDIR=$RPM_BUILD_ROOT
ac6e5743 232
a91fea76 233install -d $RPM_BUILD_ROOT%{_sysconfdir}
234cat <<'EOF' > $RPM_BUILD_ROOT%{_sysconfdir}/qemu-ifup
ac6e5743 235#!/bin/sh
a91fea76 236
ac6e5743 237EOF
8bb1261c 238%endif
cd19124e 239
8bb1261c 240%if %{with kernel}
80bac37e 241%install_kernel_modules -m kqemu-%{kqemu_version}/kqemu -d misc
c33439fc 242install -d $RPM_BUILD_ROOT/etc/{modprobe.d/%{_kernel_ver}{,smp},udev/rules.d}
c33439fc 243install modprobe.conf $RPM_BUILD_ROOT/etc/modprobe.d/%{_kernel_ver}/kqemu.conf
c33439fc 244install udev.conf $RPM_BUILD_ROOT/etc/udev/rules.d/kqemu.rules
4b0669f5 245%endif
a62a2d89 246
c33439fc
ER
247# already packaged
248rm -rf $RPM_BUILD_ROOT%{_docdir}/qemu/qemu-{doc,tech}.html
249
cd19124e 250%clean
251rm -rf $RPM_BUILD_ROOT
252
2dad6a94 253%if %{with kernel}
8bb1261c 254%post
80bac37e 255%banner %{pname} -e <<EOF
8bb1261c 256To enable qemu accelerator (kqemu), the kqemu kernel module must be loaded:
4b0669f5 257modprobe kqemu
258EOF
259%endif
260
59d7e27b 261%post -n kernel%{_alt_kernel}-misc-kqemu
8bb1261c
KK
262%depmod %{_kernel_ver}
263
59d7e27b 264%postun -n kernel%{_alt_kernel}-misc-kqemu
8bb1261c
KK
265%depmod %{_kernel_ver}
266
8bb1261c 267%if %{with userspace}
cd19124e 268%files
269%defattr(644,root,root,755)
867764ba 270%doc README qemu-doc.html qemu-tech.html
a91fea76 271%attr(755,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/qemu-ifup
003e2129 272%attr(755,root,root) %{_bindir}/*
273%{_datadir}/qemu
cd19124e 274%{_mandir}/man1/qemu.1*
867764ba 275%{_mandir}/man1/qemu-img.1*
98a1a188 276%{_mandir}/man8/qemu-nbd.8*
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.15563 seconds and 4 git commands to generate.