# $Id: Portfile 98499 2012-10-07 11:42:35Z mww@macports.org $

PortSystem          1.0

name                ocaml-ocamlnet
version             3.6
revision            2
categories          devel ml
maintainers         landonf openmaintainer
license             {BSD GPL-2 LGPL-2}
description         Internet protocols and helper data structures for OCaml.
long_description    Internet protocols (http, cgi, email etc.) and helper \
                    data structures (mail messages, character sets, etc.) \
                    Ocamlnet implements a number of Internet protocols (http \
                    client & server, cgi and cgi variants, SunRPC, FTP, POP, \
                    SMTP) and is a strong base for web and Internet \
                    programming.

homepage            http://projects.camlcity.org/projects/ocamlnet.html
platforms           darwin
master_sites        http://download.camlcity.org/download/

distname            ocamlnet-${version}

checksums           rmd160  3a1af8bc573150a26437e2c7feff3126b1ebfa9e \
                    sha256  306c20aee6512be3564c0f39872b70f929c06e1e893cfcf528ac47ae35cf7a69

depends_lib         port:ocaml \
                    port:ocaml-findlib \
                    port:ocaml-pcre

# ocaml is not universal
universal_variant   no

post-patch {
    set ocaml_site_path [exec ocamlfind printconf destdir]
    reinplace       "s|\$(OCAMLFIND) install|\$(OCAMLFIND) install -destdir ${destroot}/${ocaml_site_path}|g" \
                    ${worksrcpath}/Makefile
}

configure.pre_args
configure.args      -enable-pcre

build.target        all opt
use_parallel_build  no

pre-destroot {
    set ocaml_site_path [exec ocamlfind printconf destdir]
    file mkdir ${destroot}${ocaml_site_path}/stublibs
    destroot.args DESTDIR="${destroot}" OCAMLFIND_DESTDIR="${destroot}${ocaml_site_path}"
}

livecheck.type      regex
livecheck.regex     {ocamlnet-(\d+(?:\.\d+)*)\.tar}
