# -*- 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        mirage ocaml-cohttp 6.2.1 v
revision            2
categories          ocaml net devel
maintainers         {@barracuda156 macos-powerpc.org:barracuda} openmaintainer
license             ISC
description         OCaml library for HTTP clients and servers
long_description    {*}${description}
use_bzip2           yes
extract.suffix      .tbz
distname            cohttp-${version}
checksums           rmd160  4f15d8b2846ecb6cb6f34185ed1247685ed1938c \
                    sha256  65080247763442d1dc3cd90678b8233b798772f036ac81cd1eaade1f5d66a65f \
                    size    148116
github.tarball_from releases

if {${subport} ne "ocaml-http"} {
    depends_lib-append \
                    port:ocaml-http \
                    port:ocaml-logs \
                    port:ocaml-ppx_sexp_conv
    if {${subport} eq ${name}} {
        depends_lib-append \
                    port:ocaml-base64 \
                    port:ocaml-ipaddr \
                    port:ocaml-re \
                    port:ocaml-sexplib0 \
                    port:ocaml-stringext \
                    port:ocaml-uri \
                    port:ocaml-uri-sexp
    }
}

ocaml.build_type    dune

subport ocaml-http {
    description     Type definitions of HTTP essentials
}

subport ${name}-lwt {
    description     CoHTTP implementation using the Lwt concurrency library

    depends_lib-append \
                    port:ocaml-cohttp \
                    port:ocaml-ipaddr \
                    port:ocaml-lwt \
                    port:ocaml-sexplib0 \
                    port:ocaml-uri
}

subport ${name}-lwt-unix {
    description     CoHTTP implementation for Unix and Windows using Lwt

    depends_lib-append \
                    port:ocaml-cmdliner \
                    port:ocaml-cohttp \
                    port:ocaml-cohttp-lwt \
                    port:ocaml-conduit-lwt \
                    port:ocaml-conduit-lwt-unix \
                    port:ocaml-fmt \
                    port:ocaml-lwt \
                    port:ocaml-magic-mime
}

subport ${name}-top {
    description     CoHTTP toplevel pretty printers for HTTP types

    depends_lib-append \
                    port:ocaml-cohttp
}
