# $Id: Portfile 64731 2010-03-15 13:12:36Z nox@macports.org $

PortSystem          1.0

name                caml-ocamlnet
version             2.2.9
categories          devel ml
maintainers         landonf openmaintainer
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           md5 3655e3be3bb2806e0a1f48bb7ce16fb3 \
                    sha1 ca073c60f86fede60d4c479e5589127010482804 \
                    rmd160 1299e1316e0547171089b0caaa9deb13c4c67c31


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

patchfiles          patch-rpcgen.diff

post-patch {
    set ocaml_site_path [exec ocamlfind printconf destdir]
    reinplace       "s|\$(OCAMLFIND) install|\$(OCAMLFIND) install -destdir ${destroot}/${ocaml_site_path}|g" \
                    ${worksrcpath}/Makefile
    reinplace       "s|@CPP@|${configure.cpp}|g" \
                    ${worksrcpath}/src/netplex/Makefile.pre \
                    ${worksrcpath}/src/rpc/Makefile.pre \
                    ${worksrcpath}/src/rpc-auth-dh/Makefile.pre
}

configure.pre_args

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}
