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