# Maintainer: Christoph Reiter <reiter.christoph@gmail.com>

_realname=accesskit-c
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=0.17.0
pkgrel=1
pkgdesc="Accessibility infrastructure for UI toolkits - C bindings (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url='https://accesskit.dev'
msys2_repository_url='https://github.com/AccessKit/accesskit-c'
license=('spdx:Apache-2.0 OR MIT')
depends=(
  "${MINGW_PACKAGE_PREFIX}-cc-libs"
)
makedepends=(
  "${MINGW_PACKAGE_PREFIX}-meson"
  "${MINGW_PACKAGE_PREFIX}-ninja"
  "${MINGW_PACKAGE_PREFIX}-rust"
  "${MINGW_PACKAGE_PREFIX}-cc"
  "git"
)
source=("accesskit-c-${pkgver}::git+https://github.com/AccessKit/accesskit-c#tag=${pkgver}")
sha256sums=('add199d4c73404867c701cbb999ac98d3f820a552a63e17cc4507ac8204278dd')

build() {
  MSYS2_ARG_CONV_EXCL="--prefix=" \
    meson setup \
      --prefix="${MINGW_PREFIX}" \
      --wrap-mode=nodownload \
      --auto-features=enabled \
      --buildtype=plain \
      "build-${MSYSTEM}" \
      "${_realname}-${pkgver}"

  meson compile -C "build-${MSYSTEM}"
}

package() {
  meson install -C "build-${MSYSTEM}" --destdir "${pkgdir}"

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