# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>

pkgname=ktexteditor
pkgver=6.1.0
pkgrel=1
pkgdesc='Advanced embeddable text editor'
arch=(x86_64 aarch64)
url='https://community.kde.org/Frameworks'
license=(LGPL-2.0-only LGPL-3.0-only)
depends=(editorconfig-core-c
         gcc-libs
         glibc
         karchive
         kauth
         kcodecs
         kcolorscheme
         kcompletion
         kconfig
         kconfigwidgets
         kcoreaddons
         kguiaddons
         ki18n
         kio
         kitemviews
         kparts
         ktextwidgets
         kwidgetsaddons
         kxmlgui
         qt6-declarative
         qt6-base
         qt6-speech
         sonnet
         syntax-highlighting)
makedepends=(doxygen
             extra-cmake-modules
             qt6-doc
             qt6-tools)
optdepends=('git: git integration')
groups=(kf6)
source=(https://download.kde.org/stable/frameworks/${pkgver%.*}/$pkgname-$pkgver.tar.xz{,.sig}
        https://invent.kde.org/frameworks/ktexteditor/-/commit/5c4bc8d3.patch)
sha256sums=('3ba18f41ef5e57fe868dc295d01852d31b1590c0be893ac97ceed9229b09a9df'
            'SKIP'
            '480a0800e4a3c6b308a1f53506bb30c4352535b62af9f11ba61443b03921dcc9')
validpgpkeys=(53E6B47B45CEA3E0D5B7457758D0EE648A48B3BB  # David Faure <faure@kde.org>
              E0A3EB202F8E57528E13E72FD7574483BB57B18D) # Jonathan Esk-Riddell <jr@jriddell.org>

prepare() {
  patch -d $pkgname-$pkgver -p1 < 5c4bc8d3.patch # Fix crashes in LSP plugin
}

build() {
  cmake -B build -S $pkgname-$pkgver \
    -DBUILD_TESTING=OFF \
    -DBUILD_QCH=ON
  cmake --build build
}

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