# Template file for 'qt6-scxml'
pkgname=qt6-scxml
version=6.8.2
revision=1
build_style=cmake
configure_args="-DQT_FEATURE_scxml_ecmascriptdatamodel=ON"
hostmakedepends="perl qt6-declarative-host-tools"
makedepends="qt6-declarative-private-devel qt6-base-private-devel"
short_desc="Cross-platform application and UI framework - scxml"
maintainer="John <me@johnnynator.dev>"
license="LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only"
homepage="https://qt.io/"
distfiles="http://download.qt.io/official_releases/qt/${version%.*}/${version}/submodules/qtscxml-everywhere-src-${version}.tar.xz"
checksum=683c4a11a24001e901cc84853723046a1ba27004bcc06680a72eaac6cf8ea193

subpackages="qt6-scxml-tools qt6-scxml-devel"
if [ "$CROSS_BUILD" ]; then
	configure_args+=" -DQT_FORCE_BUILD_TOOLS=true"
	hostmakedepends+=" qt6-scxml-tools"
fi

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

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

qt6-scxml-tools_package() {
	depends="${sourcepkg}>=${version}_${revision}"
	short_desc+=" - Tools"
	pkg_install() {
		vmove usr/lib/qt6/libexec
		vmove "usr/lib/cmake/*Tools"
	}
}

qt6-scxml-devel_package() {
	depends="qt6-scxml-tools>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/cmake
		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
	}
}
