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

_realname=gitg
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=3.32.1
pkgrel=5
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64')
pkgdesc="git repository viewer for GTK+/GNOME (mingw-w64)"
depends=("${MINGW_PACKAGE_PREFIX}-adwaita-icon-theme"
         "${MINGW_PACKAGE_PREFIX}-gtksourceview3"
         "${MINGW_PACKAGE_PREFIX}-libpeas"
         "${MINGW_PACKAGE_PREFIX}-enchant"
         "${MINGW_PACKAGE_PREFIX}-iso-codes"
         "${MINGW_PACKAGE_PREFIX}-python3-gobject"
         "${MINGW_PACKAGE_PREFIX}-gsettings-desktop-schemas"
         "${MINGW_PACKAGE_PREFIX}-gtk-update-icon-cache"
         "${MINGW_PACKAGE_PREFIX}-libsoup"
         "${MINGW_PACKAGE_PREFIX}-libsecret"
         "${MINGW_PACKAGE_PREFIX}-gtkspell3"
         "${MINGW_PACKAGE_PREFIX}-libgit2-glib"
         "${MINGW_PACKAGE_PREFIX}-libdazzle"
         "${MINGW_PACKAGE_PREFIX}-libgee")
makedepends=("${MINGW_PACKAGE_PREFIX}-meson"
             "${MINGW_PACKAGE_PREFIX}-ninja"
             "${MINGW_PACKAGE_PREFIX}-gcc"
             "${MINGW_PACKAGE_PREFIX}-pkg-config"
             "${MINGW_PACKAGE_PREFIX}-vala"
             "${MINGW_PACKAGE_PREFIX}-gobject-introspection"
             "${MINGW_PACKAGE_PREFIX}-itstool")
options=('strip')
license=("GPL2+")
url="https://wiki.gnome.org/Apps/Gitg"
source=(https://download.gnome.org/sources/${_realname}/${pkgver:0:4}/${_realname}-$pkgver.tar.xz)
sha256sums=('24a4aabf8a42aa2e783e1fb5996ebb3c2a82a01b9689269f1329517ef124ef5a')

build() {
  [[ -d build-${MINGW_CHOST} ]] && rm -rf build-${MINGW_CHOST}
  mkdir -p build-${MINGW_CHOST}
  cd build-${MINGW_CHOST}

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

  ninja
}

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

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