# 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=24.08.3
pkgrel=0
# armhf blocked by extra-cmake-modules
# ppc64le, s390x, riscv64 and loongarch64 blocked by qt5-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
	karchive5-dev
	kcmutils5-dev
	kcompletion5-dev
	kconfig5-dev
	kconfigwidgets5-dev
	kcoreaddons5-dev
	kcrash5-dev
	kdbusaddons5-dev
	kdnssd5-dev
	kdoctools5-dev
	ki18n5-dev
	kiconthemes5-dev
	kio5-dev
	kitemviews5-dev
	knotifications5-dev
	knotifyconfig5-dev
	kparts5-dev
	kplotting5-dev
	kross-dev
	ktextwidgets5-dev
	kwidgetsaddons5-dev
	kwindowsystem5-dev
	kxmlgui5-dev
	libktorrent-dev
	phonon-dev
	plasma-workspace-dev
	qt5-qtbase-dev
	qt5-qtwebengine-dev
	samurai
	solid5-dev
	syndication5-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 \
		-DENABLE_INFOWIDGET_PLUGIN=FALSE
	cmake --build build
}

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

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

sha512sums="
28c1a2fcbafb89fd7d2b1cabad3c3355277e66fc17fde9f12a7a30240ddc09633a21a228f4bc0c7445be6c6f4943808b6971cbb7f80e84a18e5accd8bb5d1724  ktorrent-24.08.3.tar.xz
"
