# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=qt6
pkgname=qt6-qtimageformats
pkgver=6.7.2
pkgrel=1
pkgdesc="Plugins for additional image formats: TIFF, MNG, TGA, WBMP"
url="https://qt.io/"
arch="all"
license="LGPL-2.1-only AND LGPL-3.0-only AND GPL-3.0-only AND Qt-GPL-exception-1.0"
depends_dev="$pkgname
	libmng-dev
	qt6-qtbase-dev
	"
makedepends="$depends_dev
	cmake
	perl
	samurai
	"
subpackages="$pkgname-dev"
options="!check" # No tests
builddir="$srcdir/qtimageformats-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/qtimageformats-everywhere-src-${pkgver/_/-}.tar.xz"

# secfixed:
#   6.5.2-r1:
#     - CVE-2023-4863

build() {
	export CFLAGS="$CFLAGS -g1 -flto=auto"
	export CXXFLAGS="$CXXFLAGS -g1 -flto=auto"
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr
	cmake --build build
}

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

sha512sums="
78871edcdf1ea0dec172e5d17fb7fee75c0512d18a7830ddcdcabb04719f57fc41faa7d1a82bcf4639213dbe98f495f817f5680745eb43a80b2e321f141d562a  qtimageformats-everywhere-src-6.7.2.tar.xz
"
