# $Id: Portfile,v 1.8 2005/11/25 16:42:48 jberry Exp $

PortSystem 1.0

name			pmd
version			3.0
revision		1

categories		java lang
platforms		darwin
maintainers		mww@opendarwin.org

description		PMD is a Java source code analyzer
long_description	PMD is a Java source code analyzer. It finds unused \
					variables, empty catch blocks, unnecessary object \
					creation, and so forth.

homepage		http://pmd.sourceforge.net/
master_sites	sourceforge
distname		${name}-src-${version}
checksums		md5 f7b1e8c638e8ddd86c88282b5ce8bc96
use_zip			yes

depends_build	bin:ant:apache-ant
depends_lib		bin:java:kaffe
depends_run		port:jaxen \
				port:xercesj \
				port:saxpath \
				port:junit

worksrcdir		${name}-${version}

post-extract	{
	file delete ${worksrcpath}/lib/saxpath-1.0-fcs.jar \
		${worksrcpath}/lib/xercesImpl-2.0.2.jar \
		${worksrcpath}/lib/xmlParserAPIs-2.0.2.jar \
		${worksrcpath}/lib/jaxen-core-1.0-fcs.jar \
		${worksrcpath}/lib/pmd-2.0.jar
}

use_configure	no

build.cmd		ant
build.target	jar
build.dir		${worksrcpath}/bin
build.env		CLASSPATH=${prefix}/share/java/junit.jar:${prefix}/share/java/saxpath.jar:${prefix}/share/java/xercesImpl.jar:${prefix}/share/java/xml-apis.jar:${prefix}/share/java/jaxen.jar

destroot	{
	xinstall -m 755 ${filespath}/pmd ${destroot}${prefix}/bin
	reinplace "s|_PREFIX_|${prefix}|g" ${destroot}${prefix}/bin/pmd
	xinstall -m 755 -d ${destroot}${prefix}/share/java \
		${destroot}${prefix}/share/doc
	xinstall -m 644 ${worksrcpath}/lib/pmd-${version}.jar \
		${destroot}${prefix}/share/java/pmd.jar
	file copy ${worksrcpath}/docs ${destroot}${prefix}/share/doc/${name}
	file copy ${worksrcpath}/rulesets ${destroot}${prefix}/share/${name}
}
