# Maintainer: Biswapriyo Nath <nathbappai@gmail.com>

_realname=serd
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=0.32.4
pkgrel=1
pkgdesc='C library for RDF syntax supporting reading/ writing Turtle and NTriples (mingw-w64)'
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64')
msys2_references=(
  'archlinux: serd'
)
msys2_repository_url='https://gitlab.com/drobilla/serd/'
url='https://drobilla.net/software/serd.html'
license=("spdx:0BSD OR ISC")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-meson"
             "${MINGW_PACKAGE_PREFIX}-ninja"
             "${MINGW_PACKAGE_PREFIX}-pkgconf")
source=(https://download.drobilla.net/${_realname}-${pkgver}.tar.xz{,.sig})
sha256sums=('cbefb569e8db686be8c69cb3866a9538c7cb055e8f24217dd6a4471effa7d349'
            'SKIP')
validpgpkeys=('907D226E7E13FA337F014A083672782A9BF368F3') # David Robillard <d@drobilla.net>

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

  MSYS2_ARG_CONV_EXCL="--prefix=" \
    ${MINGW_PREFIX}/bin/meson setup \
      --prefix="${MINGW_PREFIX}" \
      --wrap-mode=nodownload \
      --auto-features=enabled \
      --buildtype=plain \
      -Ddocs=disabled \
      -Dman_html=disabled \
      ../${_realname}-${pkgver}

  ${MINGW_PREFIX}/bin/meson compile
}

check() {
  cd "${srcdir}/build-${MSYSTEM}"
  ${MINGW_PREFIX}/bin/meson test || warning "Tests failed"
}

package() {
  cd "${srcdir}/build-${MSYSTEM}"
  DESTDIR="${pkgdir}" ${MINGW_PREFIX}/bin/meson install
  install -Dm644 "${srcdir}/${_realname}-${pkgver}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
}
