# $Id: Portfile 78331 2011-05-03 18:07:16Z breskeby@macports.org $

PortSystem 1.0

name				gant
version				1.9.5
categories			java devel groovy
maintainers			breskeby
description			A groovy based tool for scripting ant
long_description	Gant is a tool for scripting Ant tasks using Groovy instead of XML \
					to specify the logic. A Gant specification is a Groovy script and so \
					can bring all the power of Groovy to bear directly, something not \
					possible with Ant scripts. Whilst it might be seen as a competitor \
					to Ant, Gant uses Ant tasks for many of the actions, so Gant is really \
					an alternative way of doing things using Ant, but using a \
					programming language rather than XML to specify the rules.
					
homepage			http://gant.codehaus.org/
platforms			darwin
distname			${name}-${version}
master_sites		http://dist.codehaus.org/gant/distributions
checksums 			md5	6930a7bd5209fb6d1e9e8186fd4b18fb \
					sha1 919c750128af22797b1d53de37c70deda5676ea7 \
					rmd160 2b23c6e2696629d9fb8878568955e459d51ebcc3
						
worksrcdir			${name}-${version}
set workTarget		""

use_zip				yes
use_bzip2			no
use_configure 		no

build.cmd 			true
supported_archs		noarch

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

pre-destroot {
	# Remove extraneous bat files
	foreach f [glob -directory ${worksrcpath}${workTarget}/bin *.bat] {
		file delete $f
	}
}

destroot	{
	# Create the target java directory
	xinstall -m 755 -d ${destroot}${prefix}/share/java/${name}

	# Copy over the needed elements of our directory tree
	file copy ${worksrcpath}/bin     						\
			  ${worksrcpath}/lib 							\
			  ${worksrcpath}/conf 							\
			  ${destroot}${prefix}/share/java/${name}

	# Symlink gant into the bin directory
	system "cd ${destroot}${prefix}/bin && ln -s ${prefix}/share/java/${name}/bin/gant"
}

post-activate {
 	        ui_msg "****************************************************************************"
 	        ui_msg "* Remember to set the environment variable GANT_HOME to the path to"
 	        ui_msg "* the gant distribution: ${prefix}/share/java/${name}"
 	        ui_msg "****************************************************************************"
 }
