kvm: qemu: fix double removal of assigned device
[kvm-userspace.git] / kvm.spec
blob92acb0ed2387392a3070da49e78da5b6578b829d
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 ia64
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-x&VT-i 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 %ifarch i386 x86_64
86 make extboot
87 %endif
88 #(cd qemu;
89 # ./co
90 # kpath="$(readlink -f ../kernel/include)"
91 # upath="$(readlink -f ../user)"
92 # ./configure --target-list=$(uname -i)-softmmu \
93 # --extra-cflags="-I$kpath -I$upath" \
94 # --extra-ldflags="-L$upath" \
95 # --disable-kqemu --enable-kvm --prefix=/usr/kvm
97 make -C qemu
98 %endif
100 %install
102 %if !%{_prebuilt}
103 cd ..
104 %else
105 cd %{objdir}
106 %endif
108 make DESTDIR=%{buildroot} install-rpm
110 %define bindir /usr/bin
111 %define bin %{bindir}/kvm
112 %define initdir /etc/init.d
113 %define confdir /etc/kvm
114 %define utilsdir /etc/kvm/utils
116 %post
117 /sbin/chkconfig --add kvm
118 /sbin/chkconfig --level 2345 kvm on
119 /sbin/chkconfig --level 16 kvm off
120 /usr/sbin/groupadd -fg 444 kvm
122 %preun
123 if [ "$1" != 0 ]; then
124 /sbin/service kvm stop
125 /sbin/chkconfig --level 2345 kvm off
126 /sbin/chkconfig --del kvm
129 %clean
130 %{__rm} -rf %{buildroot}
132 %files
133 /usr/bin/kvm
134 /usr/bin/kvm_stat
135 %{confdir}/qemu-ifup
136 %{initdir}/kvm
137 /etc/udev/rules.d/*kvm*.rules
138 /usr/kvm
139 %changelog