pkgname="dbus"
pkgver="1.16.2"
pkgdesc="Freedesktop.org message bus system"
homepage="https://www.freedesktop.org/wiki/Software/dbus"
sources=("${pkgname}-${pkgver}.tar.xz")
urls=("https://dbus.freedesktop.org/releases/${pkgname}/${sources[0]}")
md5sums=("97832e6f0a260936d28536e5349c22e5")

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

src_build() {
  mkdir build
  cd    build

  meson setup --prefix=/usr --buildtype=release --wrap-mode=nofallback ..
  ninja
  cd ..
}

src_check() {
  pushd build
  ninja test
  popd
}

src_install() {
  pushd build
  DESTDIR=$pkgdir ninja install
  install -d -v -m755 ${pkgdir}/var/lib/dbus
  ln -sfv ../../../etc/machine-id ${pkgdir}/var/lib/dbus
  popd
}
