# -*- 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           github 1.0
PortGroup           ocaml 1.1

github.setup        ocsigen lwt 5.7.0
revision            1

name                ocaml-lwt
categories          ocaml devel
maintainers         {landonf @landonf} openmaintainer
license             MIT
description         Promises and event-driven I/O for OCaml
long_description    Lwt provides typed, composable promises for OCaml, \
                    with support for parallel resolution.

homepage            https://github.com/ocsigen/lwt

depends_build-append \
                    port:ocaml-cppo
depends_lib-append  port:ocaml-dune-configurator \
                    port:ocaml-findlib \
                    port:ocaml-ocplib-endian

checksums           rmd160  3e489440f58eafc503a5222f55da753ac094969d \
                    sha256  371031c38071f6f1b1b815cbe07f436c013af8fd8c4862c57a12e37c15c8b785 \
                    size    313632
github.tarball_from archive

post-patch {
    # We don't need the seq package
    reinplace -E {s|\(libraries(.*)seq|(libraries\1|g} \
        src/core/dune

    # Fail the build if the unix module cannot be built
    reinplace -E {s|\(optional\)||g} \
        src/unix/dune
}

ocaml.build_type    dune

subport ${name}_ppx {
    revision        1

    depends_lib-append \
                    port:${name} \
                    port:ocaml-ppxlib
}

subport ${name}_react {
    version         1.2.0
    revision        1
    description     Helpers for using React with Lwt

    depends_build-append \
                    port:ocaml-cppo
    depends_lib-append \
                    port:${name} \
                    port:ocaml-react
}
