# $Id$

PortSystem 1.0

name                caml-heredoc
version             20060107
revision            3
categories          devel ml
license             LGPL-2.1
maintainers         nomaintainer
description         Heredoc: syntactic sugar for text producing applications
long_description    Without any doubt, OCaml is a great langage for Web publishing. \
                    I used it for a long time to produce my static web pages and more \
                    recently to write some CGI scripts. \
                    HereDoc is an attempt to provide syntactic sugar for such applications.
homepage            http://www.eleves.ens.fr/home/frisch/soft.html
platforms           darwin
master_sites        http://www.eleves.ens.fr/home/frisch/info/

checksums           md5 b1032fcbb61c42cf0600083181c0a84e \
                    sha1 cb102e7adf0b2539c86a026f8111f36f2aaa9007
distfiles           HereDoc-${version}.tar.gz
worksrcdir          HereDoc

livecheck.type      regex
livecheck.regex     "HereDoc-(.*?).tar.gz"

patchfiles          patch-Makefile

depends_lib         port:ocaml port:ocaml-findlib

use_configure       no

proc ocamlfind_destdir {} {
    # only bother calculating this darn thing once
    variable ocamlfind_destdir {}
    variable destroot
    variable prefix
    if {![string length $ocamlfind_destdir]} {
        set ocamlfind_destdir ${destroot}[exec ${prefix}/bin/ocamlfind printconf destdir]
    }
    return $ocamlfind_destdir
}

pre-destroot {
        file mkdir [ocamlfind_destdir]
        reinplace s|##PREFIX##|${prefix}| ${worksrcpath}/Makefile
        reinplace s|##DESTDIR##|[ocamlfind_destdir]| ${worksrcpath}/Makefile
}

post-destroot {
        xinstall -d [ocamlfind_destdir]/HereDoc/doc/
        xinstall -m 644 ${worksrcpath}/doc.html [ocamlfind_destdir]/HereDoc/doc/index.html
}