kvm: qemu: add fls()
[kvm-userspace.git] / kvm.spec
blobaf8271e29b9e8d477c81f05d7461b96a8e7927e9
1 Name: kvm
2 Version: 0.0
3 Release: 0
4 Summary: Kernel Virtual Machine virtualization environment
6 Group: System Environment/Kernel
7 License: GPL
8 URL: http://www.qumranet.com
9 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
11 ExclusiveArch: i386 x86_64
13 Requires: kvm-kmod bridge-utils
15 %define Distribution %(rpm -q -qf /etc/redhat-release --qf '%%{name}' | cut -d"-" -f 1)
16 %define os_version %(rpm -q --qf '%%{version}' %{Distribution}-release)
17 %define os_release %(rpm -q --qf '%%{release}' %{Distribution}-release | cut -d"." -f 1)
19 %if %([ x"%{Distribution}" = x"fedora" -a x"%{os_version}" = x"5" ] && echo 1 || echo 0)
20 %define require_gccver 32
21 %endif
23 %if %([ x"%{Distribution}" = x"fedora" -a 0"%{os_version}" -ge "8" ] && echo 1 || echo 0)
24 %define qemuldflags --qemu-ldflags=-Wl,--build-id
25 %else
26 %define qemuldflags ""
27 %endif
29 %if %([ x"%{Distribution}" = x"centos" -a x"%{os_version}" = x"4" ] && echo 1 || echo 0)
30 %define require_gccver 32
31 %endif
33 %if %([ x"%{Distribution}" = x"redhat" -a x"%{os_release}" = x"5" ] && echo 1 || echo 0)
34 %define require_gccver 34
35 %endif
37 %if %( [ x"%{require_gccver}" = x"32" ] && echo 1 || echo 0)
38 BuildRequires: compat-gcc-32
39 %else
40 BuildRequires: compat-gcc-34
41 %endif
43 BuildRequires: SDL-devel zlib-devel alsa-lib-devel
45 %define _prebuilt %{?prebuilt:1}%{!?prebuilt:0}
47 %if !%{_prebuilt}
48 Source0: kvm.tar.gz
49 Source1: user.tar.gz
50 Source2: kernel.tar.gz
51 Source3: scripts.tar.gz
52 Source4: Makefile
53 Source5: configure
54 Source6: kvm_stat
55 Source7: libkvm.tar.gz
56 Source8: extboot.tar.gz
57 %endif
59 %description
60 The Kernel Virtual Machine provides a virtualization enviroment for processors
61 with hardware support for virtualization: Intel's VT and AMD's AMD-V.
63 %prep
65 %if !%{_prebuilt}
66 %setup -T -b 0 -n qemu
67 %setup -T -b 1 -n user -D
68 %setup -T -b 2 -n kernel -D
69 %setup -T -b 7 -n libkvm -D
70 %setup -T -b 3 -n scripts -D
71 %setup -T -b 8 -n extboot -D
72 cd ..
73 cp %{_sourcedir}/Makefile %{_sourcedir}/configure %{_sourcedir}/kvm_stat .
74 %endif
76 %build
78 rm -rf %{buildroot}
80 %if !%{_prebuilt}
81 cd ..
82 ./configure --prefix=/usr/kvm %{qemuldflags}
83 make -C libkvm
84 make -C user
85 make extboot
86 #(cd qemu;
87 # ./co
88 # kpath="$(readlink -f ../kernel/include)"
89 # upath="$(readlink -f ../user)"
90 # ./configure --target-list=$(uname -i)-softmmu \
91 # --extra-cflags="-I$kpath -I$upath" \
92 # --extra-ldflags="-L$upath" \
93 # --disable-kqemu --enable-kvm --prefix=/usr/kvm
95 make -C qemu
96 %endif
98 %install
100 %if !%{_prebuilt}
101 cd ..
102 %else
103 cd %{objdir}
104 %endif
106 make DESTDIR=%{buildroot} install-rpm
108 %define bindir /usr/bin
109 %define bin %{bindir}/kvm
110 %define initdir /etc/init.d
111 %define confdir /etc/kvm
112 %define utilsdir /etc/kvm/utils
114 %post
115 /sbin/chkconfig --add kvm
116 /sbin/chkconfig --level 2345 kvm on
117 /sbin/chkconfig --level 16 kvm off
118 /usr/sbin/groupadd -fg 444 kvm
120 %preun
121 if [ "$1" != 0 ]; then
122 /sbin/service kvm stop
123 /sbin/chkconfig --level 2345 kvm off
124 /sbin/chkconfig --del kvm
127 %clean
128 %{__rm} -rf %{buildroot}
130 %files
131 /usr/bin/kvm
132 /usr/bin/kvm_stat
133 %{confdir}/qemu-ifup
134 %{initdir}/kvm
135 /etc/udev/rules.d/*kvm*.rules
136 /usr/kvm
137 %changelog