# Template file for 'kf6-kcalendarcore'
# group=kde-frameworks
pkgname=kf6-kcalendarcore
version=6.29.0
revision=1
build_style=cmake
_llvmver=21
configure_args="-DKDE_INSTALL_QMLDIR=lib/qt6/qml $(vopt_bool python BUILD_PYTHON_BINDINGS)"
hostmakedepends="extra-cmake-modules qt6-tools qt6-base qt6-declarative-host-tools
 $(vopt_if python "python3-build python3-setuptools shiboken6 llvm${_llvmver}")"
makedepends="qt6-base-devel libical-devel qt6-declarative-devel
 $(vopt_if python 'libshiboken6-devel libpyside6-devel python3-devel')"
checkdepends="perl"
short_desc="Library for Interfacing with Calendars"
maintainer="John <me@johnnynator.dev>"
license="LGPL-2.1-or-later"
homepage="https://invent.kde.org/frameworks/kcalendarcore"
distfiles="${KDE_SITE}/frameworks/${version%.*}/${pkgname#kf6-}-${version}.tar.xz"
checksum=0c5801f9c50d4fea4a183876a887068a4b73d9f5545453dbcd1cd17ec46e2300

# stage builds
makedepends+=" kf6-base"
shlib_requires="KDE_Frameworks.${version%.*}"

build_options="python"
build_options_default="python"

if [ "$CROSS_BUILD" ]; then
	configure_args+=" -DECM_SHIBOKEN_ARCH=$XBPS_CROSS_RUST_TARGET"
	configure_args+=" -DSYSROOT_INCLUDE_DIRS=$XBPS_CROSS_BASE/usr/include"
fi
export LLVM_INSTALL_DIR=/usr/lib/llvm/${_llvmver}

case "$XBPS_TARGET_MACHINE" in
	arm*) configure_args+=" -DSHIBOKEN_GENERATOR_EXTRA_FLAGS=--clang-option=-mfloat-abi=hard" ;;
esac

do_check() {
	cd build
	# disable failing tests
	ctest -E "testicaltimezones|Compat-AppleICal_1.5.ics|Compat-KOrganizer_3.1a.ics|Compat-Mozilla_1.0.ics"
}

kf6-kcalendarcore-devel_package() {
	depends="$makedepends ${sourcepkg}>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/pkgconfig
		vmove usr/lib/cmake
		vmove "usr/lib/*.so"
	}
}
