# Maintainer:  Salem Yaslem <s@sy.sa>

pkgname="blue-recorder"
pkgver=0.1.0.36.g4ad1619
pkgrel=1
pkgdesc="A simple desktop recorder for Linux systems. Built using Rust, GTK+ 3 and ffmpeg. It supports recording audio and video on almost all Linux interfaces with support for Wayland display server on GNOME session."
arch=("x86_64")
url="https://github.com/xlmnxp/blue-recorder"
license=("GPL3")
depends=("ffmpeg" "libappindicator-gtk3" "gtk3" "glib2" "xorg-xwininfo" "pulseaudio")
optdepends=()
makedepends=("rust" "cargo" "git" "libappindicator-gtk3" "clang" "gettext")
provides=("blue-recorder")
conflicts=("blue-recorder")
source=("$pkgname::git+https://github.com/xlmnxp/blue-recorder.git")
sha256sums=("SKIP")

#prepare() {
#    cd $pkgname
#    sed -i  's+Icon=${SNAP}/meta/gui/blue-recorder.png+Icon=blue-recorder+g' data/blue-recorder.desktop
#}

build() 
   {
   cd $pkgname  
   cargo build --release --locked --all-features --target-dir=target
 }

package() {
  cd "$pkgname"

  desktop-file-install -m 644 --dir "$pkgdir/usr/share/applications/" "$srcdir/$pkgname/data/blue-recorder.desktop"

  install -Dm755 "target/release/blue-recorder" "$pkgdir/opt/blue-recorder/blue-recorder"
  mkdir -p "$pkgdir/usr/bin/"
  ln -s "/opt/blue-recorder/blue-recorder" "$pkgdir/usr/bin/blue-recorder"
  install -Dm644 "interfaces/main.ui" "$pkgdir/opt/blue-recorder/interfaces/main.ui"
  cp -r "data" "$pkgdir/opt/blue-recorder/data/"
  install -Dm644 "data/blue-recorder.png" "$pkgdir/usr/share/pixmaps/blue-recorder.png"
  cp -r "po" "$pkgdir/opt/blue-recorder/po/"
}