# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Ronald van Haren <ronald.archlinux.org>

pkgname=calligra
pkgdesc='A set of applications for productivity and creative usage'
pkgver=24.12.1
pkgrel=1
arch=(x86_64 powerpc64le powerpc64 riscv64)
url='https://www.calligra-suite.org/'
license=(GPL-2.0-only)
depends=(cauchy
         fontconfig
         freetype2
         gcc-libs
         glibc
         gsl
         imath
         karchive
         kcolorscheme
         kcompletion
         kconfigwidgets
         kcoreaddons
         kdbusaddons
         kdiagram
         kcmutils
         kconfig
         kcrash
         kguiaddons
         ki18n
         kiconthemes
         kio
         kitemviews
         knotifications
         knotifyconfig
         ktextwidgets
         kwidgetsaddons
         kwindowsystem
         kxmlgui
         libodfgen
         librevenge
         openssl
         phonon-qt6
         qca-qt6
         qt6-base
         qt6-declarative
         qt6-svg
         qtkeychain-qt6
         sonnet
         zlib)
makedepends=(boost
             eigen
             extra-cmake-modules
             kdoctools
             libetonyek
             libvisio
             libwpg
             libwps
             okular
             pstoedit
             vc)
optdepends=('libetonyek: Apple Keynote import filter'
            'libvisio: Microsoft Visio import filter'
            'libwpg: Corel WordPerfect Graphics image importer'
            'libwps: Microsoft Works file word processor format import'
            'poppler: PDF to SVG filter'
            'pstoedit: EPS to SVG filter')
groups=(kde-applications
        kde-office)
source=(https://download.kde.org/stable/release-service/$pkgver/src/$pkgname-$pkgver.tar.xz{,.sig})
sha256sums=('ff793313daa2e0ea62d7aa92711beff21a6849bff79780c55177a5e4b0364452'
            'SKIP')
validpgpkeys=(CA262C6C83DE4D2FB28A332A3A6A4DB839EAA6D7  # Albert Astals Cid <aacid@kde.org>
              F23275E4BF10AFC1DF6914A6DBD2CE893E2D1C87  # Christoph Feck <cfeck@kde.org>
              D81C0CB38EB725EF6691C385BB463350D6EF31EF) # Heiko Becker <heiko.becker@kde.org>

build() {
  case "${CARCH}" in
    powerpc64)
      export CFLAGS="-O2 -pipe"
      export CXXFLAGS="-O2 -pipe"
    ;;
  esac

  cmake -B build -S $pkgname-$pkgver \
    -DRELEASE_BUILD=ON \
    -DPRODUCTSET=DESKTOP \
    -DBUILD_TESTING=OFF
  cmake --build build
}

package() {
  DESTDIR="$pkgdir" cmake --install build
}
