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

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

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

build() {
  cd ${_realname}-${pkgver}
  make CC=${CC}
}

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

  install -Dm644 LICENSE-MIT "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}
