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

pkgname=qt6-5compat
_pkgver=6.10.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='Module that contains unsupported Qt 5 APIs'
depends=(gcc-libs
         glibc
         icu
         qt6-base
         qt6-shadertools)
makedepends=(cmake
             git
             ninja
             qt6-declarative)
optdepends=('qt6-declarative: for QtGraphicalEffects')
groups=(qt6)
_pkgfn=${pkgname/6-/}
source=(git+https://github.com/qt/$_pkgfn#tag=v$_pkgver)
sha256sums=('b99e86ed67aa627d77c184db279968fe3a2c4e46633ffff3461afb80c9c5ef2f')

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
}
