# Packager = Tuxcore <dev@tuxcore.org> 
pkgbase=qca
pkgname=(qca-qt5
         qca-qt6)
pkgver=2.3.9
pkgrel=3
pkgdesc='Qt Cryptographic Architecture'
arch=(x86_64)
url='https://userbase.kde.org/QCA'
license=(LGPL-2.1-or-later)
depends=(ca-certificates
         gcc-libs
         glibc
         nss)
optdepends=('botan: botan plugin'
            'libgcrypt: gcrypt plugin'
            'libsasl: SASL plugin'
            'openssl: SSL plugin'
            'pkcs11-helper: PKCS-11 plugin')
makedepends=(botan
             cmake
             doxygen
             libgcrypt
             libsasl
             openssl
             pkcs11-helper
             qt5-base
             qt6-base
             qt6-5compat)
source=(https://download.kde.org/stable/$pkgbase/$pkgver/$pkgbase-$pkgver.tar.xz{,.sig})
sha256sums=('c555d5298cdd7b6bafe2b1f96106f30cfa543a23d459d50c8a91eac33c476e4e'
            'SKIP')
validpgpkeys=(CB9387521E1EE0127DA804843FDBB55084CC5D84) # Harald Sitter <sitter@kde.org>

build() {
  cmake -B build-qt5 -S $pkgbase-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_TESTS=OFF \
    -DQCA_INSTALL_IN_QT_PREFIX=ON \
    -DQCA_MAN_INSTALL_DIR=/usr/share/man
  cmake --build build-qt5

  cmake -B build-qt6 -S $pkgbase-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DQT6=ON \
    -DBUILD_TESTS=OFF \
    -DQCA_INSTALL_IN_QT_PREFIX=ON \
    -DQCA_MAN_INSTALL_DIR=/usr/share/man
  cmake --build build-qt6
}

package_qca-qt5() {
  depends+=(qt5-base)
  conflicts=(qca)
  provides=(qca)
  replaces=(qca)

  DESTDIR="$pkgdir" cmake --install build-qt5
}

package_qca-qt6() {
  depends+=(qt6-5compat
            qt6-base)

  DESTDIR="$pkgdir" cmake --install build-qt6
}
