# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>

pkgbase=pango
pkgname=(
  pango
  pango-docs
)
pkgver=1.57.0
pkgrel=2
epoch=1
pkgdesc="A library for layout and rendering of text"
url="https://www.pango.org/"
arch=(x86_64 aarch64)
license=(LGPL-2.1-or-later)
depends=(
  cairo
  fontconfig
  freetype2
  fribidi
  glib2
  glibc
  harfbuzz
  libsysprof-capture
  libthai
  libx11
  libxft
  libxrender
)
makedepends=(
  gi-docgen
  git
  glib2-devel
  gobject-introspection
  help2man
  meson
  python-docutils
)
source=("git+https://gitlab.gnome.org/GNOME/pango.git#tag=$pkgver")
b2sums=('957e4b9999013065fdc3f175ee448fbc5a7580f0ffecfd4649234485b19e9911dd78ca28b728552b5a2577820ea1c6c9aefad5e016d236c379613ce0aaf77953')

prepare() {
  cd pango

  # Fix a crash
  # https://gitlab.archlinux.org/archlinux/packaging/packages/pango/-/issues/3
  git cherry-pick -n c7dcffdc86a2ac4fe8e176aac3a6b71cb79adbe4
}

build() {
  local meson_options=(
    -D documentation=true
    -D man-pages=true
    -D sysprof=enabled
  )

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

# not running checks: validation breaks when deps
# (especially harfbuzz) don't match upstream CI

package_pango() {
  provides=(libpango{,cairo,ft2,xft}-1.0.so)

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

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

package_pango-docs() {
  pkgdesc+=" (documentation)"
  depends=()

  mv doc/* "$pkgdir"
}

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