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

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-frameworks
maintainer="team/kde <bribbers@disroot.org>"
pkgname=kwallet
pkgver=6.8.0
pkgrel=0
pkgdesc="Secure and unified container for user passwords"
arch="all"
url="https://community.kde.org/Frameworks"
license="LGPL-2.1-or-later"
depends_dev="
	gpgme-dev
	kconfig-dev
	kconfigwidgets-dev
	kcoreaddons-dev
	kdbusaddons-dev
	ki18n-dev
	kiconthemes-dev
	knotifications-dev
	kservice-dev
	kwindowsystem-dev
	libgcrypt-dev
	qca-qt6-dev
	"
makedepends="$depends_dev
	doxygen
	extra-cmake-modules
	graphviz
	kdoctools-dev
	qt6-qttools-dev
	samurai
	"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang $pkgname-bin"
_repo_url="https://invent.kde.org/frameworks/kwallet.git"
source="https://download.kde.org/stable/frameworks/${pkgver%.*}/kwallet-$pkgver.tar.xz"

provides="dbus:org.freedesktop.Secrets"
# 2nd highst priority after gnome-keyring, mainly for KDE
provider_priority=10

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

check() {
	local excluded_checks=
	case "$CARCH" in
		aarch64) excluded_checks="fdo_secrets_test" ;;
		s390x) excluded_checks="(blowfishtest)";;
	esac
	ctest --test-dir build --output-on-failure -E "$excluded_checks"
}

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

	rm "$pkgdir"/usr/share/dbus-1/services/org.kde.kwalletd5.service
}

doc() {
	replaces="kwallet5-doc"

	default_doc
}

bin() {
	amove usr/bin/kwallet-query
}

sha512sums="
e549f85fb6c2e33063747613d75da700e3022f058526c0f5e9ecdd6ec729eed9e1f8ebe97412481ac539506948cb7587424261f0be8daa216ffb52ad97f7eb59  kwallet-6.8.0.tar.xz
"
