pkgname=grim
pkgver=1.5.0
pkgdesc="Grab images from a Wayland compositor"
homepage="https://gitlab.freedesktop.org/emersion/grim"
license=("MIT")
depends=(
  wayland
  libpng
  pixman
  wayland-protocols
)
bdepends=(wayland-scanner)
sources=("${pkgname}-v${pkgver}.tar.bz2")
urls=("https://gitlab.freedesktop.org/emersion/grim/-/archive/v${pkgver}/${sources[0]}")
sha512sums=("5eccc172a4d21be7e541f201a86909647d54533749c6dc679b8e68383a310a832f42cf8b5096ef61838c9c7b3213b32b4f54103a67b238ede718b4be834a0aed")

src_prepare() {
  tar -xf ${distdir}/${sources[0]} --strip-components=1
}

src_build() {
  local meson_args=(
    --prefix=/usr
    --buildtype=release
    --wrap-mode=nodownload
    -D python.bytecompile=1
    -D jpeg=disabled
    -D man-pages=disabled
    -D bash-completions=false
    -D fish-completions=false
  )
  meson setup build "${meson_args[@]}"
  meson compile -C build
}

src_install() {
  meson install -C build --destdir "$pkgdir"
  install -vDm644 contrib/completions/bash/grim.bash "${pkgdir}"/usr/share/bash-completion/completions/grim
  install -vDm644 contrib/completions/fish/grim.fish "${pkgdir}"/usr/share/fish/vendor_completions.d/grim.fish
}

# vim:ft=sh syn=sh et sw=2:
