# Contributor: André Klitzing <aklitzing@gmail.com>
# Maintainer: André Klitzing <aklitzing@gmail.com>
pkgname=ausweisapp2
pkgver=2.3.1
pkgrel=0
pkgdesc="Official authentication app for German ID card and residence permit"
url="https://www.ausweisapp.bund.de/"
# armhf: qt6-qtdeclarative
arch="all !armhf"
license="EUPL-1.2"
depends="
	acsccid
	ccid
	pcsc-cyberjack
	pcsc-lite
	"
makedepends="
	cmake
	http-parser-dev
	openssl-dev
	pcsc-lite-dev
	qt6-qtbase-dev
	qt6-qtdeclarative-dev
	qt6-qtscxml-dev
	qt6-qtsvg-dev
	qt6-qttools-dev
	qt6-qtwebsockets-dev
	qt6-qtwebsockets
	samurai
	"
subpackages="$pkgname-doc"
source="https://github.com/Governikus/AusweisApp/archive/refs/tags/$pkgver/ausweisapp2-$pkgver.tar.gz"
builddir="$srcdir/AusweisApp-$pkgver"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		cmake_crossopts="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DBUILD_TESTING="$(want_check && echo ON || echo OFF)" \
		$cmake_crossopts .
	cmake --build build
}

check() {
	ctest --test-dir build
}

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

sha512sums="
88d58134ea4cd4e6084976880cdaa14cf2db2444081834fd7aea4456589a02cb55d9897921020293e331fd7c92f342505babd5810d1d4b712fa1c2d0e925732f  ausweisapp2-2.3.1.tar.gz
"
