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