]> git.pld-linux.org Git - packages/qemu.git/blob - qemu.spec
- separated kernel modules + bconds
[packages/qemu.git] / qemu.spec
1 #
2 # TODO:
3 # - wait till the gcc bug http://gcc.gnu.org/PR16185 is fixed.
4 #
5 # Conditional build:
6 %bcond_with     kqemu                   # with QEMU accelerator module
7 %bcond_with     cflags_passing          # with passing rpmcflags to Makefiles
8 %bcond_with     nosdlgui                # do not use SDL gui (use X11 instead)
9 %bcond_without  dist_kernel             # without distribution kernel
10 %bcond_without  kernel                  # don't build kernel modules
11 %bcond_without  smp                     # don't build SMP module
12 %bcond_without  userspace               # don't build userspace utilities
13 #
14 Summary:        QEMU CPU Emulator
15 Summary(pl):    QEMU - emulator procesora
16 Name:           qemu
17 Version:        0.7.1
18 %define         _rel    1
19 Release:        %{_rel}%{?with_kqemu:k}
20 License:        GPL
21 Group:          Applications/Emulators
22 #Source0Download: http://fabrice.bellard.free.fr/qemu/download.html
23 Source0:        http://fabrice.bellard.free.fr/qemu/%{name}-%{version}.tar.gz
24 # Source0-md5:  b0c80d2c082049a5b8ccbc7f55fe165b
25 %if %{with kqemu}
26 Source1:        http://fabrice.bellard.free.fr/qemu/kqemu-%{version}-1.tar.gz
27 # NoSource1-md5:        012498dac620eb8c212bf5f622414dd0
28 NoSource:       1
29 %endif
30 Patch0:         %{name}-nostatic.patch
31 Patch1:         %{name}-DESTDIR.patch
32 Patch2:         %{name}-longjmp.patch
33 Patch3:         %{name}-dot.patch
34 Patch4:         %{name}-initrd_load_addr.patch
35 Patch5:         %{name}-gcc4_x86.patch
36 Patch6:         %{name}-gcc4_ppc.patch
37 Patch7:         %{name}-parallel.patch
38 Patch8:         %{name}-nosdlgui.patch
39 URL:            http://fabrice.bellard.free.fr/qemu/
40 BuildRequires:  SDL-devel >= 1.2.1
41 %if %{with kqemu} && %{with dist_kernel}
42 BuildRequires:  kernel-module-build >= 2.6.7
43 %endif
44 BuildRequires:  rpmbuild(macros) >= 1.217
45 BuildRequires:  sed >= 4.0
46 Requires:       SDL >= 1.2.1
47 ExclusiveArch:  %{ix86} %{x8664} ppc
48 # sparc is currently unsupported (missing cpu_get_real_ticks() impl in vl.c)
49 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
50
51 # some SPARC boot image in ELF format
52 %define         _noautostrip    .*%{_datadir}/qemu/proll.elf
53
54 %if !%{with kqemu}
55 %undefine       with_kernel
56 %endif
57
58 %description
59 QEMU is a FAST! processor emulator. By using dynamic translation it
60 achieves a reasonnable speed while being easy to port on new host
61 CPUs. QEMU has two operating modes:
62
63 - User mode emulation. In this mode, QEMU can launch Linux processes
64   compiled for one CPU on another CPU. Linux system calls are converted
65   because of endianness and 32/64 bit mismatches. Wine (Windows
66   emulation) and DOSEMU (DOS emulation) are the main targets for QEMU.
67
68 - Full system emulation. In this mode, QEMU emulates a full system,
69   including a processor and various peripherials. 
70   It can also be used to provide virtual hosting of several 
71   virtual PC on a single server.
72
73 %description -l pl
74 QEMU to szybki(!) emulator procesora. Poprzez u¿ycie dynamicznego
75 t³umaczenia osi±ga rozs±dn± szybko¶æ i jest ³atwy do przeportowania,
76 aby dzia³a³ na kolejnych procesorach. QEMU ma dwa tryby pracy:
77
78 - Emulacja trybu u¿ytkownika. W tym trybie QEMU mo¿e uruchamiaæ
79   procesy linuksowe skompilowane dla jednego procesora na innym
80   procesorze. Linuksowe wywo³ania systemowe s± t³umaczone ze wzglêdu
81   na niezgodno¶æ kolejno¶ci bajtów w s³owie i 32/64-bitowego rozmiaru
82   s³owa. Wine (emulacja Windows) i DOSEMU (emulacja DOS-a) to g³ówne
83   cele QEMU.
84
85 - Pe³na emulacja systemu. W tym trybie QEMU emuluje ca³y system,
86   w³±czaj±c w to procesor i ró¿ne urz±dzenia peryferyjne.
87   Mo¿e byæ tak¿e u¿ywane do wirtualnego hostowania kilku wirtualnych 
88   pecetów na pojedynczym serwerze.
89
90 %package -n kernel-misc-kqemu
91 Summary:        kqemu - kernel module
92 Summary(pl):    kqemu - modu³ j±dra
93 Release:        %{_rel}@%{_kernel_ver_str}
94 Group:          Base/Kernel
95 %{?with_dist_kernel:%requires_releq_kernel_up}
96 Requires(post,postun):  /sbin/depmod
97
98 %description -n kernel-misc-kqemu
99 kqemu - kernel module.
100
101 %description -n kernel-misc-kqemu -l pl
102 kqemu - modu³ j±dra.
103
104 %package -n kernel-smp-misc-kqemu
105 Summary:        kqemu - SMP kernel module
106 Summary(pl):    kqemu - modu³ j±dra SMP
107 Release:        %{_rel}@%{_kernel_ver_str}
108 Group:          Base/Kernel
109 %{?with_dist_kernel:%requires_releq_kernel_up}
110 Requires(post,postun):  /sbin/depmod
111
112 %description -n kernel-smp-misc-kqemu
113 kqemu - SMP kernel module.
114
115 %description -n kernel-smp-misc-kqemu -l pl
116 kqemu - modu³ j±dra SMP.
117
118 %prep
119 %setup -q %{?with_kqemu:-a1}
120 %patch0 -p1
121 %patch1 -p1
122 %patch2 -p1
123 %patch3 -p1
124 %patch4 -p1
125 %patch5 -p0
126 %patch6 -p1
127 %patch7 -p1
128 %{?with_nosdlgui:%patch8 -p1}
129
130 %{__sed} -i -e 's/sdl_static=yes/sdl_static=no/' configure
131 %{__sed} -i 's/.*MAKE) -C kqemu$//' Makefile
132
133 # cannot use optflags on x86 - they cause "no register to spill" errors
134 %if %{with cflags_passing}
135 %{__sed} -i -e 's/-Wall -O2 -g/-Wall %{rpmcflags}/' Makefile Makefile.target
136 %endif
137
138 %{?with_kqemu:echo -n > kqemu/install.sh}
139
140 %build
141 %if %{with kernel}
142 cd kqemu
143 for cfg in %{?with_dist_kernel:%{?with_smp:smp} up}%{!?with_dist_kernel:nondist}; do
144         if [ ! -r "%{_kernelsrcdir}/config-$cfg" ]; then
145                 exit 1
146         fi
147         rm -rf include
148         install -d include/{linux,config}
149         ln -sf %{_kernelsrcdir}/config-$cfg .config
150         ln -sf %{_kernelsrcdir}/include/linux/autoconf-$cfg.h include/linux/autoconf.h
151         ln -sf %{_kernelsrcdir}/include/asm-%{_target_base_arch} include/asm
152 %if %{without dist_kernel}
153         ln -sf %{_kernelsrcdir}/scripts
154 %endif
155         touch include/config/MARKER
156         %{__make} -C %{_kernelsrcdir} clean \
157                 RCS_FIND_IGNORE="-name 'kqemu-mod-*.*' -o" \
158                 M=$PWD O=$PWD
159         %{__make} -C %{_kernelsrcdir} modules \
160                 M=$PWD O=$PWD
161         mv kqemu.ko kqemu-mod-$cfg.ko
162 done
163 cd -
164 %endif
165
166 %if %{with userspace}
167 # --extra-cflags don't work (overridden by CFLAGS in Makefile*)
168 # they can be passed if the cflags_passing bcond is used
169 ./configure \
170         --prefix=%{_prefix} \
171         --cc="%{__cc}" \
172         %{!?with_kqemu:--disable-kqemu} \
173         --make="%{__make}"
174 %{__make}
175 %endif
176
177 %install
178 rm -rf $RPM_BUILD_ROOT
179
180 %if %{with userspace}
181 %{__make} install \
182         DESTDIR=$RPM_BUILD_ROOT
183 %endif
184
185 %if %{with kernel}
186 install -d $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}{,smp}/misc
187 install kqemu/kqemu-mod-up.ko $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/misc/kqemu.ko
188 %if %{with smp} && %{with dist_kernel}
189 install kqemu/kqemu-mod-smp.ko $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}smp/misc/kqemu.ko
190 %endif
191 %endif
192
193 # This dir is unneeded
194 rm -rf $RPM_BUILD_ROOT/usr/share/doc/qemu
195
196 %clean
197 rm -rf $RPM_BUILD_ROOT
198
199 %if %{with kqemu}
200 %post
201 %banner %{name} -e << EOF
202 To enable qemu accelerator (kqemu), the kqemu kernel module must be loaded:
203 modprobe kqemu
204 EOF
205 %endif
206
207 %post   -n kernel-misc-kqemu
208 %depmod %{_kernel_ver}
209
210 %postun -n kernel-misc-kqemu
211 %depmod %{_kernel_ver}
212
213 %post   -n kernel-smp-misc-kqemu
214 %depmod %{_kernel_ver}smp
215
216 %postun -n kernel-smp-misc-kqemu
217 %depmod %{_kernel_ver}smp
218
219
220 %if %{with userspace}
221 %files
222 %defattr(644,root,root,755)
223 %doc README qemu-doc.html qemu-tech.html
224 %attr(755,root,root) %{_bindir}/*
225 %{_datadir}/qemu
226 %{_mandir}/man1/qemu.1*
227 %{_mandir}/man1/qemu-img.1*
228 # FIXME: maybe better moved this into dev.spec
229 %if %{with kqemu}
230 %dev(c,250,0) %attr(666,root,root) /dev/kqemu
231 %endif
232 %endif
233
234 %if %{with kernel}
235 %files -n kernel-misc-kqemu
236 %defattr(644,root,root,755)
237 /lib/modules/%{_kernel_ver}/misc/kqemu.ko*
238
239 %if %{with smp} && %{with dist_kernel}
240 %files -n kernel-smp-misc-kqemu
241 %defattr(644,root,root,755)
242 /lib/modules/%{_kernel_ver}smp/misc/kqemu.ko*
243 %endif
244 %endif
This page took 0.050581 seconds and 4 git commands to generate.