# Builds Lilt from the source tarball (with its Makefile): makepkg -si
pkgname=lilt
pkgver=@VERSION@
pkgrel=1
pkgdesc="Ad-free music player with synced lyrics and an always-on-top miniplayer"
arch=('x86_64' 'aarch64')
url="https://nitaimaarek.com/lilt/"
license=('MIT')
depends=('alsa-lib' 'libx11' 'libxcursor' 'libxi' 'libxrandr' 'libxkbcommon-x11' 'libglvnd' 'fontconfig' 'gcc-libs' 'glibc')
makedepends=('cargo' 'pkgconf')
optdepends=('wayland: native Wayland window' 'xdg-utils: opening links' 'yt-dlp: otherwise Lilt downloads its own copy')
provides=('lilt')
conflicts=('lilt-bin')
options=('!lto' '!debug')
source=("https://nitaimaarek.com/lilt/linux/lilt-${pkgver}-src.tar.gz")
sha256sums=('@SHA256@')

prepare() {
  cd "lilt-${pkgver}"
  export RUSTUP_TOOLCHAIN=stable
  cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}

build() {
  cd "lilt-${pkgver}"
  export RUSTUP_TOOLCHAIN=stable CARGO_TARGET_DIR=target
  make
}

package() {
  cd "lilt-${pkgver}"
  make install DESTDIR="$pkgdir" PREFIX=/usr
}
