# Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI="1" JAVA_PKG_IUSE="doc examples source" inherit java-pkg-2 java-ant-2 DESCRIPTION="Data mapper framework" HOMEPAGE="http://ibatis.apache.org/index.html" # TODO FIXME - Isn't there a more general URI? SRC_URI="http://mirror.switch.ch/mirror/apache/dist/ibatis/binaries/ibatis.java/${P}.zip" LICENSE="Apache-2.0" SLOT="2.3" KEYWORDS="~amd64" IUSE="" COMMON_DEP=" dev-java/cglib:2 dev-java/commons-dbcp:0 dev-java/commons-logging:0 dev-java/log4j:0 dev-java/oscache:0 dev-java/sun-j2ee:0" RDEPEND=" >=virtual/jre-1.5 ${COMMON_DEP}" DEPEND=" dev-java/sun-jdk:1.5 app-arch/unzip ${COMMON_DEP}" src_unpack() { # unusual packing cd "${WORKDIR}" mkdir ${P} cd "${S}" unpack ${A} rm -R META* lib/* # prepare source dir cd "${S}/src/" unzip -q "ibatis-src.zip" rm -R META* iba* # prepare docs cd "${S}/doc/" unzip -q "user-javadoc.zip" # there is also dev-javadoc.zip rm -R META* *.zip # link dependencies cd "${S}/lib/" java-pkg_jar-from cglib-2 cglib-full.jar java-pkg_jar-from commons-dbcp java-pkg_jar-from commons-logging commons-logging.jar java-pkg_jar-from log4j java-pkg_jar-from oscache # TODO FIXME - How to properly register the runtime dependency on j2ee.jar? ln -s /opt/sun-j2ee-*/lib/j2ee.jar j2ee.jar mkdir "${S}/classes" } src_compile() { # won't build with 1.6 java-pkg_set-current-vm sun-jdk-1.5 ejavac -d classes -source 5 -target 5 -classpath $(classpath) \ `find src/ -type f -name \*.java -print0 | xargs --null` jar cf ibatis.jar -C classes/ . } src_install() { java-pkg_dojar "${PN}.jar" use doc && java-pkg_dohtml -r doc use examples && java-pkg_doexamples simple_example use source && java-pkg_dosrc src } ############################################################################### classpath() { local string="" for arg in `find "${S}/lib/" -name \*.jar -print0 | xargs --null`; do string=$string:$arg done echo $string }