# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=qrca
pkgver=0_git20201104
pkgrel=0
_commit="e4ac4c565d76b15c6908e70de2094e110898759b"
pkgdesc="QR-Code scanner for Plasma Mobile"
arch="all !armhf" # armhf blocked by qt5-qtdeclarative
url="https://invent.kde.org/plasma-mobile/qrca"
license="GPL-3.0-or-later"
depends="
	kirigami2
	purpose
	"
makedepends="
	extra-cmake-modules
	kcontacts-dev
	kcoreaddons-dev
	ki18n-dev
	kirigami2-dev
	purpose-dev
	qt5-qtbase-dev
	qt5-qtdeclarative-dev
	qt5-qtmultimedia-dev
	qt5-qtquickcontrols2-dev
	qt5-qtsvg-dev
	zxing-cpp-dev
	"
source="https://invent.kde.org/kde/qrca/-/archive/$_commit/qrca-$_commit.tar.gz"
builddir="$srcdir/$pkgname-$_commit"

prepare() {
	default_prepare

	# qmlplugindump fails for armv7+qemu (pmb#1970). This is purely for
	# packager knowledge and doesn't affect runtime, so we can disable it.
	if [ "$CARCH" = "armv7" ]; then
		sed -i "s/ecm_find_qmlmodule/# ecm_find_qmlmodule/g" CMakeLists.txt
	fi
}

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

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
}
sha512sums="35a6a11af2d8ef2df1648d3eea7e9caa87aecdadd54b3020bc0a5cddebda5db99a9404acaeaa81957dde9b438f6d164d8a5a449db7b080fef90784bbb84edb0a  qrca-e4ac4c565d76b15c6908e70de2094e110898759b.tar.gz"