# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>
# Contributor: Link Dupont <link@subpop.net>

pkgname=devhelp
pkgver=40.1
pkgrel=1
pkgdesc="API documentation browser for GNOME"
url="https://wiki.gnome.org/Apps/Devhelp"
arch=(x86_64)
license=(GPL)
depends=(webkit2gtk amtk)
makedepends=(gtk-doc git appstream-glib gobject-introspection meson yelp-tools)
groups=(gnome-extra)
_commit=ebea24b7e37ecfad64c380887f5e85674494d236  # tags/40.1^0
source=("git+https://gitlab.gnome.org/GNOME/devhelp.git#commit=$_commit")
sha256sums=('SKIP')

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

prepare() {
  cd $pkgname

  # Find books generated with gi-docgen
  git cherry-pick -n 1da8190c1ce010d86c3ce2253513469d3abc4b9b
}

build() {
  arch-meson $pkgname build \
    -D gtk_doc=true \
    -D plugin_emacs=true \
    -D plugin_gedit=true \
    -D plugin_vim=true
  meson compile -C build
}

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

package() {
  meson install -C build --destdir "$pkgdir"
}
