pkgname=xdg-desktop-portal-wlr
pkgver=0.7.1
pkgdesc='xdg-desktop-portal backend for wlroots'
homepage="https://github.com/emersion/xdg-desktop-portal-wlr"
arch=('x86_64')
license=('MIT')
provides=('xdg-desktop-portal-impl')
depends=(
  'libdrm'
  'inih'
  'pipewire'
  'mesa'
  'systemd'
  'wayland'
  'xdg-desktop-portal'
)
makedepends=(
  'meson'
  'wayland-protocols'
)
sources=("${pkgname}-${pkgver}.tar.gz")
urls=("https://github.com/emersion/${pkgname}/releases/download/v${pkgver}/${sources[0]}")
sha512sums=("87aa5255d3de3203c2bfa6986c2acbffbfd414d12fb72aeca25249d3b528ffb948858a787c9c4206b18faaddd6ce09c95c257e969cc3cfeee8e376c3846f2b9d")

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 sd-bus-provider=libsystemd
  )
  meson setup build "${meson_args[@]}"
  meson compile -C build
}

src_install() {
  meson install -C build --destdir "$pkgdir"
  install -vDm644 "contrib/wlroots-portals.conf" -t "${pkgdir}/usr/share/xdg-desktop-portal"
}

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