# $Id: Portfile 54465 2009-07-28 05:23:21Z ryandesign@macports.org $

PortSystem          1.0

name                caml-json-static
version             0.9.6
categories          devel ml
maintainers         anil@recoil.org
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 7ffc8c00353a6fc14fde490c4edeb1d0 \
                    sha1 f1b032ac702acb5b421075b25d3910b23268a1cc \
                    rmd160 dd5d84992fd68c1230e1e8b6e26707324d491f78

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

use_configure       no

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]"
}
