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

_realname=mdds
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=3.0.0
pkgrel=1
pkgdesc="A collection of Multi-Dimensional Data Structure and indexing algorithm. (mingw-w64)"
arch=('any')
mingw_arch=('ucrt64' 'clang64' 'clangarm64')
url='https://gitlab.com/mdds/mdds'
msys2_references=(
  'archlinux: mdds'
)
license=('spdx:MIT')
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-autotools")
checkdepends=("${MINGW_PACKAGE_PREFIX}-boost")
source=("https://gitlab.com/mdds/mdds/-/archive/${pkgver}/${_realname}-${pkgver}.tar.bz2")
sha256sums=('2d056dbec3a3a16c48e3451532ff53afe8fc23ed1f56bed4191197fa99a4b202')

prepare() {
  cd ${_realname}-${pkgver}

  autoreconf -fiv
}

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

  ../${_realname}-${pkgver}/configure \
      --prefix=${MINGW_PREFIX}

  make
}

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

  make check
}

package() {
  cd "${srcdir}/build-${MSYSTEM}"

  DESTDIR="${pkgdir}" make install

  install -Dm644 "${srcdir}"/${_realname}-${pkgver}/LICENSE \
    "${pkgdir}"${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE
}
