# $Id: Portfile 78228 2011-04-29 02:42:44Z ryandesign@macports.org $

PortSystem 1.0

name                lua-luasocket
version             2.0.2
revision            1
categories          devel
platforms           darwin
maintainers         gmail.com:emmett.shear

description         The luasocket library extends lua with tcp, udp, and dns
long_description    LuaSocket is a Lua extension library that is composed by two parts: \
                    a C core that provides support for the TCP and UDP transport layers, \
                    and a set of Lua modules that add support for functionality commonly \
                    needed by applications that deal with the Internet.

homepage            http://www.cs.princeton.edu/~diego/professional/luasocket/

master_sites        http://luaforge.net/frs/download.php/2664/
checksums           md5     41445b138deb7bcfe97bff957503da8e \
                    sha1    5ce521fc5c6efb7c1eba7f36dfeafa9e4d745464 \
                    rmd160  24d7e4fb1c9cf0c3d94f8b36e82d494ae922e268
distname            luasocket-${version}

depends_lib         port:lua

livecheck.type      regex
livecheck.url       http://luaforge.net/frs/?group_id=23
livecheck.regex     {luasocket-([0-9.]+)\.tar\.gz}

patchfiles          patch-config.diff

use_configure       no

post-patch {
    reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/config
}

post-destroot {
    xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
    xinstall -m 755 -d ${destroot}${prefix}/share/examples/${name}
    
    eval xinstall -m 644 [glob ${worksrcpath}/doc/*] ${destroot}${prefix}/share/doc/${name}
    xinstall -m 644 ${worksrcpath}/LICENSE ${worksrcpath}/NEW \
        ${worksrcpath}/README ${destroot}${prefix}/share/doc/${name}
    file copy ${worksrcpath}/etc ${worksrcpath}/samples ${worksrcpath}/test \
        ${destroot}${prefix}/share/examples/${name}
}
