# 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=libktorrent
pkgver=25.04.2
pkgrel=0
# armhf blocked by extra-cmake-modules
arch="all !armhf"
url="https://kde.org/applications/internet/org.kde.ktorrent"
pkgdesc="A powerful BitTorrent client for KDE"
license="GPL-2.0-or-later"
depends_dev="
	boost-dev
	gmp-dev
	karchive-dev
	kcrash-dev
	ki18n-dev
	kio-dev
	qca-dev
	qt6-qtbase-dev
	solid-dev
	"
makedepends="$depends_dev
	doxygen
	extra-cmake-modules
	graphviz
	samurai
	"
checkdepends="xvfb-run"
subpackages="$pkgname-dev $pkgname-lang"
_repo_url="https://invent.kde.org/network/libktorrent.git"
source="https://download.kde.org/stable/release-service/$pkgver/src/libktorrent-$pkgver.tar.xz"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	# utppolltest requires network access
	# superseedtest is broken
	xvfb-run -a ctest --test-dir build -E "(utppoll|superseed)test"
}

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

sha512sums="
8c91aaeb42874332e528faa0e6fc08038e6c582e5d9bd2006d72de0ade96fca61569bd285da0bdd5c8c797756b026771228f3ec2c837837f2134377fb010dff8  libktorrent-25.04.2.tar.xz
"
