PortSystem          1.0

name                ocaml-camomile
version             0.8.3
revision            4
categories          ocaml devel
maintainers         {rastageeks.org:toots @toots}
license             LGPL-2+
description         OCaml module to convert strings to and from various encodings
long_description    ${description}
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:ocaml-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"