pkgname=wireplumber
pkgver=0.5.12
luaver=5.4
pkgdesc="Session / policy manager implementation for PipeWire"
homepage="https://pipewire.pages.freedesktop.org/wireplumber/"
arch=(x86_64)
license=(MIT)
makedepends=(
  gcc
  glib
  glibc
  gobject-introspection
  meson
  pipewire
  systemd
)
_patches=("wireplumber-0.5.6-config-disable-sound-server-parts.patch")
_patch_sums=("1e6deb4ce2452f22fca6722c22cfa6a61794f8612c9b2baf6ac1a9b4cf6bdae84e3685e1d8957db3121d304fd5842de47a0f319b755dc349f354f55e118d4750")
sources=("${pkgname}-${pkgver}.tar.bz2"
  ${_patches[@]}
)
urls=("https://gitlab.freedesktop.org/pipewire/${pkgname}/-/archive/${pkgver}/${sources[0]}"
  ${_patches[@]}
)
sha512sums=("e00317ef90add4d5a0e1b637109a2fba594f081f466c15e1c5e62b9157d9684c13a745c926cc18795d0e4899c7813ddb5615b5f396e191a455b11cab11a38990"
  ${_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 daemon=true
    -D tools=true
    -D modules=true
    -D doc=disabled
    -D introspection=disabled
    -D system-lua=true
    #-D system-lua-version=${luaver}
    -D elogind=disabled
    -D systemd=enabled
    -D systemd-system-service=false
    -D systemd-user-service=true
    -D tests=true
    -D dbus-tests=false
  )
  meson setup build "${meson_args[@]}"
  meson compile -C build
}

src_check() {
  meson test -C build --print-errorlogs
}

src_install() {
  meson install -C build --destdir "$pkgdir"
  mv -v "${pkgdir}"/usr/share/doc/${pkgname}{,-${pkgver}}
}

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