# Maintainer: Alexey Pavlov <alexpux@gmail.com>
# Contributor: Renato Silva <br.renatosilva@gmail.com>

_realname=at-spi2-core
pkgbase="mingw-w64-${_realname}"
pkgname="${MINGW_PACKAGE_PREFIX}-atk"
pkgver=2.58.2
pkgrel=1
pkgdesc="Interface definitions of accessibility infrastructure (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64')
url='https://gnome.pages.gitlab.gnome.org/at-spi2-core/atk/'
msys2_repository_url='https://gitlab.gnome.org/GNOME/at-spi2-core'
license=('spdx:LGPL-2.1-or-later')
depends=(
  "${MINGW_PACKAGE_PREFIX}-gettext-runtime"
  "${MINGW_PACKAGE_PREFIX}-glib2"
)
makedepends=(
  "${MINGW_PACKAGE_PREFIX}-cc"
  "${MINGW_PACKAGE_PREFIX}-gettext-tools"
  "${MINGW_PACKAGE_PREFIX}-gobject-introspection"
  "${MINGW_PACKAGE_PREFIX}-libxml2"
  "${MINGW_PACKAGE_PREFIX}-meson"
  "${MINGW_PACKAGE_PREFIX}-ninja"
  "${MINGW_PACKAGE_PREFIX}-pkgconf"
)
source=("https://download.gnome.org/sources/at-spi2-core/${pkgver%.*}/${_realname}-${pkgver}.tar.xz")
sha256sums=('a2823b962ed16cdd5cb1fc5365029fd218394d852acd4098b321854bd6692f6e')

build() {
  MSYS2_ARG_CONV_EXCL="--prefix=" \
  meson setup \
    --prefix="${MINGW_PREFIX}" \
    --buildtype plain \
    --wrap-mode=nodownload \
    --default-library=both \
    -Datk_only=true \
    "${_realname}-${pkgver}" \
    "build-${MSYSTEM}"

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

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

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