# Canonical recipe. scripts/package-source.sh fills the release source checksum.
# Maintainer: Tom Ballard (tcballard)
pkgname=omarchy-task-manager
pkgver=0.1.1
pkgrel=1
url='https://github.com/tcballard/omarchy-task-manager'
pkgdesc='Floating native task manager for Omarchy'
arch=('x86_64')
license=('MIT')
depends=('qt6-base' 'qt6-declarative' 'qt6-wayland' 'qt6-svg' 'hicolor-icon-theme' 'gcc-libs' 'glibc' 'glib2' 'systemd' 'coreutils')
optdepends=('gdb: live process core dumps' 'nvidia-utils: NVIDIA device telemetry')
makedepends=('cmake' 'ninja' 'rust' 'cargo')
checkdepends=('python' 'desktop-file-utils')
source=("$url/releases/download/v$pkgver/$pkgname-$pkgver.tar.gz")
sha256sums=('172fcf67770d3a67783907d5451c8e5f2fb38992d4ee2ea8a397a59d15b4b1c0')

build() {
  cmake -S "$srcdir/$pkgname-$pkgver" -B build -G Ninja \
    -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib
  cmake --build build
}

check() {
  cd "$srcdir/$pkgname-$pkgver"
  cargo test --locked
  ctest --test-dir "$srcdir/build" --output-on-failure
  desktop-file-validate packaging/io.github.tcballard.TaskManager.desktop
  python tests/protocol.py "$srcdir/build/omarchy-task-manager-core"
}

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