# 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=kgpg
pkgver=24.08.1
pkgrel=0
# armhf blocked by extra-cmake-modules
# ppc64le, s390x, riscv64 and loongarch64 blocked by qt5-qtwebengine -> akonadi-contacts
arch="all !armhf !ppc64le !s390x !riscv64 !loongarch64"
url="https://kde.org/applications/utilities/org.kde.kgpg"
pkgdesc="A simple interface for GnuPG, a powerful encryption utility"
license="GPL-2.0-or-later"
makedepends="
	akonadi-contacts-dev
	extra-cmake-modules
	gpgme-dev
	karchive-dev
	kcodecs-dev
	kcontacts-dev
	kcoreaddons-dev
	kcrash-dev
	kdbusaddons-dev
	kdoctools-dev
	ki18n-dev
	kiconthemes-dev
	kio-dev
	kjobwidgets-dev
	knotifications-dev
	kservice-dev
	kstatusnotifieritem-dev
	ktextwidgets-dev
	kwidgetsaddons-dev
	kwindowsystem-dev
	kxmlgui-dev
	qt6-qtbase-dev
	samurai
	"
_repo_url="https://invent.kde.org/utilities/kgpg.git"
source="https://download.kde.org/stable/release-service/$pkgver/src/kgpg-$pkgver.tar.xz"
subpackages="$pkgname-doc $pkgname-lang"

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

check() {
	# kgpg-import fails too often
	# kgpg-encrypt and kgpg-export are broken
	# del-key fails randomly
	# genkey fails on arm on builders
	ctest --test-dir build --output-on-failure -E "kgpg-(genkey|import|encrypt|export|del-key)" -j1
}

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

sha512sums="
c5da70b0dbecc03281ab959b49c91353502224a38d9b2f64c991311fdb8d8bc9240a737662d19c61d8aaf81c412bf061ab642925589d5ee97b94e64c16e1672f  kgpg-24.08.1.tar.xz
"
