# Contributor: A. Wilcox <awilfox@adelielinux.org>
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=libqmatrixclient
pkgver=0.4.0
pkgrel=0
pkgdesc="Library to interface with Matrix chat systems using Qt 5"
url="https://matrix.org/docs/projects/sdk/libqmatrixclient.html"
arch="all"
license="LGPL-2.1+"
depends=""
depends_dev="qt5-qtbase-dev"
makedepends="$depends_dev cmake"
subpackages="$pkgname-dev"
source="libqmatrixclient-$pkgver.tar.gz::https://github.com/QMatrixClient/libqmatrixclient/archive/v$pkgver.tar.gz"

build() {
	cd "$builddir"
	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" \
		-DCMAKE_C_FLAGS="$CFLAGS" \
		${CMAKE_CROSSOPTS}
	make
}

check() {
	cd "$builddir"
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

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

sha512sums="552b866ef4adbde72518f96b42beb08dc99f80ff0388717e99c4287c463db21469d91e188b3d5c17850266ea313a36fed0cd01431f08632e3d1403f3b7725e40  libqmatrixclient-0.4.0.tar.gz"