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

PortSystem          1.0
PortGroup           github 1.0

github.setup        tarruda libmpack 1.0.2
name                lua-mpack
set lua_version     5.3
categories          devel lua
platforms           darwin
maintainers         nomaintainer
license             MIT

description         msgpack for Lua
long_description    libmpack is a simple implementation of msgpack. \
                    This port provides bindings for Lua.

checksums           rmd160  101a8a1321b144ff107b437ab2aa49cde60299f0 \
                    sha256  d0b44fc0d8282fe296fcc2d2ea790ff0714969f6672b7d673bd8b3b8bab64e99

depends_build       port:libtool

patchfiles          patch-lua53.diff
patch.pre_args      -p1

use_configure no

build.args          VERBOSE=1 \
                    CC="${configure.cc} [get_canonical_archflags]" \
                    config=release \
                    LIBDIR=${prefix}/lib

build {
    system -W ${worksrcpath}/binding/lua/ "${configure.cc} [get_canonical_archflags] ${configure.optflags} -ansi -shared -I${prefix}/include -L${prefix}/lib -o mpack.so lmpack.c -llua"
}

destroot {
    xinstall -d -m 0755 ${destroot}${prefix}/lib/lua/${lua_version}
    xinstall -m 0644 ${worksrcpath}/binding/lua/mpack.so ${destroot}${prefix}/lib/lua/${lua_version}/
    xinstall -d -m 0755 ${destroot}${prefix}/share/doc/${name}
    xinstall -m 0644 ${worksrcpath}/LICENSE-MIT ${destroot}${prefix}/share/doc/${name}/
}