# Contributor: Leo <thinkabit.ukim@gmail.com>

# 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=falkon
pkgver=24.08.3
pkgrel=0
pkgdesc="Cross-platform Qt Web Browser"
url="https://github.com/KDE/falkon"
# armhf, ppc64le, s390x, riscv64 and loongarch64 blocked by qt6-qtwebengine
arch="all !armhf !ppc64le !s390x !riscv64 !loongarch64"
license="GPL-3.0-or-later"
depends="qt6-qtbase-sqlite"
makedepends="
	extra-cmake-modules
	karchive-dev
	kcoreaddons-dev
	kcrash-dev
	ki18n-dev
	kio-dev
	kwallet-dev
	libxcb-dev
	openssl-dev>3
	purpose-dev
	python3
	qt6-qtbase-dev
	qt6-qtdeclarative-dev
	qt6-qttools-dev
	qt6-qtwebengine-dev
	samurai
	xcb-util-dev
	"
checkdepends="xvfb-run"
subpackages="$pkgname-lang $pkgname-bash-completion:bashcomp:noarch"
_repo_url="https://invent.kde.org/network/falkon.git"
source="https://download.kde.org/stable/release-service/$pkgver/src/falkon-$pkgver.tar.xz"

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

check() {
	# Requires working OpenGL
	# qmlhistoryapitest, qmlcookiesapitest, qmltabsapitest and qmlwindowsapitest are SIGTRAP'ing
	xvfb-run -a ctest --test-dir build --output-on-failure -E "falkon-(locationbar|webtab|qml-qml(tabsapi|topsitesapi)|sitesettings)test" -j1
}

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

bashcomp() {
	depends=""
	pkgdesc="Bash completions for $pkgname"
	install_if="$pkgname=$pkgver-r$pkgrel bash-completion"

	amove usr/share/bash-completion/completions
}

sha512sums="
1c6020d805668de38be95f9d63a07c5b6eafb200b6b181d59c791a145ffb8926c5ecf5feb9f46c5d69deb682692574b8a557271d08f945cf1a52c1eee7b2d55b  falkon-24.08.3.tar.xz
"
