# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

inherit subversion

DESCRIPTION="Small utility for searching ebuilds with indexing for fast results"
HOMEPAGE="http://eix.sourceforge.net"
SRC_URI=""

LICENSE="GPL-2"
SLOT="0"
KEYWORDS=""
IUSE="sqlite3"

DEPEND="sqlite3? ( >=dev-db/sqlite-3 )
	app-arch/bzip2"
RDEPEND="${DEPEND}"

VERSIO_PRAESENS="${PV#*_pre}"

ESVN_PROJECT="eix"
ESVN_REPO_URI="https://svn.gentooexperimental.org/eix/trunk"

src_unpack() {
	subversion_src_unpack
	VERSIO_PRIOR="${ESVN_WC_REVISION}"
	subversion_wc_info
	VERSIO_PRAESENS="${ESVN_WC_REVISION}"
	if has_version =app-portage/eix-9999 ; then
		elog "PARTIAL CHANGELOG"
		svn log -r${VERSIO_PRIOR}:${VERSIO_PRAESENS} --config-dir "${ESVN_STORE_DIR}/.subversion" "${ESVN_REPO_URI}"
		sleep 10
	fi

	./autogen.sh || die "autogen.sh failed"
}

src_compile() {
	econf --with-bzip2 $(use_with sqlite3 sqlite)
	emake || die "emake failed"
	src/eix --dump-defaults >eixrc || die "generating eixrc failed"
}

src_install() {
	emake DESTDIR="${D}" install || die "emake install failed"

	dodoc AUTHORS ChangeLog TODO

	insinto /etc
	doins eixrc
}