# Packager = Tuxcore <dev@tuxcore.org> 
pkgbase=libqaccessibilityclient
pkgname=(libqaccessibilityclient-qt5
         libqaccessibilityclient-qt6)
pkgver=0.6.0
pkgrel=1
arch=(x86_64)
pkgdesc='Helper library to make writing accessibility tools easier'
url='https://www.kde.org'
license=(LGPL2.1)
depends=(gcc-libs
         glibc)
makedepends=(extra-cmake-modules
             qt5-base
             qt6-base)
source=(https://download.kde.org/stable/$pkgbase/$pkgbase-$pkgver.tar.xz{,.sig})
sha256sums=('4c50c448622dc9c5041ed10da7d87b3e4e71ccb49d4831a849211d423c5f5d33'
            'SKIP')
              E0A3EB202F8E57528E13E72FD7574483BB57B18D  # Jonathan Esk-Riddell <jr@jriddell.org>
              39FFA93CAE9C6AFC212AD00202325448204E452A) # Carl Schwan <carl@carlschwan.eu>

build() {
  cmake -B build5 -S $pkgbase-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_TESTING=OFF
  cmake --build build5

  cmake -B build6 -S $pkgbase-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DQT_MAJOR_VERSION=6 \
    -DBUILD_TESTING=OFF
  cmake --build build6
}

package_libqaccessibilityclient-qt5() {
  depends+=(qt5-base)
  conflicts=(libqaccessibilityclient)
  provides=(libqaccessibilityclient)
  replaces=(libqaccessibilityclient)

  DESTDIR="$pkgdir" cmake --install build5
}

package_libqaccessibilityclient-qt6() {
  depends+=(qt6-base)

  DESTDIR="$pkgdir" cmake --install build6
}
