# $Id: Portfile,v 1.22 2005/06/03 15:46:26 jberry Exp $

PortSystem 1.0

name			apache-ant
version			1.6.5
categories		devel java
maintainers		sean@fuzzymagic.com jberry@opendarwin.org
description		Java opensource build system
long_description	Ant is a Java based build tool. In theory it is kind of \
				like make without make's wrinkles. Ant uses XML build files \
				that define a set of targets. Each target has dependencies \
				(other targets) and contains a set of tasks to perform.
homepage		http://ant.apache.org/

platforms		darwin freebsd

distname		${name}-${version}-bin
master_sites    apache:ant/
master_sites.mirror_subdir	binaries
checksums 		md5 26031ee1a2fd248ad0cc2e7f17c44c39

worksrcdir		${name}-${version}
set workTarget	""

use_bzip2		yes
use_configure	no

build.cmd 		"true"
build.args 		""
build.target	""	

variant darwin {
    extract.post_args	| gnutar -x 
    build.env		JAVA_HOME=/Library/Java/Home
}

# Ant is installed from the binary (jar) distribution by default. Due to 
# bootstrapping issues, the source variant generally doesn't build a very
# usable ant: the ant tasks (such as junit) are non-functional as their
# dependent support isn't available when ant is built, due to circular
# dependencies back to ant.
variant source {
	distname 					${name}-${version}-src
	master_sites.mirror_subdir	source	
	checksums					md5 80a7ad191c40b7d8c82533524b282b6b
	set workTarget				/${name}

	build.cmd 		./build.sh
	build.args 		-Dchmod.fail=false -Ddist.name=${name}
	build.target	dist	
}

pre-destroot {
	cd ${worksrcpath}${workTarget}/bin
	file delete ant.bat ant.cmd antRun.bat antenv.cmd \
		envset.cmd lcp.bat runrc.cmd
}

destroot	{
	xinstall -m 755 -d ${destroot}${prefix}/share/java
	file copy ${worksrcpath}${workTarget} \
		${destroot}${prefix}/share/java/${name}
	system "ln -fs ${prefix}/share/java/${name}/bin/ant \
		${destroot}${prefix}/bin/ant"
}
