# 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="Extended 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="" CDEPEND="=dev-java/hamcrest-core-${PV}*" DEPEND=">=virtual/jdk-1.5 =dev-java/hamcrest-generator-${PV}* ${CDEPEND}" RDEPEND=">=virtual/jre-1.5 ${CDEPEND}" JAVA_ANT_CLASSPATH_TAGS="${JAVA_ANT_CLASSPATH_TAGS} javadoc" EANT_BUILD_TARGET="library" EANT_EXTRA_ARGS="-Dversion=${PV}" EANT_GENTOO_CLASSPATH="hamcrest-core-1.2" JAVA_ANT_REWRITE_CLASSPATH=1 src_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" # Empty out the contents of the core target; it has already been built. epatch "${FILESDIR}/hamcrest-1.2-empty_core.patch" # Fix problems with Javadoc target epatch "${FILESDIR}/hamcrest-library-1.2-fix_javadoc.patch" find -name "*.jar" | xargs rm -v # copy package.html from hamcrest-core to hamcrest-library to so that # the org.hamcrest package is documented cp hamcrest-core/src/main/java/org/hamcrest/package.html \ ${PN}/src/main/java/org/hamcrest/ # link to local Javadocs, if installed if use doc ; then ebegin "Checking for local API documentation.." # check for SDK documentation if 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 against Java SDK API at ${doc_loc}" sed -i.sdkdoc -r \ -e "s|http://java.sun.com/j2se/1\.5\.0/docs/api/|file://${doc_loc}|" \ build.xml fi # check for hamcrest-core documentation doc_loc=`java-config-2 --query=JAVADOC_PATH --package=hamcrest-core-1.2 2>/dev/null` if [ -n "${doc_loc}" ] ; then elog " Linking against hamcrest-core API at ${doc_loc}" sed -i.coredoc -r \ -e "/" \ build.xml fi eend 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 java-pkg_jar-from --into build \ hamcrest-core-${PV} hamcrest-core.jar hamcrest-core-${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 }