# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>

pkgname=qt6-svg
_pkgver=6.11.0
pkgver=${_pkgver/-/}
pkgrel=2
arch=(x86_64 aarch64)
url='https://www.qt.io'
license=(GPL-3.0-only
         LGPL-3.0-only
         LicenseRef-Qt-Commercial
         Qt-GPL-exception-1.0)
pkgdesc='Classes for displaying the contents of SVG files'
depends=(gcc-libs
         glibc
         qt6-base
         zlib)
makedepends=(cmake
             git
             ninja)
groups=(qt6)
_pkgfn=${pkgname/6-/}
source=(git+https://github.com/qt/$_pkgfn#tag=v$_pkgver)
sha256sums=('408f8197d9b4376daf152a6b53d57b574fc7bf4ccfc4093bed24f5da6ca48340')

prepare() {
  # Fix SVG rendering
  git -C $_pkgfn cherry-pick -n b20f842226ed5101eb4abe178fc3ee00e78d00da
}

build() {
  cmake -B build -S $_pkgfn -G Ninja \
    -DCMAKE_MESSAGE_LOG_LEVEL=STATUS
  cmake --build build
}

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

  install -d "$pkgdir"/usr/share/licenses
  ln -s /usr/share/licenses/qt6-base "$pkgdir"/usr/share/licenses/$pkgname
}
