# $Id: Portfile 38744 2008-07-30 02:21:39Z landonf@macports.org $

PortSystem          1.0

name                caml-postgresql
version             1.8.2
revision            1
categories          devel ml
maintainers         landonf openmaintainer
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            http://www.ocaml.info/home/ocaml_sources.html
platforms           darwin
master_sites        http://www.ocaml.info/ocaml_sources/

distname            postgresql-ocaml-${version}

checksums           md5 2e08be3b40c67af09cdd713538d0dd50 \
                    sha1 dcd6f0be8aa756c0233c53357ce937475c412f9c \
                    rmd160 bf590dbeb48cb7632dcb1b6a1e5734ee75b88912

depends_lib         port:ocaml \
                    port:caml-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
