# 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-other
pkgname=subtitlecomposer
pkgver=0.8.0
pkgrel=3
# armhf blocked by extra-cmake-modules
# s390x, armv7, riscv64 and aarch64 blocked by OpenGLES
# x86 fails to build, "call of overloaded 'createIndex(const int&, int, long long unsigned int)' is ambiguous"
arch="all !armhf !s390x !armv7 !aarch64 !riscv64 !x86"
url="https://subtitlecomposer.kde.org/"
pkgdesc="The open source text-based subtitle editor"
license="GPL-2.0-only"
makedepends="
	extra-cmake-modules
	ffmpeg-dev
	kauth-dev
	kcodecs-dev
	kconfig-dev
	kconfigwidgets-dev
	kcoreaddons-dev
	ki18n-dev
	kio-dev
	ktextwidgets-dev
	kwidgetsaddons-dev
	kxmlgui-dev
	openal-soft-dev
	qt6-qtbase-dev
	samurai
	sonnet-dev
	"
checkdepends="xvfb-run"
subpackages="$pkgname-lang"
_repo_url="https://invent.kde.org/multimedia/subtitlecomposer.git"
source="https://download.kde.org/stable/subtitlecomposer/subtitlecomposer-$pkgver.tar.xz
	0001-subtitlecomposer-Rewritten-KIO-file-operations.patch
	"

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

check() {
	xvfb-run ctest --test-dir build --output-on-failure
}

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

sha512sums="
463824631b025c760423244434000c6e7f7d44097fb7a9178ada505daa6329de0649219f563431e98d8e780fce2b1f0a39cbd77a998ece3d131166045ae40dee  subtitlecomposer-0.8.0.tar.xz
bf634ef9ffe21c62dea4208b385989c5e946b3d2dfdd5a946256808eb23572140dd1c8d31404a661df70050a54aeda2bf40f919bee8e8da165c13bd4f1bf0066  0001-subtitlecomposer-Rewritten-KIO-file-operations.patch
"
