# $Id: Portfile,v 1.2 2006/02/17 23:54:31 gwright Exp $

PortSystem 1.0
name		mercury
version		0.12.2
categories	lang
maintainers	gwright@opendarwin.org
platforms	darwin
description	The Mercury Programming Language
long_description	\
		Mercury is a new logic/functional programming	\
		language, which combines the clarity and	\
		expressiveness of declarative programming with	\
		advanced static analysis and error detection	\
		features. Its highly optimized execution	\
		algorithm delivers efficiency far in excess of	\
		existing logic programming systems, and close	\
		to conventional programming systems. Mercury	\
		addresses the problems of large-scale program	\
		development, allowing modularity, separate	\
		compilation, and numerous optimization/time	\
		trade-offs.

homepage	http://www.cs.mu.oz.au/research/${name}/
master_sites	http://www.cs.mu.oz.au/${name}/download/files/

distfiles	${name}-compiler-${version}${extract.suffix}

checksums	${name}-compiler-${version}${extract.suffix} md5 49796cb9f475a0959d13ec7694777a94

post-extract	{ file rename \
			${workpath}/${name}-compiler-${version} \
			${workpath}/${name}-${version}
		}

post-patch	{ reinplace \
			s|\$(INSTALL_ELISP_DIR)|${prefix}/lib/${name}/elisp| \
			${worksrcpath}/Mmakefile
		}

depends_lib	port:readline
depends_build	port:gcc34

configure.env	CC=gcc-dp-3.4

configure.args	--mandir=${prefix}/share/man \
		--infodir=${prefix}/share/info

# Note that most of the building actually takes place in the
# destroot phase.  This is a consequence of the mercury build
# scheme.

build		{ cd ${worksrcpath}
		  system "make INSTALL_PREFIX=${destroot}${prefix}"
		}

destroot	{ cd ${worksrcpath}
		  system "make INSTALL_PREFIX=${destroot}${prefix} \
			       MERCURY_COMPILER=${worksrcpath}/compiler/mercury_compile install"
		}

