# Template file for 'telepathy-qt'
pkgname=telepathy-qt5
version=0.9.7
revision=1
wrksrc=${pkgname//5/}-${version}
build_style=cmake
configure_args="
 -DENABLE_EXAMPLES=OFF
 -DENABLE_TESTS=OFF
 -DDESIRED_QT_VERSION=5
 -DQT_QMAKE_EXECUTABLE=/usr/bin/qmake-qt5"
hostmakedepends="pkg-config"
makedepends="qt5-devel telepathy-farstream-devel telepathy-glib-devel gstreamer1-devel"
short_desc="Qt5 bindings for the Telepathy D-Bus protocol"
maintainer="Duncaen <duncaen@voidlinux.eu>"
license="LGPL-2.1"
homepage="http://telepathy.freedesktop.org/"
distfiles="http://telepathy.freedesktop.org/releases/${pkgname//5/}/${pkgname//5/}-${version}.tar.gz"
checksum=21bad30be7ebc4ba667d53d92cd1cec1be23114103f2149404d9740721693d4f

if [ -n "$CROSS_BUILD" ]; then
	hostmakedepends+=" qt5-host-tools qt5-devel"
	# cmake/FindPythonLibrary.cmake fails when cross compiling
	sed -i CMakeLists.txt -e "/find_package(PythonLibrary ${REQUIRED_PY} REQUIRED)/d"
	configure_args+=" -DPYTHON_SHORT_VERSION=2.7"
	configure_args+=" -DPYTHON_LONG_VERSION=2.7.3"
	configure_args+=" -DPYTHON_SITE_PACKAGES_DIR=${XBPS_CROSS_BASE}/usr/lib/python2.7/site-packages"
	configure_args+=" -DPYTHON_INCLUDE_PATH=${XBPS_CROSS_BASE}/usr/include/python2.7"
	configure_args+=" -DCMAKE_PYTHON_LIBRARIES=${XBPS_CROSS_BASE}/usr/lib"
fi

CXXFLAGS="-D_DEFAULT_SOURCE"

subpackages="telepathy-qt5-farstream telepathy-qt5-devel"

telepathy-qt5-farstream_package() {
	short_desc+=" - farstream component"
	depends="telepathy-qt5>=${version}_${revision}"
	pkg_install() {
		vmove usr/lib/*-farstream.so.*
	}
}
telepathy-qt5-devel_package() {
	depends="telepathy-qt5>=${version}_${revision} telepathy-qt5-farstream>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/cmake/TelepathyQt5*
		vmove usr/lib/*.so
		vmove usr/lib/pkgconfig
	}
}
