# $Id: Portfile,v 1.1 2004/11/23 22:30:59 mww Exp $

PortSystem 1.0

name			polyml
version			4.1.3
categories		lang
maintainers		dem5302@cs.rit.edu
description		An implementation of Standard ML.
long_description  Poly/ML is an extremely fast and efficient implementation of \
				Standard ML. Program state can be saved in a memory-mapped \
				persistent store. There are numerous addon libraries available.

homepage		http://www.polyml.org/
master_sites	${homepage}/source/:src \
				${homepage}/dbases/:db

distfiles		${name}-driver-${version}.tar.gz:src \
				${name}-basis-${version}.tar.gz:src \
				${name}-mlsource-${version}.tar.gz:src \
				${name}-${version}.ppc.tar.gz:db
checksums		${name}-driver-${version}.tar.gz \
					md5 814cea1cfb376d4bb3977f78bad3d5eb \
				${name}-basis-${version}.tar.gz \
					md5 aaaebb967ddafcbf9ff27ea815be5414 \
				${name}-mlsource-${version}.tar.gz \
					md5 c316411eb44e61bc85762e5742761936 \
				${name}-${version}.ppc.tar.gz \
					md5 7f9f0911ce15a146cc002ac55efc34c2       

patchfiles		patch-BuildAll

worksrcdir		driver

post-patch	{
	reinplace "s|/usr/bin|${destroot}${prefix}/bin|g" ${worksrcpath}/configure
	reinplace "s|/usr/lib/poly:/usr/local|${prefix}|g" ${worksrcpath}/configure
}

post-configure {
	cd ${workpath}/mlsource/MLCompiler/CodeTree
	file link CodeCons CodeCons.power
}

# We need to build the base driver, and then bootstrap the ML database 
# with the precompiled ML_dbase.
post-build {
    system "cd ${workpath} && ./driver/poly ML_dbase < mlsource/BuildAll.sml"
}

post-destroot {
	xinstall -m 755 -d ${destroot}${prefix}/lib/poly
	xinstall -m 644 ${workpath}/DB413Release \
		${destroot}${prefix}/lib/poly/ML_dbase
}
