# $Id: Portfile 35275 2008-03-23 15:54:42Z jberry@macports.org $

PortSystem 1.0

name				jakarta-bcel
version				5.1
revision			1

categories			java
maintainers			jberry openmaintainer
platforms			darwin

description			Jakarta BCEL -- Java Byte Code Engineering Library
long_description	The Byte Code Engineering Library is intended to give \
					users a convenient possibility to analyze, create, and \
					manipulate (binary) Java class files (those ending with \
					.class). Classes are represented by objects which contain \
					all the symbolic information of the given class: methods, \
					fields and byte code instructions, in particular.
homepage			http://jakarta.apache.org/bcel/

master_sites		apache:jakarta/bcel/source/
checksums			md5 31ebbd7738325c775bd3ad5ce90dc263

distname			bcel-${version}-src
depends_build		bin:ant:apache-ant
depends_lib			bin:java:kaffe \
					port:jakarta-regexp

worksrcdir			bcel-${version}

patchfiles			patch-Pass2Verifier.java.diff \
					patch-StringRepresentation.java.diff

post-extract {
	# Cleanup becl's sloppy distribution
	system "cd ${workpath} && unzip bcel-${version}.zip && unzip -o ${distname}.zip"
	file delete ${worksrcpath}/bcel-${version}.jar
	file mkdir ${worksrcpath}/examples

	# There is no manifest in the source distribution
	reinplace /manifest/d ${worksrcpath}/build.xml
}

use_configure		no

build.cmd			ant
build.target		jar
build.args			-Dname=${name} \
					-Dclass.path=${prefix}/share/java/jakarta-regexp.jar

destroot	{
	xinstall -m 755 -d ${destroot}${prefix}/share/java \
		${destroot}${prefix}/share/doc
	xinstall -m 644 \
		${worksrcpath}/bin/jakarta-bcel.jar \
		${destroot}${prefix}/share/java/
	file copy ${worksrcpath}/docs ${destroot}${prefix}/share/doc/${name}
}
