# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           legacysupport 1.1

# O_CLOEXEC
legacysupport.newest_darwin_requires_legacy 10

name                ocaml-ocamlnet
version             4.1.9
revision            0
categories          ocaml devel
maintainers         nomaintainer
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
master_sites        http://download.camlcity.org/download/

distname            ocamlnet-${version}

checksums           rmd160  e5518628bf13195b8ac45088bf78c21ae24d084c \
                    sha256  f98ed19979848f1949b1b001e30ac132b254d0f4a705150c6dcf9094bbec9cee \
                    size    4628747

depends_lib-append  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-append \
                    -enable-pcre

if {${build_arch} in [list ppc ppc64]} {
    build.target    all
} else {
    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}
