# Maintainer: Ryan <ryan@heyoodle.com>

pkgname=omareel
pkgver=0.1.0
pkgrel=2
pkgdesc='Screen recorder and editor for Omarchy with a synthetic cursor, auto zooms, and a camera bubble'
arch=('x86_64' 'aarch64')
url='https://github.com/omacom/omareel'
license=('MIT')
install='omareel.install'
options=('!debug')
depends=(
  'ffmpeg'
  'gpu-screen-recorder'
  'hicolor-icon-theme'
  'hyprland'
  'layer-shell-qt'
  'libevdev'
  'libjpeg-turbo'
  'qt6-base'
  'qt6-declarative'
  'qt6-multimedia'
  'qt6-svg'
  'slurp'
  'xdg-desktop-portal'
)
makedepends=(
  'cmake'
  'ninja'
  'pkgconf'
  'qt6-shadertools'
  'wayland'
)
optdepends=('gifsicle: optimize exported GIF files')
conflicts=('omarecord')
source=("$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz")
sha256sums=('330d8e2805135af33bf35378e2e961094fc375075d38120c8270bd42fe04ce5b')

build() {
  cd "$srcdir/$pkgname-$pkgver"
  ./bin/build
}

package() {
  cd "$srcdir/$pkgname-$pkgver"
  install -Dm755 build/omareel "$pkgdir/usr/bin/omareel"
  ln -s omareel "$pkgdir/usr/bin/omarecord"
  # The capture-exclusion plugin is bound to the Hyprland commit it was built
  # against; rebuild_on hyprland keeps this package in step with the compositor.
  install -Dm755 build/plugin/omareel-capture-exclude.so "$pkgdir/usr/lib/omareel/omareel-capture-exclude.so"
  install -Dm644 build/plugin/omareel-capture-exclude.so.hash "$pkgdir/usr/lib/omareel/omareel-capture-exclude.so.hash"
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
  install -Dm644 LICENSES/lucide.txt "$pkgdir/usr/share/licenses/$pkgname/lucide.txt"
  install -Dm644 pkg/omareel.svg "$pkgdir/usr/share/icons/hicolor/scalable/apps/omareel.svg"
  local size
  for size in 16 32 48 64 128 256 512; do
    install -Dm644 "pkg/icons/omareel-$size.png" \
      "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/omareel.png"
  done
  install -Dm644 pkg/omareel.desktop "$pkgdir/usr/share/applications/omareel.desktop"
}
