# Maintainer: Alberto Fanjul Alonso <albfan@gnome.org>

_realname=granite
pkgbase=mingw-w64-${_realname}7
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}7"
pkgver=7.6.0
pkgrel=2
pkgdesc="Library that extends Gtk+ (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://github.com/elementary/granite"
msys2_references=(
  'archlinux: granite7'
)
license=('spdx:LGPL-3.0-or-later')
depends=("${MINGW_PACKAGE_PREFIX}-libgee"
         "${MINGW_PACKAGE_PREFIX}-gettext-runtime"
         "${MINGW_PACKAGE_PREFIX}-glib2"
         "${MINGW_PACKAGE_PREFIX}-gtk4")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-gettext-tools"
             "${MINGW_PACKAGE_PREFIX}-meson"
             "${MINGW_PACKAGE_PREFIX}-ninja"
             "${MINGW_PACKAGE_PREFIX}-pkgconf"
             "${MINGW_PACKAGE_PREFIX}-sassc"
             "${MINGW_PACKAGE_PREFIX}-vala"
             "${MINGW_PACKAGE_PREFIX}-gobject-introspection"
             "${MINGW_PACKAGE_PREFIX}-itstool")
source=("https://github.com/elementary/${_realname}/archive/${pkgver}/${_realname}-${pkgver}.tar.gz")
sha256sums=('4b4e4f7f86eb3f55116faec42ebd87e04c3e424d82715ecd967ed39540dca5ef')

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

  MSYS2_ARG_CONV_EXCL="--prefix=" \
  ${MINGW_PREFIX}/bin/meson setup \
    --prefix="${MINGW_PREFIX}" \
    --buildtype plain \
    -Dwerror=false \
    ../${_realname}-${pkgver}

  ${MINGW_PREFIX}/bin/meson compile
}

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

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