# Contributor: A. Wilcox <awilfox@adelielinux.org>
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=libquotient
pkgver=0.5.2
pkgrel=0
pkgdesc="Library to interface with Matrix chat systems using Qt 5"
url="https://matrix.org/docs/projects/sdks/#lib-q-matrix-client"
arch="all"
license="LGPL-2.1+"
depends=""
depends_dev="qt5-qtbase-dev"
makedepends="$depends_dev cmake qt5-qtmultimedia-dev"
subpackages="$pkgname-dev"
replaces="libqmatrixclient"
source="libquotient-$pkgver.tar.gz::https://github.com/quotient-im/libQuotient/archive/$pkgver.tar.gz"
builddir="$srcdir"/libQuotient-$pkgver

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=RelWithDebugInfo \
		-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
		${CMAKE_CROSSOPTS} .
	make
}

check() {
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

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

sha512sums="d1037139d62c41e35cd415e85ec8b7d3577af193e19a4307bcd65f83f43a54e015e4a888a0c26a266e41df613a329edd985e8935a9ea9d54f19662fdbfe55577  libquotient-0.5.2.tar.gz"