pkgname=dbus
pkgver=1.16.2
pkgdesc="Freedesktop.org message bus system"
homepage="https://www.freedesktop.org/wiki/Software/dbus/"
arch=(x86_64)
license=("AFL-2.1 OR GPL-2.0-or-later")
depends=(
  expat
  glibc
  systemd
)
makedepends=(
  docbook-xml
  meson
  python
  xmlto
)
sources=("${pkgname}-${pkgver}.tar.xz"
  "dbus-reload.HOOK"
)
urls=("https://dbus.freedesktop.org/releases/dbus/${sources[0]}"
  "dbus-reload.HOOK"
)
md5sums=("97832e6f0a260936d28536e5349c22e5"
  "cc149df8401ae6316a699f25e90a2d09"
)

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

src_build() {
  local meson_options=(
    --prefix=/usr
    --localstatedir=/var
    -D runtime_dir=/run
    -D apparmor=disabled
    -D checks=false
    -D installed_tests=false
    -D doxygen_docs=disabled
    -D dbus_user=messagebus
    -D systemd=enabled
    -D kqueue=disabled
    -D launchd=disabled
    -D stats=false
    -D relocation=disabled
    -D selinux=disabled
    -D libaudit=disabled
    -D x11_autolaunch=disabled
  )
  meson build "${meson_options[@]}"
  meson compile -C build
}

# skip test

src_install() {
  meson install -C build --destdir "$pkgdir"
  leaf_install_hook ${filedir}/${sources[1]}

  chown -v root:messagebus "${pkgdir}/usr/libexec/dbus-daemon-launch-helper"
  chmod -v 4750 "${pkgdir}/usr/libexec/dbus-daemon-launch-helper"

  mkdir -pv "${pkgdir}"/usr/share/doc/dbus-${pkgver}
  mv -v "${pkgdir}"/usr/share/doc/dbus/* "${pkgdir}/usr/share/doc/dbus-${pkgver}/"
  rm -rfv "${pkgdir}/usr/share/doc/dbus"

  ln -svf /etc/machine-id "${pkgdir}/var/lib/dbus/machine-id"
}



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