# Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI="2" JAVA_PKG_IUSE="doc source" inherit java-pkg-2 java-ant-2 MY_PN="hamcrest" MY_P="${MY_PN}-${PV}" S="${WORKDIR}/${MY_P}" DESCRIPTION="Core library of matchers for building test expressions." HOMEPAGE="http://code.google.com/p/${MY_PN}/" SRC_URI="http://${MY_PN}.googlecode.com/files/${MY_P}.tgz" LICENSE="BSD-2" SLOT="1.2" KEYWORDS="~amd64 ~ia64 ~ppc ~ppc64 ~x86" IUSE="" DEPEND=">=virtual/jdk-1.5 =dev-java/hamcrest-generator-${PV}*" RDEPEND=">=virtual/jre-1.5" EANT_BUILD_TARGET="core" EANT_EXTRA_ARGS="-Dversion=${PV}" java_prepare() { # Don't include source in JAR. If a Gentoo user wants the source the source # USE flag will be enabled epatch "${FILESDIR}/hamcrest-1.2-no_source_in_jar.patch" # Empty out the contents of the generator target; it has already been built. epatch "${FILESDIR}/hamcrest-1.2-empty_generator.patch" # Fix problems with Javadoc target epatch "${FILESDIR}/hamcrest-core-1.2-fix_javadoc.patch" find -name "*.jar" | xargs rm -v # link to local Javadocs, if installed if use doc && has_version dev-java/java-sdk-docs ; then jdk_package=`best_version dev-java/java-sdk-docs` doc_loc=`portageq contents ${ROOT} ${jdk_package} \ | grep "/html/api$"` elog "Linking Javadoc against local documentation at ${doc_loc}" sed -i.javadoc -r \ -e "s|http://java.sun.com/j2se/1\.5\.0/docs/api/|file://${doc_loc}|" \ build.xml fi # These jars must be symlinked. Specifying them using gentoo.classpath # does not work. mkdir build java-pkg_jar-from --build-only --into build hamcrest-generator-${PV} \ hamcrest-generator.jar hamcrest-generator-${PV}.jar } src_install() { java-pkg_newjar build/${PN}-${PV}.jar ${PN}.jar dodoc README.txt CHANGES.txt use doc && java-pkg_dojavadoc build/javadoc/ use source && java-pkg_dosrc ${PN}/src/main/java/org }