# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Pierre Schmitz <pierre@archlinux.de>

pkgbase=polkit-qt
pkgname=(polkit-qt5
         polkit-qt6)
pkgver=0.200.0
pkgrel=1.1
pkgdesc='A library that allows developers to access PolicyKit API with a nice Qt-style API'
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
url='https://www.kde.org/'
license=(BSD-3-Clause
         GPL-2.0-or-later
         LGPL-2.0-or-later)
depends=(gcc-libs
         glib2
         glibc
         polkit)
makedepends=(cmake
             qt5-base
             qt6-base)
source=(https://download.kde.org/stable/$pkgbase-1/$pkgbase-1-$pkgver.tar.xz{,.sig})
sha256sums=('5d3b611c062d2b76a93750bb10c907bfd21d1ff08d0a15dc2cf63e278e1677fb'
            'SKIP')
validpgpkeys=(D81C0CB38EB725EF6691C385BB463350D6EF31EF) # Heiko Becker <heirecka@exherbo.org>

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

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

package_polkit-qt5() {
  depends+=(qt5-base)

  DESTDIR="$pkgdir" cmake --install build5
  install -Dm644 $pkgbase-1-$pkgver/LICENSES/* -t "$pkgdir"/usr/share/licenses/$pkgname
}

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

  DESTDIR="$pkgdir" cmake --install build6
  install -Dm644 $pkgbase-1-$pkgver/LICENSES/* -t "$pkgdir"/usr/share/licenses/$pkgname
}
