APP=dbus
VERSION=1.12.20
BUILD=1sml
HOMEPAGE="https://wiki.freedesktop.org/www/Software/dbus/"
DESC="Freedesktop.org message bus system"
REQUIRES="netbsd-curses util-linux expat python3 xmlto"
DOWNLOAD="https://dbus.freedesktop.org/releases/dbus/dbus-1.12.20.tar.gz"

build() {
  mkandenterbuilddir
  rm -rf $APP-$VERSION

  tar xf $SRCDIR/$APP-$VERSION.tar.?z*
  cd $APP-$VERSION
  fixbuilddirpermissions

  patch -p1 < $SRCDIR/dbus-allow-root-globally.diff

  ./configure \
    --prefix="" \
    --bindir=/bin \
    --sbindir=/bin \
    --sysconfdir=/etc \
    --libexecdir=/lib \
    --localstatedir=/var \
    --disable-Werror \
    --disable-installed-tests \
    --enable-shared=yes \
    --enable-static=yes \
    --disable-verbose-mode \
    --with-dbus-user=messagebus \
    --enable-inotify \
    --enable-user-session \
    --with-session-socket-dir=/tmp \
    --with-system-pid-file=/var/run/dbus.pid \
    --disable-systemd \
    --with-x \
    --disable-doxygen-docs

  # Fix some directory ownership
  mkdir -p $PKG/var/lib/dbus
  chown messagebus $PKG/var/lib/dbus

  make
  make install DESTDIR=$PKG

  mv $PKG/lib/dbus-1.0/include/dbus/dbus-arch-deps.h $PKG/include/dbus-1.0/dbus/
  install -Dm 755 $SRCDIR/rc.messagebus $PKG/etc/rc.d/rc.messagebus

  cp COPYING $PKGDOCS/

  mkfinalpkg
}

SHA512SUMS="
c288a333102b6fd9d9606c667f6ccb624f7aeaeadb88b4c2aec062738e0e46c56b38d0c426299bda7f6bac1eb2d534f6c0342413ffa8a48bb0033c042e44b3fc  dbus-1.12.20.tar.lz
c631e89a11c00eb3977aa3c28dc55d3feb4db785c039429c7cc6c1f53e146ca198afb064b61fc4abaaa7fdc6722a5d6393e1294e39aeee3728472e0950d3df20  dbus-allow-root-globally.diff
"
