# Maintainer: Taozuhong <taozuhong@hotmail.com>

_realname=libxmlb
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.3.24
pkgrel=2
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64' 'mingw32')
pkgdesc="A library to help create and query binary XML blobs (mingw-w64)"
depends=(
  "${MINGW_PACKAGE_PREFIX}-glib2"
  "${MINGW_PACKAGE_PREFIX}-xz"
  "${MINGW_PACKAGE_PREFIX}-zstd"
)
makedepends=(
  "${MINGW_PACKAGE_PREFIX}-gobject-introspection"
  "${MINGW_PACKAGE_PREFIX}-meson"
  "${MINGW_PACKAGE_PREFIX}-pkgconf"
  "${MINGW_PACKAGE_PREFIX}-gtk-doc"
  "${MINGW_PACKAGE_PREFIX}-cc"
)
license=("spdx:LGPL-2.1-or-later")
url="https://github.com/hughsie/libxmlb"
source=("https://github.com/hughsie/libxmlb/releases/download/${pkgver}/libxmlb-${pkgver}.tar.xz"{,.asc})
sha256sums=('ded52667aac942bb1ff4d1e977e8274a9432d99033d86918feb82ade82b8e001'
            'SKIP')
validpgpkeys=('163EB50119225DB3DF8F49EA17ACBA8DFA970E17') # Richard Hughes <richard@hughsie.com>

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

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

  meson compile
}

package() {
  cd build-${MSYSTEM}
  DESTDIR="${pkgdir}" meson install

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