pkgname=xdg-desktop-portal
pkgver=1.20.3
pkgdesc="Desktop integration portal"
homepage="https://flatpak.github.io/xdg-desktop-portal/ https://github.com/flatpak/xdg-desktop-portal"
depends=(
  fuse:3
  gcc
  gdk-pixbuf
  glib:2
  glibc
  json-glib
  pipewire
  systemd
)
makedepends=(meson)
license=("LGPL-2.1")
_patches=("${pkgname}-1.20.0-optional-gstreamer.patch")
_patch_sums=("c5bc6278630df40c61904eb7315f1888ae7502e74de9f8978e27df2acf79fe5ea6887b92d99a38849057ec65f7d8750bf59568ad530ad878f81c63123dc1677c")
sources=("${pkgname}-${pkgver}.tar.xz"
  "${_patches[@]}"
)
urls=("https://github.com/flatpak/${pkgname}/releases/download/${pkgver}/${sources[0]}"
  "${_patches[@]}"
)
sha512sums=("e3da40bb102f7a391b062baa5517460b47e653f10412237aebb9d32b375db51bee3e365cabd5cb2d9059f2f52cfa5b7bf364555ee1ff892d97e61841ddbc870e"
  "${_patch_sums[@]}"
)

src_prepare() {
  tar -xf ${distdir}/${sources[0]} --strip-components=1
  for _patch in ${_patches[@]}; do
    patch -p1 -i ${filedir}/${_patch}
  done
}

src_build() {
  local meson_args=(
    --prefix=/usr
    --buildtype=release
    --wrap-mode=nodownload
    -D python.bytecompile=1
    -D flatpak-interfaces=disabled
    -D geoclue=disabled
    -D gudev=disabled
    -D sandboxed-image-validation=disabled
    -D sandboxed-sound-validation=disabled
    -D systemd=enabled
    -D documentation=disabled
    -D datarootdir="/usr/share"
    -D man-pages=enabled
    -D installed-tests=false
    -D tests=disabled
  )
  meson setup build "${meson_args[@]}"
  meson compile -C build
}

src_install() {
  meson install -C build --destdir "$pkgdir"
}

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