# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Balló György <ballogyor+arch at gmail dot com>
# Contributor: Antonio Rojas <arojas@archlinux.org>
# Contributor: Ionut Biru <ibiru@archlinux.org>
# Contributor: Kessia 'even' Pinheiro <kessiapinheiro at gmail.com
# Contributor: Bjorn Lindeijer <bjorn lindeijer nl>

pkgname=telepathy-glib
pkgver=0.24.2
pkgrel=4
pkgdesc='GLib bindings for the Telepathy D-Bus protocol'
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
url='https://telepathy.freedesktop.org/'
license=(LGPL-2.1-or-later)
depends=(
  dbus
  dbus-glib
  glib2
  glibc
)
makedepends=(
  git
  glib2-devel
  gobject-introspection
  vala
)
source=(
  "git+https://gitlab.freedesktop.org/telepathy/$pkgname.git?signed#tag=$pkgname-$pkgver"
  telepathy-glib-function-type-cast.patch
)
b2sums=(
  529f200eeb03a65e3722928b4bacb81469c81f586e4f87d509beb70434bbeb226e8024ff78827c63bb3976ea44246293f680fcbe9aa2a321b52b138e12c04113
  7a2fd782f700741f97133203f7ca23cbe6028c99cd5118b97eb6d35191868097bc50fbfd8b149f83c622a9c86309a580f06c680051f52d93416a98323ad45fa1
)
validpgpkeys=(AA33B0D27868E36C151780F0FE0B6D736B1195ED) # Alexandr Akulich <akulichalexander@gmail.com>

prepare() {
  cd $pkgname

  # https://gitlab.freedesktop.org/telepathy/telepathy-glib/-/merge_requests/3
  git cherry-pick -n aa858698d7ede76b3b4c825ca14b8061c24f14e1

  # https://gitlab.freedesktop.org/telepathy/telepathy-glib/-/merge_requests/4
  git apply -3 ../telepathy-glib-function-type-cast.patch

  autoreconf -fi
}

build() {
  cd $pkgname
  ./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --localstatedir=/var \
    --libexecdir=/usr/lib/telepathy \
    --enable-gtk-doc \
    --enable-vala-bindings
  make
}

check() {
  cd $pkgname
  make check
}

package() {
  cd $pkgname
  make DESTDIR="$pkgdir" install
}
