# $Id: Portfile 87771 2011-12-05 14:15:09Z mww@macports.org $

PortSystem 1.0

name              mosml
version           2.01
revision          2
categories        lang devel ml
platforms         darwin
maintainers       rift.dk:cso
description       Moscow ML is an implementation of Standard ML (SML)
long_description  Moscow ML is a light-weight implementation of Standard ML\
                  (SML), a strict functional language widely used in teaching\
                  and research. Version 2.01 implements the full SML language,\
                  including SML Modules, and much of the SML Basis Library.
homepage          http://www.dina.dk/~sestoft/mosml.html
master_sites      http://www.dina.kvl.dk/~sestoft/mosml
distfiles         mos201src.tar.gz
checksums         md5 74aaaf988201fe92a9dbfbcb1e646f70
patchfiles        patch-src-Makefile.diff\
                  patch-src-Makefile-inc.diff\
                  patch-src-launch-Makefile.diff\
                  patch-src-dynlibs.diff \
                  patch-src-runtime-mosml.c.diff \
                  patch-src-runtime-sys.c.diff

worksrcdir        mosml

post-patch {
   reinplace  "s|LD=gcc|LD=${configure.cc}|"      ${worksrcpath}/src/Makefile.inc
   reinplace  "s|CC=gcc|CC=${configure.cc}|"      ${worksrcpath}/src/Makefile.inc
   reinplace  "s|CCP=|CPP=${configure.cpp}|"      ${worksrcpath}/src/Makefile.inc
}

configure.dir     ${worksrcpath}/src/config
configure.cmd     ./autoconf
configure.pre_args ${configure.cc}

build.target      world
build.pre_args    -Csrc DESTROOT=${prefix} ${build.target}

destroot.pre_args -Csrc DESTROOT=${destroot}${prefix} ${destroot.target}
post-destroot {
   system "ln -sf ${prefix}/bin/camlrunm ${destroot}${prefix}/lib/mosml/camlrunm"
}

