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

inherit java-pkg-2

DESCRIPTION="flex tool for java"
HOMEPAGE="http://jflex.de"
SRC_URI="http://jflex.de/${P}.zip
		http://jflex.sourceforge.net/jar/stable/JFlex.jar
		http://jflex.sourceforge.net/jar/stable/java_cup.jar"

LICENSE="GPL-1"
SLOT="0"
KEYWORDS="~x86"
IUSE=""

DEPEND=">=virtual/jdk-1.4
		=dev-java/junit-3.8*"
RDEPEND=">=virtual/jre-1.4"

# ant doesn't work that well here, so take the lazy way out

src_unpack() {
	unpack ${P}.zip
	cd "${S}"
	mkdir tools
	cp "${DISTDIR}/JFlex.jar" tools/
	cp "${DISTDIR}/java_cup.jar" tools/
}

src_compile() {
	cd "${S}/src"
	ant jar || die
}

src_install() {
	java-pkg_dojar "${S}/lib/JFlex.jar"
	java-pkg_dolauncher jflex
	dosym /usr/share/${PN}/lib/JFlex.jar /usr/share/ant-core/lib/
}

