# $Id: Portfile 88528 2012-01-04 02:01:55Z mww@macports.org $

PortSystem          1.0

name                ocaml-json-static
version             0.9.8
categories          devel ml
maintainers         nomaintainer
description         JSON validator and type converter for OCaml
long_description    This library converts parsed JSON data with an unchecked structure \
                    into specialized OCaml types and vice-versa. It is a complement to \
                    the caml-json-wheel package which provides a parser and pretty-printer.
homepage            http://martin.jambon.free.fr/json-static.html
platforms           darwin
master_sites        http://martin.jambon.free.fr/

distname            json-static-${version}
use_bzip2           yes

checksums           md5     a8b586a4c7851f5e34c28da60ebf8904 \
                    sha1    4bbcc49340e1f23af6f59fc41eb687e32de7350a \
                    rmd160  8f6a9e886ddd5beff91a263b967a3c6ab95d0806

depends_lib         port:ocaml \
                    port:ocaml-findlib \
                    port:ocaml-json-wheel

use_configure       no
use_parallel_build  no

livecheck.type      regex
livecheck.url       http://martin.jambon.free.fr/json-static.html
livecheck.regex     {>json-static-(.*)\.tar\.gz}

post-patch {
    set ocaml_site_path [exec ocamlfind printconf destdir]
    reinplace       "s|\$(OCAMLFIND) install|\$(OCAMLFIND) install -destdir ${destroot}/${ocaml_site_path}|g" \
                    ${worksrcpath}/Makefile
}

build.target        all

pre-destroot {
    set ocaml_site_path [exec ocamlfind printconf destdir]
    file mkdir ${destroot}/${ocaml_site_path}/stublibs
}

pre-destroot {
    destroot.args DESTDIR="${destroot}" OCAMLFIND_DESTDIR="${destroot}/[exec ${prefix}/bin/ocamlfind printconf destdir]"
}
