#!/usr/bin/env bash
name='qca'
release='3'
version='2.3.10'
url='https://userbase.kde.org/QCA'
description='Qt cryptographic architecture'
email='akarsu@protonmail.com'
maintainer='akarsu'
license=('LGPL')
source=("https://download.kde.org/stable/qca/$version/qca-${version}.tar.xz")
depends=(make-ca which cyrus-sasl qt6-5compat)
makedepends=(cmake doxygen libgcrypt openssl)
sha256sums=( '1c5b722da93d559365719226bb121c726ec3c0dc4c67dea34f1e50e4e0d14a02' )
group=(app.crypt)
uses=(qt6)
qt6_depends=(qt6-base)
arch=('x86_64')

cd $name-$version
# force enable UTF-8
export LANG="en_US.UTF-8"

setup () {
  ops=(
    cmake -G Ninja \
      -DCMAKE_BUILD_TYPE=RelWithDebInfo \
      -DBUILD_TESTS=OFF \
    	-DCMAKE_INSTALL_PREFIX=/usr \
    	-DWITH_cyrus-sasl_PLUGIN=yes
)
  if use qt6 ; then
        ${ops[@]} \
        -B build-qt6 \
        -DQT6=ON
  fi
}

build () {
	if use qt6 ; then
    cmake --build build-qt6
  fi
	if use qt5 ; then
    cmake --build build-qt5
  fi
}

package () {
  if use qt6 ; then
      DESTDIR="$DESTDIR" cmake --install build-qt6
  fi
  if use qt5 ; then
      DESTDIR="$DESTDIR" cmake --install build-qt5
  fi
}

