# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit eutils versionator wxwidgets

MY_P=${PN}-$(replace_version_separator 2 "r")

DESCRIPTION="Xara Xtreme - versatile vector graphic program"
HOMEPAGE="http://www.xaraxtreme.org/"
SRC_URI="http://downloads.xara.com/opensource/${MY_P}.tar.bz2
	http://downloads2.xara.com/opensource/${MY_P}.tar.bz2"
RESTRICT="mirror"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="x86 ~amd64"
IUSE="nls debug"

RDEPEND=">=x11-libs/wxGTK-2.6.3
	nls? ( >=sys-devel/gettext-0.14.3 )
	sys-devel/libtool
	>=media-libs/libpng-1.2.8
	>=media-libs/jpeg-6b
	app-arch/zip
	dev-lang/perl
	>=dev-libs/libxml2-2.6.0"
DEPEND="${RDEPEND}
	>=sys-devel/gcc-3
	dev-util/pkgconfig
	>=sys-devel/automake-1.6
	>=sys-devel/autoconf-2.59"

S=${WORKDIR}/${MY_P}

pkg_setup() {
	export WX_GTK_VER="2.6"
	need-wxwidgets unicode
}

src_compile() {
	./autogen.sh
	econf \
		--with-wx-config=${WX_CONFIG} \
		$(use_enable nls) \
		$(use_enable debug) \
		|| die "conf failed"
	emake || die "make failed"
}

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

	insinto /usr/share/doc/${PF}/examples
	doins testfiles/*
	dodoc LICENSE AUTHORS ChangeLog

	make_desktop_entry XaraLX
}
