# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
# $Id$

PortSystem 1.0

name		nhc98
version		1.20
revision    1
categories	lang
maintainers	nomaintainer
platforms	darwin
license         {LGPL BSD}
description	The nhc98 Haskell Compiler
long_description \
    nhc98 is a small, easy to install, standards-compliant \
    compiler for Haskell 98, the lazy functional \
    programming language. It is very portable, and aims to	\
    produce small executables that run in small amounts of \
    memory. It produces medium-fast code, and compilation \
    is itself quite fast. It also comes with extensive tool	\
    support for automatic compilation, foreign language	\
    interfacing, heap and time profiling, tracing, and \
    debugging. Some of its advanced kinds of heap \
    profiles are not found in any other Haskell compiler.

homepage http://www.haskell.org/${name}
master_sites \
    http://www.cs.york.ac.uk/fp/${name} \
    ftp://ftp.cs.york.ac.uk/pub/haskell/${name}

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

checksums \
    md5 55c102408da8085aa56984af4151eb9c \
    sha1 5bcfa0e8cc192afc5a54aab0bd4c1812dafa7b45 \
    rmd160 011e723a956f2fb9029357d00ddb705c350309af

depends_lib port:readline port:ncurses

configure.args \
    --buildwith=gcc \
    +docs \
    --docdir=${prefix}/share/doc/${name} \
    --mandir=${prefix}/share/man/man1 \
    --heap=8M

patchfiles patch-Makefile.nhc98.diff

post-patch {
    reinplace "s|-\$(CC)|-\${BUILDCOMP}|g" ${worksrcpath}/Makefile
}

post-destroot {
    set rexp1 "'s|${worksrcpath}/script|${prefix}/bin|g'"
    set rexp2 "'s|${worksrcpath}/include|${prefix}/include/nhc98|g'"
    set rfile "${destroot}${prefix}/lib/hmake/`${worksrcpath}/script/harch`/hmakerc"
    system "sed -i '' -e ${rexp1} -e ${rexp2} ${rfile}"
}

livecheck.type   regex
livecheck.regex  "Version (.*) released"