# Contributor: Eric Bélanger <eric@archlinux.org>

pkgname=gitg
pkgver=3.32.1+17+gb4c8155f
pkgrel=2
epoch=1
pkgdesc="GNOME GUI client to view git repositories"
url="https://wiki.gnome.org/Apps/Gitg"
arch=(x86_64)
license=(GPL)
depends=(gtksourceview3 git libgit2-glib libgee webkit2gtk libpeas gtkspell3 python-gobject
         libdazzle)
makedepends=(gobject-introspection git meson vala)
_commit=b4c8155f641ed2d1afa8a090a04b44853286abe1  # gnome-3-32
source=("git+https://gitlab.gnome.org/GNOME/gitg.git#commit=$_commit"
        allow-nullable-head-parameter-in-stash_if_needed.patch)
sha256sums=('SKIP'
            'e898a9d6d1cfed98edafd8f39b592ae7e47037ff51772f88bc2e085fc7bf5dec')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/^v//;s/-/+/g'
}

prepare() {
  cd $pkgname
  # https://gitlab.gnome.org/GNOME/gitg/-/merge_requests/159
  patch -Np1 -i ../allow-nullable-head-parameter-in-stash_if_needed.patch
}

build() {
  arch-meson $pkgname build
  ninja -C build
}

check() {
  meson test -C build --print-errorlogs
}

package() {
  DESTDIR="$pkgdir" meson install -C build
  python -m compileall -d /usr/lib "$pkgdir/usr/lib"
  python -O -m compileall -d /usr/lib "$pkgdir/usr/lib"
}
