# $Id: Portfile,v 1.6 2006/01/25 07:51:43 blb Exp $

PortSystem			1.0
name				gcj34
version				3.4.5
categories			lang devel java
maintainers			blb@opendarwin.org
description			GNU Java compiler
long_description \
	GCJ is a portable, optimizing, ahead-of-time compiler for the Java \
	Programming Language. It can compile: Java source code directly to \
	native machine code, Java source code to Java bytecode (class files), \
	and Java bytecode to native machine code.

platforms			darwin

homepage			http://www.gnu.org/software/gcc/java/
master_sites		gnu:gcc/gcc-3.4.5
use_bzip2			yes
dist_subdir			gcc
distname			gcc-${version}

checksums			md5 7c3c3c3e764dcee5eb771432062d69e1

worksrcdir			${distname}/build

depends_lib			port:zlib

patchfiles			patch-libjava_libltdl_ltmain.sh patch-ltmain.sh

pre-patch {
	file mkdir ${worksrcpath}
}

set gcjBaseDir		${prefix}/${name}-${version}
configure.cmd		${worksrcpath}/../configure
configure.env		CPPFLAGS="-I${prefix}/include" LDFLAGS="-L${prefix}/lib"
configure.pre_args	--prefix=${gcjBaseDir}
configure.args		--enable-languages=c++,java --disable-nls \
					--with-system-zlib --mandir=${gcjBaseDir}/share/man \
					--infodir=${gcjBaseDir}/share/info \
					--with-local-prefix=${gcjBaseDir}

build.target		bootstrap-lean

# Since we install in a subdir dedicated to gcj, this gets it visibility
post-destroot {
	set gcjLinkFiles	{ gcj gcjh gij grepjar jcf-dump jv-convert jv-scan }
	cd ${destroot}/${prefix}/bin
 	foreach gcjBinFile ${gcjLinkFiles} {
		system "ln -s ../${name}-${version}/bin/${gcjBinFile} ."
	}
	cd ${destroot}/${prefix}/share/man/man1
	foreach gcjManFile ${gcjLinkFiles} {
		system "ln -s \
			../../../${name}-${version}/share/man/man1/${gcjManFile}.1 ."
	}
	xinstall -m 755 -d ${destroot}/${prefix}/lib/pkgconfig
	cd ${destroot}/${prefix}/lib/pkgconfig
	system "ln -s ../../${name}-${version}/lib/pkgconfig/libgcj.pc ."
}

platform darwin 8 {
	patchfiles-append	patch-gcc_config_darwin.h
}

