# Maintainer: Christopher Degawa <ccom@randomderp.com>

_realname=jo
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=1.9
pkgrel=1
pkgdesc='JSON output from a shell (mingw-w64)'
arch=(any)
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64')
url='https://github.com/jpmens/jo'
license=(GPL2)
makedepends=("${MINGW_PACKAGE_PREFIX}-autotools" "${MINGW_PACKAGE_PREFIX}-cc")
source=("https://github.com/jpmens/$_realname/releases/download/$pkgver/$_realname-$pkgver.tar.gz")
sha256sums=('0195cd6f2a41103c21544e99cd9517b0bce2d2dc8cde31a34867977f8a19c79f')

build() {
  mkdir -p "${srcdir}/build-${MSYSTEM}" && cd "${srcdir}/build-${MSYSTEM}"

  ../${_realname}-${pkgver}/configure \
    --prefix="${MINGW_PREFIX}" \
    --build="${MINGW_CHOST}" \
    --host="${MINGW_CHOST}"
  make
}

check() {
  make -C "${srcdir}/build-${MSYSTEM}" check
}

package() {
  DESTDIR="${pkgdir}" make -C "${srcdir}/build-${MSYSTEM}" install

  # License
  install -Dm644 "${srcdir}/${_realname}-${pkgver}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
}
