# Maintainer: Ricky Wu <rickleaf.wu@gmail.com>

_realname=lgi
pkgbase=mingw-w64-lua-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-lua51-${_realname}"
pkgver=0.9.2
pkgrel=2
pkgdesc="LGI is gobject-introspection based dynamic Lua binding to GObject based libraries (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64')
url="https://github.com/pavouk/lgi"
license=("MIT")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc")
depends=("${MINGW_PACKAGE_PREFIX}-lua51"
         "${MINGW_PACKAGE_PREFIX}-gtk3"
         "${MINGW_PACKAGE_PREFIX}-libffi"
         "${MINGW_PACKAGE_PREFIX}-gobject-introspection")
source=(${_realname}-${pkgver}.zip::"https://github.com/pavouk/${_realname}/archive/${pkgver}.zip"
        "001-lua5.1.patch")
sha256sums=('c6cdb7cca6b745790454b45ebb9c3e8be96aca948c7d640d79c969a1c78b35e9'
            '7c10a414e57f07a89fd1847b5d1c4baf61dc568c2737841eb94a6f2c76b3a5c5')

prepare() {
  cd "${srcdir}/${_realname}-${pkgver}"
  patch -p1 -i ${srcdir}/001-lua5.1.patch
}

build() {
  cd "${srcdir}/${_realname}-${pkgver}"
  make
}

package() {
  cd "${srcdir}/${_realname}-${pkgver}"
  make PREFIX=${MINGW_PREFIX} DESTDIR=${pkgdir} install
}
