# 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-qtwebview
pkgver=6.8.2
pkgrel=0
pkgdesc="Provides a way to display web content in a QML application"
url="https://qt.io/"
# s390x blocked by qt6-qtdeclarative
# ppc64le, riscv64, and armhf blocked by qt6-qtwebengine
arch="all !s390x !ppc64le !riscv64 !armhf"
license="LGPL-2.1-only AND LGPL-3.0-only AND GPL-3.0-only AND Qt-GPL-exception-1.0"
depends_dev="qt6-qtwebengine-dev"
makedepends="$depends_dev
	cmake
	perl
	qt6-qtbase-dev
	qt6-qtdeclarative-dev
	samurai
	"
subpackages="$pkgname-dev"
builddir="$srcdir/qtwebview-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/qtwebview-everywhere-src-${pkgver/_/-}.tar.xz"
options="!check" # No usable tests

build() {
	export CFLAGS="$CFLAGS -g1 -flto=auto"
	export CXXFLAGS="$CXXFLAGS -g1 -flto=auto"
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=Release \
		-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
}

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

dev() {
	default_dev

	amove usr/lib/qt6/sbom
}

sha512sums="
0e047a3bafa2782f12a6a61320f7d402eba65427f18a50d00cc87fe67cdb1f64028f60634ef69b756ed751b3855dc685154c8aed5da5f5bd3c77098dc1c53b66  qtwebview-everywhere-src-6.8.2.tar.xz
"
