# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: damir <damir@archlinux.org>

pkgbase=libxml++
pkgname=(
  libxml++
  libxml++-docs
)
pkgver=3.2.5
pkgrel=1
pkgdesc="C++ bindings to libxml2"
url="https://libxmlplusplus.github.io/libxmlplusplus/"
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
license=(LGPL-2.1-or-later)
depends=(
  glibmm
  libxml2
)
makedepends=(
  git
  glibmm-docs
  meson
  mm-common
)
options=(!emptydirs)
_commit=52dd87b44307195d17696568b40ff50a018a1fe3  # tags/3.2.5^0
source=("git+https://github.com/libxmlplusplus/libxmlplusplus#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd libxmlplusplus
  git describe --tags | sed 's/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd libxmlplusplus
}

build() {
  local meson_options=(
    -D maintainer-mode=true
  )

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

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

# Do not remove the space before the () or commitpkg will
# accidentally to run this function on the system (!!!) 
package_libxml++ () {
  provides=(libxml++-3.0.so)

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

  # Split -docs
  mkdir -p docs/usr/share
  mv -t docs/usr/share "$pkgdir"/usr/share/{devhelp,doc}
}

package_libxml++-docs() {
  pkgdesc+=" (documentation)"
  depends=()
  options=(!strip)

  mv -t "$pkgdir" docs/*
}

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