# -*- 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

epoch           20111014
github.setup    mochi mochiweb 3.2.2 v
categories      erlang www
license         MIT
maintainers     nomaintainer
supported_archs noarch
platforms       any

description     MochiWeb is an Erlang library for building lightweight HTTP servers.

long_description \
    {*}${description}

depends_lib     port:erlang
depends_build-append \
                port:rebar3

checksums       rmd160  e27a96541925bfb492bca718ab8af1f179b82d51 \
                sha256  59b0d90e01e1fe44691c29a58def27930d6c31bc5f64d58d166e9df661b0edb8 \
                size    140961
github.tarball_from archive

use_configure   no
build.target-append edoc

set libdir ${prefix}/lib/erlang/lib/${name}

destroot {
    xinstall -d ${destroot}${libdir}
    copy ${worksrcpath}/_build/default/lib/${name}/ebin ${destroot}${libdir}/ebin
    copy ${worksrcpath}/include ${destroot}${libdir}/include
    copy ${worksrcpath}/scripts ${destroot}${libdir}/scripts
    copy ${worksrcpath}/src ${destroot}${libdir}/src

    set docdir ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${docdir}
    xinstall -m 644 -W ${worksrcpath} CHANGES.md LICENSE README.md ${destroot}${docdir}
    copy ${worksrcpath}/doc ${destroot}${docdir}/html
    copy ${worksrcpath}/examples ${destroot}${docdir}
    xinstall -m 644 ${filespath}/README.MacPorts ${destroot}${docdir}
    reinplace s:@PREFIX@:${prefix}: ${destroot}${docdir}/README.MacPorts
}

test.run yes
