# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: team/kde <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-applications
pkgname=kmailtransport
pkgver=24.08.0
pkgrel=0
pkgdesc="Manage mail transport"
# armhf blocked by extra-cmake-modules
# ppc64le, s390x and armv7 blocked by libkgapi
# loongarch64: blocked by akonadi
arch="all !armhf !ppc64le !s390x !riscv64 !armv7 !loongarch64"
url="https://kontact.kde.org/"
license="LGPL-2.0-or-later"
depends_dev="
	akonadi-dev
	akonadi-mime-dev
	kcmutils-dev
	kconfigwidgets-dev
	ki18n-dev
	kio-dev
	kmime-dev
	ksmtp-dev
	kwallet-dev
	libkgapi-dev
	qtkeychain-dev
	"
makedepends="$depends_dev
	extra-cmake-modules
	samurai
	"
checkdepends="
	dbus
	xvfb-run
	"
subpackages="$pkgname-dev $pkgname-lang"
_repo_url="https://invent.kde.org/pim/kmailtransport.git"
source="https://download.kde.org/stable/release-service/$pkgver/src/kmailtransport-$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() {
	# smtpjobtest is broken
	dbus-run-session -- xvfb-run ctest --test-dir build --output-on-failure -E "smtpjobtest"
}

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

sha512sums="
faf7048410e9c31acebb1acb3e1d1baac2194259624cc5409e0ed60d3a8c352f5c18635cfe3d021caaffe1f453720176148bcf8ca29d25b7e0a3a7b592583acd  kmailtransport-24.08.0.tar.xz
"
