# $Id$ PNAME="apache-ant" PVER="1.10.2" PBUILD="r1" PCAT="dev-java" DESCRIPTION="Ant is a java-based build tool." HOMEPAGE="http://ant.apache.org/" # enable bootstrap of ant or not (0=disabled, 1=enabled) BOOTSTRAP=0 DEPEND=">= virtual/java-jdk >= dev-java/junit-4.12 >= dev-java/hamcrest-1.3" if [[ ${BOOTSTRAP} = 0 ]] then SDEPEND=">= dev-java/apache-ant-1.9" fi SRCFILE="${PNAME}-${PVER}-src.tar.bz2" SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" OPT_SRCFILE="optional-20160503-1.tar.bz2" sminclude mbuild java msetfeature "!check" SRC_URI=( http://www.apache.org/dist/ant/source/${SRCFILE} mirror://${PNAME}/${SRCFILE} mirror://${PNAME}/${OPT_SRCFILE} ) UP2DATE="updatecmd http://www.apache.org/dist/ant/source/ | grep ${PNAME}- | sed 's:-src::g' | highesttarball" src_prepare() { munpack ${SRCFILE} || die munpack ${OPT_SRCFILE} ${SRCDIR}/lib/optional || die } src_compile() { local myopts local targets local junit local hamcrest local ant_exec cd ${SRCDIR} # get junit from classpath if [[ -L ${JAVA_CLASSPATH_DIR}/junit.jar ]] then junit="${JAVA_CLASSPATH_DIR}/$(readlink ${JAVA_CLASSPATH_DIR}/junit.jar)" else junit="${JAVA_CLASSPATH_DIR}/junit.jar" fi # and linking it to lib/optional as apache-ant has now a hard-dependency to it echo "Using junit.jar from ${junit}!" #rm -v ${SRCDIR}/lib/optional/junit.jar || die #ln -snf ${junit} ${SRCDIR}/lib/optional/junit.jar || die rm -v ${SRCDIR}/lib/optional/junit-4.11.jar || die ln -vsnf ${junit} ${SRCDIR}/lib/optional/junit-4.11.jar || die # get hamcrest-core from classpath if [[ -L ${JAVA_CLASSPATH_DIR}/hamcrest-core.jar ]] then hamcrest="${JAVA_CLASSPATH_DIR}/$(readlink ${JAVA_CLASSPATH_DIR}/hamcrest-core.jar)" else hamcrest="${JAVA_CLASSPATH_DIR}/hamcrest-core.jar" fi # and linking it to lib/optional as apache-ant has now a hard-dependency to it echo "Using hamcrest-core.jar from ${hamcrest}!" rm -v ${SRCDIR}/lib/optional/hamcrest-core-1.3.jar || die ln -vsnf ${hamcrest} ${SRCDIR}/lib/optional/hamcrest-core-1.3.jar || die case ${BOOTSTRAP} in 0) ant_exec="ant" ;; 1) ant_exec='./build.sh' ;; *) die "unknown bootstrap option '${BOOTSTRAP}'" ;; esac # we use a tarball which provides all optionals to honor proxies # # # ant needs HOME to download libs to $HOME/.m2/repository # # this one does not honor authenticated proxies # export ANT_OPTS="-Duser.home=${SRCDIR}" # ${ant_exec} -Ddest=optional -f fetch.xml || die # enable verbose mode myopts+=" -verbose" # all build targets all together (disabled by default, don't want javadocs) #targets+=" dist" # only build the jars targets+=" jars test-jar" # enable build of javadocs (disabled by default to save lots of ram @buildtime) #targets+=" javadocs" # don't fail the build on javadocs erros #myopts+=" -Djavadoc.failonerror=false" ${ant_exec} ${myopts} ${targets} || die } src_install() { cd ${SRCDIR} # this one sucks, ignores libdir and installs unneccessary stuff #ANT_HOME=${BINDIR}/usr ./build.sh install-lite || die # needed directories minstalldir /usr/bin || die minstalldir /usr/share/${PNAME}-${PVER}/bin || die # binaries local i for i in ant antRun runant.pl runant.py complete-ant-cmd.pl do minstallexec src/script/${i} /usr/share/${PNAME}-${PVER}/bin || die ${i} mlink /usr/share/${PNAME}-${PVER}/bin/${i} /usr/bin/${i} || die done # jars and classpathes env mclasspathinit || die minstalljar-classpath $(find build/lib -name \*.jar) || die # add ANT_HOME too MCONFIG="/etc/env.d/22java-app-${PNAME}" maddconfig "ANT_HOME=\"/usr/share/${PNAME}-${PVER}\"" || die minstalldocs README LICENSE NOTICE WHATSNEW || die }