# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 41887 2008-11-12 00:59:56Z nox@macports.org $

PortSystem      1.0

name            ocaml-bitstring
version         2.0.0
platforms       macosx
categories      devel ocaml
maintainers     nox openmaintainer
description     bitstrings and bitstring matching for OCaml

long_description \
    The ocaml-bitstring project adds Erlang-style bitstrings and matching over bitstrings as a syntax extension and library for OCaml. \
    (This project was formerly known as bitmatch). You can use this module to both parse and generate binary formats, files and protocols. \
    Bitstring handling is added as primitives to the language, making it exceptionally simple to use and very powerful.

homepage        http://code.google.com/p/bitstring/
master_sites    googlecode:bitstring

checksums       md5     9f597c267318a88f2754ca10450e478f \
                sha1    ca54f7cd2e1457d9102200fd8aebb3dce3d10a32 \
                rmd160  74d24e4a75915707f47319f010634396e2c96a0b

patchfiles      patch-Makefile.in-ocamlfind.diff \
                patch-Makefile.in-top_srcdir.diff

depends_build   port:caml-findlib
depends_lib     port:ocaml
depends_run     port:caml-findlib

use_parallel_build  yes

test.run        yes

pre-destroot {
    file mkdir $destroot$prefix/lib/ocaml/site-lib
}

post-activate {
    set ldconf  [open $prefix/lib/ocaml/ld.conf r+]
    set found   0

    while {[gets $ldconf line] != -1} {
        if {$line eq "$prefix/lib/ocaml/site-lib/bitstring"} {
            set found 1
            break
        }
    }

    if {!$found} {
        puts $ldconf $prefix/lib/ocaml/site-lib/bitstring
    }

    close $ldconf
}

livecheck.check regex
livecheck.regex $name-(\\d+(?:\\.\\d+)*)
