libvirt/libvirt.spec

337 lines
10 KiB
RPMSpec

#
# spec file for package libvirt (Version 0.7.1)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
%define with_xen 1
%define with_lxc 0
%define with_selinux 0
# Xen is available only on i386 x86_64
%ifnarch %ix86 x86_64
%define with_xen 0
%endif
%if 0%{?suse_version} > 1100
%define with_lxc 1
%define with_selinux 1
%endif
Name: libvirt
BuildRequires: bridge-utils cyrus-sasl-devel device-mapper-devel fdupes gettext gnutls-devel hal-devel iptables-devel libxml2-devel lvm2 ncurses-devel parted-devel pkg-config python-devel readline-devel util-linux xhtml-dtd
%if %{with_xen}
BuildRequires: xen-devel
%endif
%if 0%{?suse_version} > 1030
BuildRequires: libavahi-devel
%else
BuildRequires: avahi-devel
%endif
%if %{with_selinux}
BuildRequires: libselinux-devel
%endif
%ifarch x86_64 ia64
BuildRequires: libnuma-devel
%endif
%if 0%{?suse_version} > 1110
BuildRequires: polkit >= 0.9
%else
BuildRequires: PolicyKit-devel >= 0.6
%endif
# Only for directory ownership:
BuildRequires: gtk-doc
Url: http://libvirt.org/
License: LGPL v2.1 or later
Group: Development/Libraries/C and C++
AutoReqProv: yes
Version: 0.7.1
Release: 1
Summary: A C toolkit to interract with the virtualization capabilities of Linux
Requires: readline
Requires: ncurses
Requires: bridge-utils
Requires: iptables
Requires: cyrus-sasl
Requires: lvm2
Requires: parted
#Requires: /usr/bin/qemu-img
Recommends: cyrus-sasl-digestmd5
Recommends: logrotate
Requires: dnsmasq
Requires: PolicyKit >= 0.6
Requires: socat
Requires: open-iscsi
Requires: nfs-client
Requires: hal
%if 0%{?suse_version} > 1100
Requires: polkit >= 0.9
%else
Requires: PolicyKit >= 0.6
%endif
Source0: %{name}-%{version}.tar.bz2
Source1: libvirtd.init
# Upstream patches
Patch0: devmap-no-pkgconfig.patch
# Need to go upstream
Patch100: socat.patch
Patch101: clone.patch
Patch102: migrate-params.patch
Patch103: xen-pv-cdrom.patch
Patch104: detach-disk.patch
Patch105: vshdeinit-recurse.patch
Patch106: xen-refcnt.patch
# Our patches
Patch200: libvirtd-defaults.patch
Patch201: suse-network.patch
Patch202: snapshots.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
Libvirt is a C toolkit to interract with the virtualization
capabilities Linux. Virtualization of the Linux Operating System means
the ability to run multiple instances of Operating Systems concurently
on a single hardware system where the basic resources are driven by a
Linux instance. The library aims to provide long term stable C API
initially for the Xen paravirtualization but should be able to
integrate other virtualization mechanisms if needed.
Authors:
--------
Daniel Veillard <veillard@redhat.com>
Karel Zak <kzak@redhat.com>
%package devel
License: LGPL v2.1 or later
Summary: A C toolkit to interract with the virtualization capabilities of Linux
Group: Development/Libraries/C and C++
Requires: %{name} = %{version} libxml2-devel
%if %{with_xen}
Requires: xen-devel
Requires: pkg-config
%endif
%description devel
Libvirt is a C toolkit to interract with the virtualization
capabilities Linux. Virtualization of the Linux Operating System means
the ability to run multiple instances of Operating Systems concurently
on a single hardware system where the basic resources are driven by a
Linux instance. The library aims to provide long term stable C API
initially for the Xen paravirtualization but should be able to
integrate other virtualization mechanisms if needed.
Authors:
--------
Daniel Veillard <veillard@redhat.com>
Karel Zak <kzak@redhat.com>
%package doc
License: LGPL v2.1 or later
Summary: A C toolkit to interract with the virtualization capabilities of Linux
Group: Development/Libraries/C and C++
Requires: %{name} = %{version}
%description doc
Libvirt is a C toolkit to interract with the virtualization
capabilities Linux. Virtualization of the Linux Operating System means
the ability to run multiple instances of Operating Systems concurently
on a single hardware system where the basic resources are driven by a
Linux instance. The library aims to provide long term stable C API
initially for the Xen paravirtualization but should be able to
integrate other virtualization mechanisms if needed.
Authors:
--------
Daniel Veillard <veillard@redhat.com>
Karel Zak <kzak@redhat.com>
%package python
License: LGPL v2.1 or later
Summary: A C toolkit to interract with the virtualization capabilities of Linux
Group: Development/Libraries/C and C++
Requires: %{name} = %{version}
%py_requires
%description python
Libvirt is a C toolkit to interract with the virtualization
capabilities Linux. Virtualization of the Linux Operating System means
the ability to run multiple instances of Operating Systems concurently
on a single hardware system where the basic resources are driven by a
Linux instance. The library aims to provide long term stable C API
initially for the Xen paravirtualization but should be able to
integrate other virtualization mechanisms if needed.
Authors:
--------
Daniel Veillard <veillard@redhat.com>
Karel Zak <kzak@redhat.com>
%prep
%setup -q
%patch0 -p1
%patch100 -p1
%patch101
%patch102 -p1
%patch103 -p1
%patch104 -p1
%patch105 -p1
%patch106 -p1
%patch200 -p1
%patch201 -p1
%patch202 -p1
%build
%if ! %{with_xen}
%define _without_xen --without-xen
%endif
%if ! %{with_lxc}
%define _without_lxc --without-lxc
%endif
%if %{with_selinux}
%define _with_selinux --with-selinux
%endif
autoreconf -f -i
export CFLAGS="$RPM_OPT_FLAGS"
%configure --disable-static --with-pic \
%{?_without_xen} \
%{?_without_lxc} \
%{?_with_selinux} \
--libexecdir=%{_libdir}/%{name} \
--with-init-script=none \
--with-remote-pid-file=%{_localstatedir}/run/libvirtd.pid \
--with-xen-proxy=no \
ac_cv_path_DNSMASQ=/usr/sbin/dnsmasq \
ac_cv_path_QEMU_IMG=/usr/bin/qemu-img-xen \
ac_cv_path_ISCSIADM=/sbin/iscsiadm \
ac_cv_path_MODPROBE=/sbin/modprobe \
ac_cv_path_UDEVADM=/sbin/udevadm \
ac_cv_path_SHOWMOUNT=/usr/sbin/showmount
make %{?jobs:-j%jobs} DOCS_DIR=%{_docdir}/%{name}-python EXAMPLE_DIR=%{_docdir}/%{name}-python/examples HTML_DIR=%{_docdir}/%{name}
%install
%makeinstall DOCS_DIR=%{_docdir}/%{name}-python EXAMPLE_DIR=%{_docdir}/%{name}-python/examples HTML_DIR=%{_docdir}/%{name}
cp -a AUTHORS ChangeLog COPYING NEWS README TODO $RPM_BUILD_ROOT%{_docdir}/%{name}/
cd docs ; cp -a *.html $RPM_BUILD_ROOT%{_docdir}/%{name} ; cp -a *.png $RPM_BUILD_ROOT%{_docdir}/%{name} ; cd ..
# remove currently unsupported locale(s)
rm -rf $RPM_BUILD_ROOT/usr/share/locale/sr@latin
# don't autostart the default network
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/autostart/default.xml
mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/run/libvirt
mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/libvirt
rm $RPM_BUILD_ROOT%{_docdir}/%{name}/{*.c,examples.x*}
rm $RPM_BUILD_ROOT%{_libdir}/*.*a $RPM_BUILD_ROOT%{py_sitedir}/*.*a
ln_dupes()
{
target=""
fdupes -r "$1" | while read file; do
if [ -z "$file" ] || [ -z "$target" ]; then
target="$file"
continue
fi
ln -sf "${target#.}" "$file"
done
}
(
cd $RPM_BUILD_ROOT
ln_dupes .%{_docdir}/%{name}
ln_dupes ./usr/share/locale
)
# init script
mkdir -p $RPM_BUILD_ROOT/etc/init.d
install %SOURCE1 $RPM_BUILD_ROOT/etc/init.d/libvirtd
ln -s /etc/init.d/libvirtd $RPM_BUILD_ROOT/usr/sbin/rclibvirtd
%find_lang %{name}
%clean
rm -rf $RPM_BUILD_ROOT
%post -p /sbin/ldconfig
%preun
%stop_on_removal libvirtd
%postun
/sbin/ldconfig
%restart_on_update libvirtd
%insserv_cleanup
%files -f %{name}.lang
%defattr(-, root, root)
%{_bindir}/virsh
%{_bindir}/virt-xml-validate
%{_sbindir}/libvirtd
%doc %dir %{_docdir}/%{name}
%doc %{_docdir}/%{name}/[CNRT]*
%doc %{_docdir}/%{name}/AUTHORS
%doc %{_mandir}/man1/virsh.1*
%doc %{_mandir}/man1/virt-xml-validate.1*
%{_libdir}/*.so.*
%dir %{_libdir}/%{name}
%if 0%{?suse_version} > 1030
%{_libdir}/%{name}/libvirt_parthelper
%endif
%if %{with_lxc}
%attr(0755, root, root) %{_libdir}/%{name}/libvirt_lxc
%endif
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/networks/
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/networks/autostart
%config %{_sysconfdir}/libvirt/qemu/networks/default.xml
%config %{_sysconfdir}/logrotate.d/libvirtd
%dir /%{_localstatedir}/run/libvirt/
%dir /%{_localstatedir}/lib/libvirt/
%config /etc/init.d/libvirtd
%{_sbindir}/rclibvirtd
%config %{_sysconfdir}/libvirt/libvirtd.conf
%config %{_sysconfdir}/libvirt/qemu.conf
%config %{_sysconfdir}/sasl2/libvirt.conf
%if 0%{?suse_version} > 1110
%{_datadir}/polkit-1/actions/org.libvirt.unix.policy
%else
%{_datadir}/PolicyKit/policy/org.libvirt.unix.policy
%endif
%{_datadir}/libvirt
%{_datadir}/augeas
%files devel
%defattr(-, root, root)
%{_includedir}/libvirt
%{_libdir}/*.so
%{_libdir}/pkgconfig/libvirt.pc
%files doc
%defattr(-, root, root)
%{_datadir}/gtk-doc/html/libvirt
%doc %{_docdir}/%{name}/*.gif
%doc %{_docdir}/%{name}/*.png
%doc %{_docdir}/%{name}/*.html
%doc %{_docdir}/%{name}/html
%files python
%defattr(-, root, root)
%doc %{_docdir}/%{name}-python
%{py_sitedir}/libvirt.py*
%{py_sitedir}/libvirtmod*
%changelog