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

pkgname="blue-recorder-git"
pkgver=r176.1c6a9a6
pkgrel=1
pkgdesc="A simple desktop recorder for Linux systems. Built using Rust, GTK 4 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" "gstreamer" "gtk4" "pipewire" "xorg-xwininfo")
makedepends=("cargo" "clang" "gettext" "git" "gtk3")
provides=("blue-recorder")
conflicts=("blue-recorder")
source=("$pkgname::git+https://github.com/xlmnxp/blue-recorder.git")
sha256sums=('SKIP')

pkgver() {
	cd "$pkgname"
	printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
	cd "$pkgname"  
	cargo build --release --locked --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/"
}