# -*- 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                   luarocks 1.1
PortGroup                   github 1.0

name                        lua-lgi
luarocks.module             lgi

if {${subport} ne "lua51-lgi"} {
    github.setup            pavouk lgi 0.9.2
    # Change github.tarball_from to 'releases' or 'archive' next update
    github.tarball_from     tarball
    revision                0

    checksums               rmd160  ed5a2018423276ab8509f167ee8a405cce4fecdd \
                            sha256  e019e61b75d25bd2bf3fc0cab2f1c380911db2061a32a35fbff61867661d3117 \
                            size    291502
} else {
    # see https://github.com/lgi-devs/lgi/issues/236

    github.setup            pavouk lgi 0.9.0
    # Change github.tarball_from to 'releases' or 'archive' next update
    github.tarball_from     tarball
    revision                0

    checksums               rmd160  8d6132368e183c246520a3b7e2d85c597e3b2d1f \
                            sha256  6fdaaa0aecb0cbf98c93dd35fd94daa972e82a4229ed1dbe2a66300a1027c060 \
                            size    285297
}

maintainers                 nomaintainer
license                     MIT

description                 Lua bindings to GObject libraries
long_description            Dynamic Lua binding to any library which is introspectable \
                            using gobject-introspection.  Allows using GObject-based libraries \
                            directly from Lua.

depends_build-append        port:pkgconfig
depends_lib-append          path:lib/pkgconfig/gobject-introspection-1.0.pc:gobject-introspection

patchfiles                  patch-dylib-path.diff
post-patch {
    reinplace               "s|%PREFIX%|${prefix}|g" \
                            ${worksrcpath}/lgi/core.c
}

luarocks.build_type         make

pre-build {
    system -W ${build.dir} "make rock"
}
