# 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-frameworks
pkgname=kwallet
pkgver=6.5.0
pkgrel=0
pkgdesc="Secure and unified container for user passwords"
# armhf blocked by extra-cmake-modules
arch="all !armhf"
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="
0547be2bf4a204fc322225e603f2fff3a5c0078f22f0a0111046e9fd69dfd20cb1560be08f7f5234e3ce5f0c6d72fdc539fe78de9700d3854fd93c154106f892  kwallet-6.5.0.tar.xz
"
