--- /dev/null
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="4"
+JAVA_PKG_IUSE="doc examples source test"
+
+inherit java-pkg-2 java-ant-2
+
+if [[ "${PV}" == "9999" ]]; then
+ inherit git-2
+ EGIT_REPO_URI="git://github.com/JodaOrg/${PN}.git"
+ SRC_URI=""
+ MY_P="${P}"
+else
+ #MY_P="${P}-src"
+ #SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz"
+ #S="${WORKDIR}/${MY_P}"
+ SRC_URI="http://github.com/JodaOrg/${PN}/tarball/v${PV} -> ${P}.tar.gz"
+fi
+
+DESCRIPTION="A quality open-source replacement for the Java Date and Time classes."
+HOMEPAGE="http://joda-time.sourceforge.net/"
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="amd64 ppc ppc64 x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~sparc-solaris ~x86-solaris"
+IUSE=""
+
+COMMON_DEP="dev-java/joda-convert"
+DEPEND="
+ >=virtual/jdk-1.5
+ test? ( dev-java/ant-junit4 )
+ ${COMMON_DEP}"
+RDEPEND="
+ >=virtual/jre-1.5
+ ${COMMON_DEP}"
+
+JAVA_PKG_WANT_SOURCE="5"
+# chokes on static inner class making instance of non-static inner class
+EANT_FILTER_COMPILER="jikes"
+# Keep ant from trying to use maven internally
+EANT_EXTRA_ARGS="-Djunit.ant=1 -Djunit.present=1 -Djodaconvert.present=1"
+EANT_GENTOO_CLASSPATH="joda-convert"
+JAVA_ANT_REWRITE_CLASSPATH="true"
+
+src_unpack() {
+ # Work around GitHub's "${PN}-<SHA1>" directory name
+ if [[ "${PV}" == "9999" ]]; then
+ git-2_src_unpack
+ else
+ unpack "${A}"
+ mv *-"${PN}"-* "${S}"
+ fi
+}
+
+src_test() {
+ ANT_TASKS="ant-junit" eant \
+ -Djunit.jar="$(java-pkg_getjar junit-4 junit.jar)" \
+ -Djodaconvert.jar="$(java-pkg_getjar joda-convert joda-convert.jar)" \
+ test
+}
+
+src_install() {
+ if [[ "${PV}" == "9999" ]]; then
+ java-pkg_newjar build/${PN}-*.jar ${PN}.jar
+ else
+ java-pkg_newjar build/${P}.jar ${PN}.jar
+ fi
+
+ dodoc LICENSE.txt NOTICE.txt RELEASE-NOTES.txt ToDo.txt || die
+ use doc && java-pkg_dojavadoc build/docs
+ use examples && java-pkg_doexamples src/example
+ use source && java-pkg_dosrc src/java/org
+}