# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-emulation/libvirt/libvirt-0.9.4.ebuild,v 1.4 2011/08/31 22:55:58 cardoe Exp $

#BACKPORTS=2
#AUTOTOOLIZE=yes

EAPI="3"

MY_P="${P/_rc/-rc}"

if [[ ${PV} = *9999* ]]; then
	EGIT_REPO_URI="git://libvirt.org/libvirt.git"
	GIT_ECLASS="git-2"
	AUTOTOOLIZE=yes
fi

PYTHON_DEPEND="python? 2:2.4"
#RESTRICT_PYTHON_ABIS="3.*"
#SUPPORT_PYTHON_ABIS="1"

inherit eutils python ${AUTOTOOLIZE+autotools} ${GIT_ECLASS}

if [[ ${PV} = *9999* ]]; then
	SRC_URI=""
	KEYWORDS=""
else
	SRC_URI="http://libvirt.org/sources/${MY_P}.tar.gz
		ftp://libvirt.org/libvirt/${MY_P}.tar.gz
		${BACKPORTS:+
			http://dev.gentoo.org/~flameeyes/${PN}/${MY_P}-backports-${BACKPORTS}.tar.bz2
			http://dev.gentoo.org/~cardoe/distfiles/${MY_P}-backports-${BACKPORTS}.tar.bz2}"
	KEYWORDS="~amd64 ~x86"
fi
S="${WORKDIR}/${P%_rc*}"

DESCRIPTION="C toolkit to manipulate virtual machines"
HOMEPAGE="http://www.libvirt.org/"
LICENSE="LGPL-2.1"
SLOT="0"
IUSE="avahi caps debug iscsi +json +libvirtd lvm +lxc macvtap nfs \
	nls numa openvz parted pcap phyp policykit python qemu sasl selinux udev \
	uml virtualbox virt-network xen elibc_glibc"
# IUSE=one : bug #293416 & bug #299011

# gettext.sh command is used by the libvirt command wrappers, and it's
# non-optional, so put it into RDEPEND.
RDEPEND="sys-libs/readline
	sys-libs/ncurses
	>=net-misc/curl-7.18.0
	>=dev-libs/libxml2-2.7.6
	>=dev-libs/libnl-1.1
	>=net-libs/gnutls-1.0.25
	>=sys-apps/util-linux-2.17
	sys-devel/gettext
	>=net-analyzer/netcat6-1.0-r2
	avahi? ( >=net-dns/avahi-0.6[dbus] )
	caps? ( sys-libs/libcap-ng )
	iscsi? ( sys-block/open-iscsi )
	json? ( dev-libs/yajl )
	libvirtd? ( net-misc/bridge-utils )
	lvm? ( >=sys-fs/lvm2-2.02.48-r2 )
	macvtap? ( >=dev-libs/libnl-1.1 )
	nfs? ( net-fs/nfs-utils )
	numa? ( >sys-process/numactl-2.0.2 )
	openvz? ( sys-kernel/openvz-sources )
	parted? (
		>=sys-block/parted-1.8[device-mapper]
		sys-fs/lvm2
	)
	pcap? ( >=net-libs/libpcap-1.0.0 )
	phyp? ( net-libs/libssh2 )
	policykit? ( >=sys-auth/polkit-0.9 )
	qemu? ( || ( app-emulation/qemu-kvm >=app-emulation/qemu-0.10.0 ) )
	sasl? ( dev-libs/cyrus-sasl )
	selinux? ( >=sys-libs/libselinux-2.0.85 )
	virtualbox? ( || ( app-emulation/virtualbox >=app-emulation/virtualbox-bin-2.2.0 ) )
	xen? ( app-emulation/xen-tools app-emulation/xen )
	udev? ( >=sys-fs/udev-145 >=x11-libs/libpciaccess-0.10.9 )
	virt-network? ( net-dns/dnsmasq
		>=net-firewall/iptables-1.4.10
		net-firewall/ebtables
		sys-apps/iproute2 )
	elibc_glibc? ( || ( >=net-libs/libtirpc-0.2.2-r1