File virt-utils.spec of Package virt-utils

#
# spec file for package virt-utils
#
# Copyright (c) 2011 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 qemu_utils 1
%define internal_utils 1
%define provide_duplicated_binaries 0

Name:           virt-utils
BuildRequires:  zlib-devel
BuildRequires:  glib2-devel
Version:        1.1.7
Release:        1
License:        GPLv2
Group:          System/Kernel
Summary:        Virtualization Utilities
# git commit id for following rc0 release: b8095f2
Source0:        qemu-0.15.0.tar.bz2
Source1:        vm-snapshot-disk
Patch1:         qemu-img-vmdk-scsi.patch
Patch2:         qemu-img-vpc.patch
Url:            http://www.qemu.org/
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Various virtualization solutions have a common need for ancillary
utilities which manage storage, snapshotting, monitoring, etc.

Both KVM and Xen derive their device and machine model from qemu and
inherit a lot from it's approach to emulation/virtualization.  This
package is hence a good place to have qemu related tools reside. 
Additionally, any other utilities which have use across the various
virtualization solutions available have a home here.



Authors:
--------
    Fabrice Bellard
    Ron Terry

%prep
%if %{?qemu_utils}0
%setup -q -n qemu-0.15.0
%patch1 -p1
%patch2 -p1
%endif

%build
%if %{?qemu_utils}0
./configure --prefix=%{_prefix} \
	--extra-cflags="%{optflags}"
make qemu-img
make qemu-nbd
make qemu-img.1
make qemu-nbd.8
%endif

%install
%if %{?qemu_utils}0
mkdir -p %{buildroot}%{_bindir}
install -s -m 755 qemu-img %{buildroot}%_bindir/qemu-img
install -s -m 755 qemu-nbd %{buildroot}%_bindir/qemu-nbd
%if %{provide_duplicated_binaries}0 
ln -s qemu-img %{buildroot}%_bindir/qemu-img-xen
ln -s qemu-img %{buildroot}%_bindir/qemu-img-kvm
ln -s qemu-nbd %{buildroot}%_bindir/qemu-nbd-xen
%endif
mkdir -p %{buildroot}%{_mandir}/man1
mkdir -p %{buildroot}%{_mandir}/man8
install -m644 qemu-img.1 %{buildroot}%_mandir/man1/qemu-img.1
install -m644 qemu-nbd.8 %{buildroot}%_mandir/man8/qemu-nbd.8
%endif
%if %{?internal_utils}0
install -m 755 %SOURCE1 $RPM_BUILD_ROOT/usr/bin
%endif

%clean
rm -rf ${RPM_BUILD_ROOT}

%files
%defattr(-, root, root)
%if %{?qemu_utils}0
/usr/bin/qemu-img
/usr/bin/qemu-nbd
%if %{provide_duplicated_binaries}0 
/usr/bin/qemu-img-xen
/usr/bin/qemu-img-kvm
/usr/bin/qemu-nbd-xen
%endif
%{_mandir}/man1/qemu-img.1.gz
%{_mandir}/man8/qemu-nbd.8.gz
%endif
%if %{?internal_utils}0
/usr/bin/vm-snapshot-disk
%endif

%changelog