# Maintainer: Ricky Wu <rickleaf.wu@gmail.com>
_realname=winapi
pkgbase=mingw-w64-lua-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-lua51-${_realname}")
pkgver=1.4.2
pkgrel=1
pkgdesc="Minimal but useful Lua bindings to the Windows API"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
url="https://stevedonovan.github.io/winapi/api.html"
license=("LGPL")
depends=("${MINGW_PACKAGE_PREFIX}-lua51")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc")

options=('staticlibs' 'strip')
source=(${_realname}-${pkgver}.tar.gz::"https://github.com/stevedonovan/winapi/archive/${pkgver}.tar.gz"
        "Makefile.mingw")

sha256sums=('93fb4dda975a6bea6d1a649047f8e1352527065681443d65aee054ee32c68716'
            '5f5cea4508c88a69e9c6abcad1ce77909da8323843a6db162ac66410320fac26')

prepare() {
  cd "${srcdir}/${_realname}-${pkgver}"
  mkdir -p tmp
}

build() {
  cd "${srcdir}/${_realname}-${pkgver}"
  cp ../Makefile.mingw .
  make -f Makefile.mingw
}

package() {
  cd "${srcdir}/${_realname}-${pkgver}"
  install -Dm755 winapi.dll "${pkgdir}${MINGW_PREFIX}/lib/lua/5.1/winapi.dll"
}
