# Maintainer: Andrea Zagli <andrea.zagli.free@gmail.com>

_realname=spice-protocol
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.14.5
pkgrel=1
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64')
pkgdesc="SPICE protocol headers (mingw-w64)"
license=("spdx:BSD-3-Clause")
msys2_repository_url='https://gitlab.freedesktop.org/spice/spice-protocol'
url="https://www.spice-space.org/"
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-meson"
             "${MINGW_PACKAGE_PREFIX}-ninja"
             "${MINGW_PACKAGE_PREFIX}-pkgconf")
source=(https://www.spice-space.org/download/releases/${_realname}-${pkgver}.tar.xz{,.sig})
sha256sums=('baf58449f6e89d19f475899ad5fb9196fdc46c03cc53233f4e39cf2978f9cff7'
            'SKIP')
validpgpkeys=('87A9BD933F87C606D276F62DDAE8E10975969CE5') # Marc-André Lureau <marcandre.lureau@redhat.com>

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

  MSYS2_ARG_CONV_EXCL="--prefix=" \
  meson setup \
    --prefix="${MINGW_PREFIX}" \
    --buildtype=plain \
    --default-library=both \
    "../${_realname}-${pkgver}"
  meson compile
}

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

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