# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=telepathy-qt
pkgver=0.9.8
pkgrel=2
arch="all"
url="https://telepathy.freedesktop.org/wiki/"
license="LGPL-2.1-or-later"
pkgdesc="A library for Qt-based Telepathy clients"
depends_dev="telepathy-farstream-dev telepathy-glib-dev gstreamer-dev"
makedepends="$depends_dev cmake python3 qt5-qttools-dev doxygen samurai"
source="https://telepathy.freedesktop.org/releases/telepathy-qt/telepathy-qt-$pkgver.tar.gz
	fix-finding-gio-unix.patch
	"
subpackages="$pkgname-dev $pkgname-doc"
options="!check"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DPYTHON_EXECUTABLE=/usr/bin/python3 \
		-DDESIRED_QT_VERSION=5 \
		-DENABLE_EXAMPLES=OFF \
		-DENABLE_TESTS="$(want_check && echo ON || echo OFF)"
	cmake --build build

	cd build
	doxygen doxygen.cfg
}

check() {
	cd build

	# BaseConnectionManager requires jabber support
	# BaseProtocol is broken
	ctest -E "Base(ConnectionManager|Protocol)"
}

package() {
	DESTDIR="$pkgdir" cmake --install build

	install -d "$pkgdir"/usr/share/doc/$pkgname
	cp -r doc/html "$pkgdir"/usr/share/doc/$pkgname/
}
sha512sums="
fad662c02417c8e4e239d438ea3549226e589442aea8418c8922a6b78ff88422a36c1cc0d2e3591240fac115390a7fbdb1b4deea98187051cc811175b60b9e8b  telepathy-qt-0.9.8.tar.gz
b270397f3e4dbb11dc106354f323e05104aeeefa188a065909a371850df4fe71573fc3b9e62df28f4365038780d6053cc6d6676c3e362821e9ab6c4d7fb0b992  fix-finding-gio-unix.patch
"
