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

# cvs -d :pserver:alistair64@cvs.dev.java.net:/cvs login
# cvs -d :pserver:alistair64@cvs.dev.java.net:/cvs export -r rel-1_5_0-fcs j3d-core
# tar -czf j3d-core-1.5.0.tar.gz j3d-core
# cvs -d :pserver:alistair64@cvs.dev.java.net:/cvs export -r rel-1_5_0-fcs j3d-core-utils
# tar -czf j3d-core-utils-1.5.0.tar.gz j3d-core-utils
# cvs -d :pserver:alistair64@cvs.dev.java.net:/cvs export -r rel-1_5_0-fcs j3d-examples
# tar -czf j3d-examples-1.5.0.tar.gz j3d-examples

JAVA_PKG_IUSE="doc source test examples"

inherit eutils java-pkg-2 java-ant-2

DESCRIPTION="Sun J3D: The Java 3D API Core"
HOMEPAGE="https://j3d-core.dev.java.net/"
#SRC_URI="http://download.java.net/media/java3d/builds/stable/${PN}-${PV}.tar.gz http://download.java.net/media/java3d/builds/stable/${PN}-utils-${PV}.tar.gz http://download.java.net/media/java3d/builds/stable/j3d-examples-${PV}.tar.gz"


SRC_URI="${P}.tar.gz ${PN}-utils-${PV}.tar.gz j3d-examples-${PV}.tar.gz"
KEYWORDS="~amd64 ~x86"
SLOT="0"
LICENSE="|| ( sun-jrl sun-jdl )"
IUSE=""
DEPEND=">=virtual/jdk-1.5
	=dev-java/vecmath-1.5.0
	dev-java/ant-tasks
        dev-java/ant-core
	test? ( dev-java/junit )"
RDEPEND=">=virtual/jre-1.5"

MY_S="${WORKDIR}/${P}"
MY_S_UTILS="${WORKDIR}/${PN}-utils-${PV}"
MY_S_EXAMPLES="${WORKDIR}/j3d-examples-${PV}"

EANT_DOC_TARGET="docs"
EANT_BUILD_TARGET="jar"
JAVA_PKG_STRICT=true

src_unpack() {
        unpack ${A}
        cd "${WORKDIR}"
        mkdir -p vecmath/build/opt/lib/ext
        cd vecmath/build/opt/lib/ext
        java-pkg_jarfrom vecmath
        cd "${WORKDIR}"
        mkdir -p vecmath/build/debug/lib/ext
        cd vecmath/build/debug/lib/ext
        java-pkg_jarfrom vecmath
        cd "${WORKDIR}"
        ln -s "${PN}-${PV}" "${PN}"
        ln -s "${PN}-utils-${PV}" "${PN}-utils"
        ln -s j3d-examples-${PV} j3d-examples
        cd ${S}
}

#src_test() {
#	cd "${S}/../${PN}-test"
#	eant 	-Dgentoo.classpath="$(java-pkg_getjar --build-only junit \
#		junit.jar):${S}/build/opt/lib/ext/${PN}.jar" test
#}

src_install() {
	cd "${MY_S}/build/linux-i586/opt/lib/ext/"
        java-pkg_dojar j3dcore.jar j3dutils.jar

	if use source; then
	       	java-pkg_dosrc "${MY_S}/src/*"
		java-pkg_dosrc "${MY_S_UTILS}/src/*"
		if use examples; then
		         java-pkg_dosrc "${MY_S_EXAMPLES}/src/*"
		fi
	fi 
	
        if use doc; then
		java-pkg_dojavadoc "build/linux-i586/javadocs/"
                java-pkg_dohtml -r *.html
        fi
}