# $Id$
PortSystem          1.0
PortGroup           github 1.0

github.setup        keplerproject xavante 2.2.1 v
name                lua-xavante
license             GPL-3
categories          devel www
maintainers         nomaintainer
description         A Lua Web Server with WSAPI support
long_description    Xavante is a Lua HTTP 1.1 Web server that uses a modular architecture \
					based on URI mapped handlers. Xavante currently offers a file handler, a \
					redirect handler and a WSAPI handler. Those are used for general files, \
					URI remapping and WSAPI applications respectively.
homepage            http://keplerproject.github.com/xavante/ 
platforms           darwin
checksums           md5     fbbb0655095bcd6b8345095f39470a1a \
                    sha1    9b75b3750bc058eb8af115d081d56d76c67fa4dc \
                    rmd160  75c2a41d3c333d7e05a221eec2f816431ee8b515
patchfiles          patch-Makefile.diff \
					patch-config.diff
post-patch {
   reinplace "s|%%PREFIX%%|${prefix}|g" ${worksrcpath}/config
}
depends_lib         port:lua \
					port:lua-wsapi \
					port:lua-copas \
					port:lua-luasocket \
					port:lua-luafilesystem
use_configure		no

post-destroot {
    file copy ${worksrcpath}/src/codeweb ${worksrcpath}/src/webdav ${destroot}${prefix}/share/lua/5.1
    xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
    xinstall -m 644 ${worksrcpath}/README ${destroot}${prefix}/share/doc/${name}
    eval xinstall -m 644 [glob ${worksrcpath}/doc/us/*] ${destroot}${prefix}/share/doc/${name}

    xinstall -m 755 -d ${destroot}${prefix}/share/examples/${name}
    file copy ${worksrcpath}/examples ${worksrcpath}/web ${destroot}${prefix}/share/examples/${name}
    file rename ${destroot}${prefix}/share/examples/${name}/examples \
                ${destroot}${prefix}/share/examples/${name}/config 
}

# https://github.com/keplerproject/xavante/issues/6
livecheck.url       ${homepage}
livecheck.regex     {(?i)current version is ([0-9.]+)}