# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>
# Contributor: Tom Newsom <Jeepster@gmx.co.uk>

pkgbase=libsigc++-3.0
pkgname=(
  libsigc++-3.0
  libsigc++-3.0-docs
)
pkgver=3.6.0
pkgrel=1.1
pkgdesc="Callback Framework for C++"
url="https://libsigcplusplus.github.io/libsigcplusplus/"
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
license=(LGPL)
depends=(gcc-libs)
makedepends=(
  git
  meson
  mm-common
)
options=(!emptydirs)
_commit=eb7db8ef3b5cba44ec4b46d158ec03e2aa3c537a  # tags/3.6.0^0
source=("git+https://github.com/libsigcplusplus/libsigcplusplus#commit=$_commit")
b2sums=('SKIP')

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

prepare() {
  cd libsigcplusplus
}

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

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

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

package_libsigc++-3.0() {
  provides=(
    libsigc-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_libsigc++-3.0-docs() {
  pkgdesc+=" (documentation)"
  depends=()
  options=(!strip)

  mv -t "$pkgdir" docs/*
}
