PortSystem          1.0

name                ocaml-postgresql
version             1.18.0
revision            4
categories          ocaml devel
maintainers         nomaintainer
license             LGPL-2.1
description         OCaml-interface to the PostgreSQL-database
long_description    This OCaml-library provides an interface to PostgreSQL \
                    Almost all functionality available through the C-API \
                    (libpq) is replicated in a type-safe way. This library \
                    uses objects for representing database connections and \
                    results of queries.

homepage            https://bitbucket.org/mmottl/postgresql-ocaml
platforms           darwin
master_sites        https://bitbucket.org/mmottl/postgresql-ocaml/downloads/

distname            postgresql-ocaml-${version}

checksums           rmd160  c896128f9edd39e45b39201742bb1d8d52562bc6 \
                    sha256  ec52fd469cf06aabd67d79cadedc153492d4b398351d10ee01b532d377403840

depends_lib         port:ocaml \
                    port:ocaml-findlib \
                    port:postgresql83

post-patch {
    set ocaml_site_path [exec ocamlfind printconf destdir]

    reinplace s|pg_config|${prefix}/lib/postgresql83/bin/pg_config|g \
        ${worksrcpath}/Makefile.conf

    reinplace       "s|\$(OCAMLFIND) install|\$(OCAMLFIND) install -destdir ${destroot}/${ocaml_site_path}|g" \
                    ${worksrcpath}/OCamlMakefile
}

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

use_configure        no