# Contributor: A. Wilcox <awilfox@adelielinux.org>
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=kdevelop-pg-qt
pkgver=2.2.1
pkgrel=0
pkgdesc="Parser generator for using QMake with KDevelop"
url="https://kde.org/"
arch="all"
license="LGPL-2.0+ AND Expat AND GPL-3.0+"
depends=""
makedepends="qt5-qtbase-dev cmake extra-cmake-modules"
subpackages="$pkgname-dev"
source="https://download.kde.org/stable/kdevelop-pg-qt/$pkgver/src/kdevelop-pg-qt-$pkgver.tar.xz"

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" \
		-DCMAKE_C_FLAGS="$CFLAGS" \
		${CMAKE_CROSSOPTS} \
		.
	make
}

check() {
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

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

sha512sums="0ef3daba60ee6c7d4602b31610bdc68709a730d4c3443770eac1aa1d298fc03e10b38bc0d2e34dd44df5bba1c3af945c87e80d8aaa818e0b1787121f056c78a9  kdevelop-pg-qt-2.2.1.tar.xz"