# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=qt6
maintainer="Bart Ribbers <bribbers@disroot.org>"
pkgname=qt6-qtlocation
pkgver=6.8.3
pkgrel=0
pkgdesc="Helps you create viable mapping solutions using the data available from some of the popular location services"
url="https://qt.io/"
# armhf blocked by qt6-qtdeclarative
arch="all !armhf"
license="LGPL-2.1-only AND LGPL-3.0-only AND GPL-3.0-only AND Qt-GPL-exception-1.0"
depends="xdg-utils"
depends_dev="
	qt6-qtdeclarative-dev
	qt6-qtdeclarative-private-dev
	qt6-qtpositioning-dev
	"
makedepends="$depends_dev
	cmake
	perl
	qt6-qtbase-dev
	qt6-qtdeclarative-private-dev
	samurai
	"
subpackages="$pkgname-dev"
options="!check" # No tests
builddir="$srcdir/qtlocation-everywhere-src-${pkgver/_/-}"

case $pkgver in
	*_alpha*|*_beta*|*_rc*) _rel=development_releases;;
	*) _rel=official_releases;;
esac

source="https://download.qt.io/$_rel/qt/${pkgver%.*}/${pkgver/_/-}/submodules/qtlocation-everywhere-src-${pkgver/_/-}.tar.xz"
options="!check" # No tests

build() {
	export CFLAGS="$CFLAGS -flto=auto"
	export CXXFLAGS="$CXXFLAGS -flto=auto"
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DINSTALL_BINDIR=lib/qt6/bin \
		-DINSTALL_DOCDIR=share/doc/qt6 \
		-DINSTALL_ARCHDATADIR=lib/qt6 \
		-DINSTALL_DATADIR=share/qt6 \
		-DINSTALL_INCLUDEDIR=include/qt6 \
		-DINSTALL_MKSPECSDIR=lib/qt6/mkspecs \
		-DINSTALL_EXAMPLESDIR=share/doc/qt6/examples
	cmake --build build --parallel
}

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

dev() {
	default_dev

	amove usr/lib/qt6/sbom
}

sha512sums="
c7cbd76b6b8b7d09387c7da0e6630959ae66f0c8af2cd26b255e86ec36c6efeec59e4af7b34faa05f2fa035d4dd075d13a8dd0bccaefac48d391b4fa786769c0  qtlocation-everywhere-src-6.8.3.tar.xz
"
