# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit java-pkg-2 games

DESCRIPTION="Virtual Advanced Squad Leader"
HOMEPAGE="http://www.vasl.org"
SRC_URI="mirror://sourceforge/vassalengine/VASL-${PV}.zip
	mirror://sourceforge/vassalengine/CASL-4_1.zip"
LICENSE="LGPL-2.1"
SLOT="0"
KEYWORDS="~x86 ~ppc ~sparc ~alpha"

IUSE=""
DEPEND=">=games-engines/vassal
	>=virtual/jdk"
RDEPEND=">=virtual/jre
    >=games-engines/vassal
	>=vasl-data"

S=${WORKDIR}/src

src_unpack() {
	unpack ${A}
	cd "${S}"
	mv ../VASL/build/module/map/PhaseManager.java VASL/build/module/map/
	rm -rf ../VASL
	mv ../Acme .
	mv ../CASL .
}

src_compile() {
	find . -name \*.java > java.list
	ejavac -classpath $(java-config -p vassal) @java.list
	rm java.list
	$(java-config -j) -c Acme CASL VASL > vasl.jar
}

src_install() {
	java-pkg_addcp $(java-config -p vassal)
	java-pkg_dojar vasl.jar
	java-pkg_dolauncher ${PN} --main org.vassalengine.Main
	prepgamesdirs
}