# $Id: Portfile 88485 2012-01-03 11:01:15Z mww@macports.org $

PortSystem 1.0

name                ocaml-extlib
version             1.5.2
revision            1
categories          devel ml
maintainers         mww openmaintainer
license             LGPL-2.1
description         Extended Standard Library for OCaml
long_description    A User-supported Extended Standard Library for OCaml
homepage            http://code.google.com/p/ocaml-extlib/
platforms           darwin
master_sites        googlecode:ocaml-extlib

checksums           md5     839f9bf5a971fa07935c96ba7e209f86 \
                    rmd160  ff554b614c099bce562f82b148067c731eddf059 \
                    sha256  ca6d69adeba4242ce41c02a23746ba1e464c0bbec66e2d16b02c3c6e85dc10aa
distname            extlib-${version}

patchfiles          patch-install.ml

depends_lib         port:ocaml port:ocaml-findlib

use_configure       no

build {}

destroot.cmd        "${prefix}/bin/ocaml"
destroot.pre_args   install.ml
destroot.args       -b -n -doc
destroot.post_args

pre-destroot {
        set extlib_destdir ${destroot}[exec ${prefix}/bin/ocamlfind printconf destdir]
        xinstall -m 755 -d ${extlib_destdir}
        reinplace s|##PREFIX##|${prefix}| ${worksrcpath}/install.ml
        reinplace s|##DESTDIR##|${extlib_destdir}| ${worksrcpath}/install.ml
}

post-destroot {
    xinstall -m 755 -d ${destroot}${prefix}/share/doc
    file copy ${worksrcpath}/extlib-doc ${destroot}${prefix}/share/doc/${name}
}
