# Packager = Tuxcore <dev@tuxcore.org> 
pkgbase=json-glib
pkgname=(
  json-glib
  json-glib-docs
)
pkgver=1.10.6
pkgrel=1
pkgdesc="JSON library built on GLib"
url="https://gnome.pages.gitlab.gnome.org/json-glib/"
arch=(x86_64)
license=(LGPL-2.1-or-later)
depends=(
  glib2
  glibc
)
makedepends=(
  docbook-xsl
  gi-docgen
  git
  glib2-devel
  gobject-introspection
  meson
  python-docutils
)
source=("git+https://gitlab.gnome.org/GNOME/json-glib.git?signed#tag=$pkgver")
b2sums=('c55cd4acae7e5f7ceed3f9b08406e7128895f8805bdaa49a0d64753127a7ffb69b1e403c08dd34085114b68cf598caed9cfe1add570e71a9505533fc7a77387d')
validpgpkeys=(
  53EF3DC3B63E2899271BD26322E8091EEA11BBB7 # Emmanuele Bassi <ebassi@gnome.org>
)

prepare() {
  cd json-glib
}

build() {
  local meson_options=(
    -D installed_tests=false
    -D man=true
  )

  arch-meson json-glib build "${meson_options[@]}"
  meson compile -C build
}

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

package_json-glib() {
  depends+=(libg{lib,object,io}-2.0.so)
  provides+=(libjson-glib-1.0.so)

  meson install -C build --destdir "$pkgdir"

  mkdir -p doc/usr/share
  mv {"$pkgdir",doc}/usr/share/doc
}

package_json-glib-docs() {
  pkgdesc+=" (documentation)"
  depends=()

  mv doc/* "$pkgdir"
}

# vim:set sw=2 sts=-1 et:
