# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=dbus
pkgver=1.12.12
pkgrel=0
pkgdesc="IPC/message bus system, allowing user applications to communicate"
url="http://www.freedesktop.org/wiki/Software/dbus/"
pkggroups="messagebus"
pkgusers="messagebus"
arch="all"
options="!check"  # Requires running X11 server.
license="AFL-2.1 OR GPL-2.0+"
subpackages="$pkgname-dev $pkgname-doc $pkgname-libs $pkgname-openrc
	$pkgname-x11"
triggers="$pkgname.trigger=/etc/dbus-1/system.d"
depends=""
depends_dev="util-linux-dev"
makedepends="$depends_dev expat-dev libx11-dev autoconf automake libtool xmlto
	libsm-dev"
install="$pkgname.pre-install $pkgname.post-install"
source="http://dbus.freedesktop.org/releases/dbus/dbus-$pkgver.tar.gz
	$pkgname.initd
	"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--with-dbus-user=messagebus \
		--with-system-pid-file=/var/run/dbus.pid \
		--disable-verbose-mode \
		--disable-static \
		--enable-inotify \
		--disable-tests \
		--disable-asserts \
		--enable-user-session \
		--enable-xml-docs \
		--with-session-socket-dir=/tmp \
		--with-x
	make
}

package() {
	make -j1 DESTDIR="$pkgdir" install
	install -Dm755 "$srcdir"/dbus.initd "$pkgdir"/etc/init.d/dbus
}

libs() {
	pkgdesc="Libraries to communicate over D-Bus"
	replaces="dbus"
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/lib*.so.* "$subpkgdir"/usr/lib/
}

x11() {
	pkgdesc="X11 add-ons for D-Bus"
	depends="dbus=$pkgver-r$pkgrel"
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/dbus-launch "$subpkgdir"/usr/bin/
}

sha512sums="51af4e86ab7d36e1c9a861164e7cd7aa1605fdd82f90aed8728b34c45a87864a00671de9db00d88ea6f96be97459c7eb53d2517ea9d9687ae9ebf81c58c3a80f  dbus-1.12.12.tar.gz
df74e7d6a4f76f777d356e94bd23422b17656aa51a5b2d3c655fcabb32c84f2f06b9f5cd8827920d51842f89e8c0d968a6e723315e4bf216e55711fcda9b0ee9  dbus.initd"