# Maintainer (arch): Antonio Rojas <arojas@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Giovanni Scafora <giovanni@archlinux.org>
# Maintainer: Parabola Hackers <dev@lists.parabola.nu>
# Contributor: bill-auger <bill-auger@programmer.net>
# Contributor: SolveFinder <kwopleq@proton.me>


# parabola changes and rationale:
# - replace 'qt5-webengine' dependency with 'qt5-webkit'
# - pin to strongly-coupled dependency versions


pkgname=kdevelop
pkgver=24.02.0
_clangver=17.0.6
[[ "${CARCH}" == i686 ]] && _clangver=15.0.7
pkgrel=2
pkgrel+=.parabola1
pkgdesc='C++ IDE using KDE technologies'
arch=(x86_64)
arch+=(armv7h i686)
url='http://www.kdevelop.org/'
# license=(GPL-2.0-or-later) # TODO:
license=(GPL)
depends=(clang=$_clangver
         gcc-libs
         glibc
         grantlee
         karchive5
         kbookmarks5
         kcmutils5
         kcodecs5
         kcompletion5
         kconfig5
         kconfigwidgets5
         kcoreaddons5
         kcrash5
         kdeclarative5
         kguiaddons5
         ki18n5
         kiconthemes5
         kio5
         kitemmodels5
         kitemviews5
         kjobwidgets5
         knewstuff5
         knotifications5
         knotifyconfig5
         kparts5
         kservice5
         ktexteditor5
         ktextwidgets5
         kwidgetsaddons5
         kwindowsystem5
         kxmlgui5
         libkomparediff2
#        libksysguard
         qt5-base
         qt5-declarative
         qt5-webengine
         sh
         sonnet5
         syntax-highlighting5
         threadweaver5)
depends=( ${depends[*]/qt5-webengine/qt5-webkit} )
makedepends=(astyle
             boost
             extra-cmake-modules
             kdevelop-pg-qt
             kdoctools5
#            krunner5
             llvm
             okteta
             plasma-framework5
             purpose5
             qt5-tools
             subversion)
optdepends=('apr: SVN support'
            'apr-util: SVN support'
            'astyle: astyle plugin'
            'clazy: clazy analyzer plugin'
            'cmake: cmake integration'
            'cppcheck: code analyzer'
            'gdb: GNU debugger support'
            'git: Git support'
            'heaptrack: memory profiler'
            'kate: for additional plugins'
            'kio5-extras: man pages plugin'
            'konsolepart5: embedded terminal'
            'lldb-mi: LLDB debugger support'
            'meson: meson integration'
            'okteta: GNU debugger support'
            'plasma-framework5: for the plasma addons'
            'purpose5: patch review plugin'
            'python: debugger support'
            'subversion: SVN support'
            'qt5-doc: Qt documentation integration'
            'qt5-tools: qthelp plugin'
            'subversion: SVN support')
groups=(kde-applications
        kdevelop)
source=(https://download.kde.org/stable/release-service/$pkgver/src/$pkgname-$pkgver.tar.xz{,.sig})
sha256sums=('202acdfb53b1bdeeb9915eab1a0056d190040d8809038950bf2ec8d44fa81e19'
            'SKIP')
validpgpkeys=(CA262C6C83DE4D2FB28A332A3A6A4DB839EAA6D7  # Albert Astals Cid <aacid@kde.org>
              F23275E4BF10AFC1DF6914A6DBD2CE893E2D1C87  # Christoph Feck <cfeck@kde.org>
              D81C0CB38EB725EF6691C385BB463350D6EF31EF) # Heiko Becker <heiko.becker@kde.org>


## dependency tweaks ##

case "${CARCH}" in
i686) # arch32 has not renamed these k*5 packages yet
      depends=(     ${depends[*]%5}     )
      makedepends=( ${makedepends[*]%5} )
      optdepends=(  "${optdepends[@]/kio5-extras:/kio-extras:}"             )
      optdepends=(  "${optdepends[@]/konsolepart5:/konsolepart:}"           )
      optdepends=(  "${optdepends[@]/plasma-framework5:/plasma-framework:}" )
      optdepends=(  "${optdepends[@]/purpose5:/purpose:}"                   )
      ;;
esac


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

package() {
  # pin to strongly-coupled dependency versions
  depends+=( libicu{data,i18n,uc}.so ) # dependency is via qt5-webkit->icu

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