# Maintainer: Mehdi Chinoune <mehdi.chinoune@hotmail.com>

_realname=unittest-cpp
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=2.0.0
pkgrel=1
pkgdesc="A lightweight unit testing framework for C++"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
license=(MIT)
url="http://unittest-cpp.github.io"
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
             "${MINGW_PACKAGE_PREFIX}-cmake")
options=('staticlibs' 'strip')
source=("https://github.com/unittest-cpp/unittest-cpp/archive/v${pkgver}.tar.gz")
sha256sums=('74852198877DC2FDEBDC4E5E9BD074018BF8EE03A13DE139BFE41F4585B2F5B9')

build() {
  cd ${srcdir}/${_realname}-${pkgver}
  mkdir -p build && cd build
  MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
  ${MINGW_PREFIX}/bin/cmake .. \
    -G"MSYS Makefiles" \
    -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} 
  make -j$(nproc)
}

package() {
  cd ${srcdir}/${_realname}-${pkgver}/build
  make DESTDIR="${pkgdir}" install
  install -Dm644 ../LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}
