# $Id: Portfile 79963 2011-06-30 23:19:16Z ryandesign@macports.org $

PortSystem          1.0

name                caml-camomile
version             0.8.3
categories          devel ml
maintainers         toots@rastageeks.org
description         OCaml module to convert strings to and from various encodings
homepage            http://camomile.sf.net/
platforms           darwin
master_sites        sourceforge:camomile
distname            camomile-${version}
use_bzip2           yes

checksums           sha1    9f2600010820689805b5ab6e4048217ea821d535 \
                    rmd160  56651ff4625dbdd9876784c1369c5a6ed6b290a6

depends_lib         port:ocaml port:caml-findlib

# ocaml is not universal
universal_variant   no

configure.cflags    {}
configure.cxxflags  {}
configure.cppflags  {}
configure.ldflags   {}
configure.cxx       {}
configure.objc      {}
configure.cpp       {}
configure.cc        {}

build.args          LIBDIRS=${prefix}/lib
use_parallel_build  no

proc ocamlfind_destdir {} {
    # only bother calculating this darn thing once
    variable ocamlfind_destdir {}
    variable destroot
    variable prefix
    if {![string length $ocamlfind_destdir]} {
        set ocamlfind_destdir ${destroot}[exec ${prefix}/bin/ocamlfind printconf destdir]
    }
    return $ocamlfind_destdir
}

pre-destroot {
  system "mkdir -p [ocamlfind_destdir]"
  reinplace "s#ocamlfind install#ocamlfind install -ldconf ignore -destdir '[ocamlfind_destdir]'#g" ${worksrcpath}/Makefile
  reinplace "s#\$(DATADIR)#${destroot}\$(DATADIR)#g" ${worksrcpath}/Makefile
  reinplace "s#\$(BINDIR)#${destroot}\$(BINDIR)#g" ${worksrcpath}/Makefile
}

livecheck.type      regex
livecheck.regex     "camomile-(.*?).tar.bz2"
