# $Id: Portfile 77702 2011-04-09 20:49:18Z and.damore@macports.org $
PortSystem          1.0
name                luarocks
version             2.0.4.1
revision            2
categories          devel
platforms           darwin
maintainers         and.damore openmaintainer
description         Manager for rocks, lua extensions.
long_description    \
    LuaRocks is a deployment and management system for Lua modules that allows \
    you to install self-contained modules (\"rocks\") which also contain \
    version dependency information. It handles both install time dependencies \
    and runtime version check. LuaRocks supports local and remote \
    repositories, and multiple local rocks trees.

homepage            http://www.luarocks.org/
master_sites        http://luarocks.org/releases/
depends_run         port:lua
universal_variant   no

checksums           md5     2c7caccce3cdf236e6f9aca7bec9bdea \
                    sha1    18939a8c5931a3ec51d29c9dd71715bf19e30510 \
                    rmd160  0c6a8dd420103042c99c5ec7c6416b0af13d95ce

configure.args      --with-lua=${prefix} \
                    --rocks-tree=${prefix}/share/${name}

patchfiles          patch-src_luarocks_cfg.lua.diff

variant md5 conflicts openssl description { Use md5 as checker } {
    configure.args-append   --with-md5-checker=md5sum
}
    
variant openssl conflicts md5 description { Use openssl as checker } {
    configure.args-append   --with-md5-checker=openssl
    depends_run-append  port:openssl
}

if {![variant_isset md5]} {
    default_variants +openssl
}

variant wget conflicts curl description { Use wget as downloader } {
    configure.args-append   --with-downloader=wget
    depends_run-append  port:wget
}

variant curl conflicts wget description { Use curl as downloader } {
    configure.args-append   --with-downloader=curl
    depends_run-append  port:curl
}

if {![variant_isset wget]} {
    default_variants +curl
}

destroot.keepdirs  ${destroot}${prefix}/share/luarocks/  
post-destroot {
    xinstall -m 755 -d ${destroot}${prefix}/share/luarocks/
}
