# Maintainer: Rui Abreu Ferreira <raf-ep@gmx.com>

_realname=libmpack
pkgbase=mingw-w64-lua-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgdesc="Simple implementation of msgpack in C (mingw-w64)"
pkgver=1.0.5
pkgrel=1
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
url='https://github.com/libmpack/libmpack'
license=('MIT')
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc")
source=("${_realname}-${pkgver}.tar.gz"::"https://github.com/libmpack/libmpack/archive/${pkgver}.tar.gz"
        01-make.patch)
sha256sums=('4ce91395d81ccea97d3ad4cb962f8540d166e59d3e2ddce8a22979b49f108956'
            'bb39a2523be0c0633c0c256fd5cb4acf4ddf774fc28f062faeb9e18943307358')

prepare() {
  cd libmpack-${pkgver}
  patch -p1 -i ${srcdir}/01-make.patch
}

build() {
  cd libmpack-${pkgver}
  make
}

package() {
  cd libmpack-${pkgver}
  make -j1 DESTDIR="${pkgdir}/" PREFIX=${MINGW_PREFIX} install
  install -Dm644 LICENSE-MIT "${pkgdir}${MINGW_PREFIX}/share/licenses/libmpack/LICENSE"
}
