# Template file for 'qt6-speech'
pkgname=qt6-speech
version=6.8.2
revision=1
build_style=cmake
hostmakedepends="perl pkg-config qt6-declarative-host-tools"
makedepends="qt6-base-private-devel qt6-declarative-private-devel
 qt6-multimedia-devel flite-devel speech-dispatcher-devel alsa-lib-devel"
short_desc="Cross-platform application and UI framework (QT6) - Speech component"
maintainer="John <me@johnnynator.dev>"
license="(LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only) AND GPL-3.0-only with Qt-GPL-exception-1.0"
homepage="https://www.qt.io"
distfiles="https://download.qt.io/official_releases/qt/${version%.*}/${version}/submodules/qtspeech-everywhere-src-${version}.tar.xz"
checksum=e09b52336bb90090f4582a382fa084f7573ebd207cc81f3066ef94cc1bf202c3

if [ "$XBPS_CHECK_PKGS" ]; then
	configure_args="-DQT_BUILD_TESTS=ON"
fi

pre_check() {
	export QML2_IMPORT_PATH="$wrksrc/build/lib${XBPS_TARGET_WORDSIZE}/qt6/qml"
}

post_install() {
	rm -rf "${DESTDIR}"/usr/tests
}

qt6-speech-devel_package() {
	depends="${sourcepkg}>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/qt6/metatypes
		vmove usr/lib/pkgconfig
		vmove usr/lib/qt6/mkspecs
		vmove "usr/lib/*.so"
		vmove "usr/lib/*.prl"
		vmove usr/lib/qt6/modules
		vmove usr/lib/cmake
	}
}

qt6-speech-plugin-flite_package() {
	short_desc+=" - Flite Plugin"
	pkg_install() {
		vmove usr/lib/qt6/plugins/texttospeech/libqtexttospeech_flite.so
	}
}

qt6-speech-plugin-speechd_package() {
	short_desc+=" - Speech dispatcher Plugin"
	pkg_install() {
		vmove usr/lib/qt6/plugins/texttospeech/libqtexttospeech_speechd.so
	}
}


qt6-speech-plugin-mock_package() {
	short_desc+=" - Mock Plugin"
	pkg_install() {
		vmove usr/lib/qt6/plugins/texttospeech/libqtexttospeech_mock.so
	}
}
