# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=check
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.15.2
pkgrel=1
pkgdesc="A unit testing framework for C (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
url="https://libcheck.github.io/check/"
license=("LGPL")
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs")
options=('strip' 'staticlibs')
source=(https://github.com/libcheck/check/releases/download/${pkgver}/${_realname}-${pkgver}.tar.gz)
sha256sums=('a8de4e0bacfb4d76dd1c618ded263523b53b85d92a146d8835eb1a52932fa20a')

build() {
  [[ -d "${srcdir}/build-${MINGW_CHOST}" ]] && rm -rf "${srcdir}/build-${MINGW_CHOST}"
  mkdir -p "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}"
  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --enable-static \
    --enable-shared

  make
}

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