# Packager = Tuxcore <dev@tuxcore.org> 
pkgname=qt6-wayland
_pkgver=6.8.1
pkgver=6.8.1
pkgrel=1
arch=(x86_64)
url='https://www.qt.io'
license=(GPL-3.0-only
         LGPL-3.0-only
         LicenseRef-Qt-Commercial
         Qt-GPL-exception-1.0)
pkgdesc='Provides APIs for Wayland'
depends=(gcc-libs
         glibc
         libglvnd
         libxkbcommon
         qt6-base
         qt6-declarative
         qt6-svg
         wayland)
makedepends=(cmake
             git
             ninja)
groups=(qt6)
_pkgfn=${pkgname/6-/}
source=(git+https://code.qt.io/qt/$_pkgfn#tag=v$_pkgver)
sha256sums=('9f455a2a1360e7fc1ffe5a740523b6a69e9d96f1ebd0f20057f9fb6eeb3d6f38')

prepare() {
  cd $_pkgfn
  # Cherry picks for DDE
  git cherry-pick -n 67f121cc4c3865aa3a93cf563caa1d9da3c92695
  git cherry-pick -n 070414dd4155e13583e5e8b16bed1a5b68d32910
  # Fix crash when unplugging tablet
  git cherry-pick -n 24002ac6cbd01dbde4944b63c1f7c87ed2bd72b5
}

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
}
