# Maintainer: aur.chaotic.cx

_pkgname="kdenlive"
pkgname="$_pkgname-stabledeps-git"
pkgver=25.11.80.r104.g57ada0e
pkgrel=2
pkgdesc='A non-linear video editor for Linux using the MLT video framework'
url='https://invent.kde.org/multimedia/kdenlive'
license=('GPL-2.0-or-later')
arch=('x86_64')

depends=(
  ffmpeg
  frei0r-plugins
  karchive
  kbookmarks
  kcodecs
  kcolorscheme
  kcompletion
  kconfig
  kconfigwidgets
  kcoreaddons
  kcrash
  kdbusaddons
  kddockwidgets
  kfilemetadata
  kguiaddons
  ki18n
  kiconthemes
  kio
  kitemviews
  knewstuff
  knotifications
  knotifyconfig
  ktextwidgets
  kwidgetsaddons
  kxmlgui
  mlt
  opentimelineio
  purpose
  qqc2-desktop-style
  qt6-base
  qt6-declarative
  qt6-multimedia
  qt6-networkauth
  qt6-svg
  solid
)
makedepends=(
  doxygen
  extra-cmake-modules
  git
  imath
  kdoctools
  ninja
  qt6-tools
)
optdepends=(
  'bigsh0t: VR360 effects'
  'dvgrab: for firewire capture'
  'kimageformats: support for dds, xcf, exr, psd, and more image formats'
  'noise-suppression-for-voice: noise suppression effect'
  'opencv: for motion tracking'
  'opentimelineio: timeline export/import'
  'plasma-desktop: theme configuration'
  'python-openai-whisper: speech to text (Whisper engine)'
  'python-srt_equalizer: speech to text (Whisper engine)'
  'python-vosk: speech to text (VOSK engine)'
  'qt6-imageformats: support for tiff, webp, and more image formats'
  'recordmydesktop: for screen capture'
)

provides=("$_pkgname")
conflicts=("$_pkgname")

_pkgsrc="$_pkgname"
source=("$_pkgsrc"::"git+https://invent.kde.org/multimedia/kdenlive.git")
sha256sums=('SKIP')

pkgver() {
  cd "$_pkgsrc"
  git describe --long --tags --abbrev=7 \
    | sed -E 's/^[^0-9]*//;s/([^-]*-g)/r\1/;s/-/./g'
}

build() {
  local _cmake_options=(
    -B build
    -S "$_pkgsrc"
    -G Ninja
    -DCMAKE_BUILD_TYPE=None
    -DCMAKE_INSTALL_PREFIX='/usr'
    -DBUILD_QCH=ON
    -DBUILD_TESTING=OFF
    -Wno-dev
  )

  cmake "${_cmake_options[@]}"
  cmake --build build
}

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