# Contributor: Bart Ribbers <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-applications
maintainer="team/kde <bribbers@disroot.org>"
pkgname=ktorrent
pkgver=25.04.2
pkgrel=0
# armhf, s390x, ppc64le, riscv64 and loongarch64 blocked by qt6-qtwebengine
arch="all !armhf !ppc64le !s390x !riscv64 !loongarch64"
url="https://kde.org/applications/internet/org.kde.ktorrent"
pkgdesc="A powerful BitTorrent client for KDE"
license="GPL-2.0-or-later"
makedepends="
	boost-dev
	extra-cmake-modules
	karchive-dev
	kcmutils-dev
	kcompletion-dev
	kconfig-dev
	kconfigwidgets-dev
	kcoreaddons-dev
	kcrash-dev
	kdbusaddons-dev
	kdnssd-dev
	kdoctools-dev
	ki18n-dev
	kiconthemes-dev
	kio-dev
	kitemviews-dev
	knotifications-dev
	knotifyconfig-dev
	kparts-dev
	kplotting-dev
	ktextwidgets-dev
	kwidgetsaddons-dev
	kwindowsystem-dev
	kxmlgui-dev
	libktorrent-dev
	phonon-dev
	plasma-workspace-dev
	qt6-qtbase-dev
	qt6-qtwebengine-dev
	qt6-qtdeclarative-dev
	samurai
	solid-dev
	syndication-dev
	taglib-dev
	"
checkdepends="xvfb-run"
_repo_url="https://invent.kde.org/network/ktorrent.git"
source="https://download.kde.org/stable/release-service/$pkgver/src/ktorrent-$pkgver.tar.xz"
subpackages="$pkgname-lang"

build() {
	# The infowidget plugin is disabled due to an incompatibility with musl
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DQT_MAJOR_VERSION=6 \
		-DENABLE_INFOWIDGET_PLUGIN=FALSE
	cmake --build build
}

check() {
	# ipblocklisttest requires itself installed
	xvfb-run -a ctest --test-dir build -E "ipblocklisttest"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
b713f633669dc3527b8b7c5b3f41e22c704d1c62add2b084aa664ce4ab774f0d707ceeba310bdb5b64af52a919b54b58e079a3043fcd64aa070a565cff8c26f6  ktorrent-25.04.2.tar.xz
"
