SUMMARY="Java-based build tool similar to 'make'"
DESCRIPTION="
Apache Ant is a Java library and command-line tool whose mission is to drive \
processes described in build files as targets and extension points dependent \
upon each other. The main known usage of Ant is the build of Java \
applications. Ant supplies a number of built-in tasks allowing to compile, \
assemble, test and run Java applications. Ant can also be used effectively to \
build non Java applications, for instance C or C++ applications. More \
generally, Ant can be used to pilot any type of process which can be described \
in terms of targets and tasks.
Ant is written in Java. Users of Ant can develop their own "antlibs" \
containing Ant tasks and types, and are offered a large number of ready-made \
commercial or open-source "antlibs".
Ant is extremely flexible and does not impose coding conventions or directory \
layouts to the Java projects which adopt it as a build tool.
Software development projects looking for a solution combining build tool and \
dependency management can use Ant in combination with Apache Ivy.
The Apache Ant project is part of the Apache Software Foundation.
"
HOMEPAGE="http://ant.apache.org/"
COPYRIGHT="1999-2013 The Apache Software Foundation"
LICENSE="Apache v2"

REVISION="1"
ARCHITECTURES="any"

SRC_URI="http://archive.apache.org/dist/ant/source/apache-ant-1.9.2-src.tar.bz2"
CHECKSUM_MD5="8f610c1a0183507c2beebbf230f456af"
SOURCE_DIR="apache-ant-$portVersion"

PROVIDES="
	ant_core = $portVersion compat >= 1
	cmd:ant = $portVersion compat >= 1
	"

REQUIRES="
	haiku >= $haikuVersion
	cmd:java
	"

BUILD_REQUIRES="
	"

BUILD_PREREQUIRES="
	cmd:java
	cmd:java_config
	cmd:javac
	"

PATCH()
{
	sed -i 's/depends=\"jars,test-jar\"/depends=\"jars\"/' build.xml
}

BUILD()
{
	export JAVA_HOME=$(java-config -H)
	ANT_HOME= ./build.sh
}

INSTALL()
{
	export JAVA_HOME=$(java-config -H)
	export ANT_HOME=$libDir/ant
	./build.sh install-lite

	# symlink the executable to binDir
	mkdir -p $binDir
	symlinkRelative -s $ANT_HOME/bin/ant $binDir

	# create a profile.d file that sets up ANT_HOME
	mkdir -p $dataDir/profile.d
	echo ANT_HOME=$ANT_HOME > $dataDir/profile.d/ant.sh
	echo "export ANT_HOME" >> $dataDir/profile.d/ant.sh
}
