# Template file for 'dbus'
#
pkgname=dbus
version=1.8.18
revision=2
short_desc="Message bus system"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
license="GPL-2"
homepage="http://dbus.freedesktop.org/"
distfiles="${homepage}/releases/dbus/dbus-${version}.tar.gz"
checksum=36f2eb9c777a3c71562573da36a147e900a642afcd44d2b0470d992a4898c4f2

build_pie=yes
create_wrksrc=yes
hostmakedepends="pkg-config intltool gperf xmlto"
makedepends="expat-devel libX11-devel libcap-devel"
conf_files="/etc/dbus-1/session.conf /etc/dbus-1/system.conf"

# Create dbus:22 system account.
system_accounts="dbus:22"

do_configure() {
	cd ${wrksrc}/dbus-${version}

	./configure ${configure_args} \
		--disable-selinux \
		--enable-inotify --with-dbus-user=dbus \
		--disable-doxygen-docs --enable-xml-docs --disable-static \
		--disable-tests --enable-epoll --disable-asserts \
		--disable-systemd \
		--with-system-socket=/run/dbus/system_bus_socket \
		--with-system-pid-file=/run/dbus/pid \
		--with-console-auth-dir=/run/console/ \
		--enable-abstract-sockets \
		ac_cv_have_abstract_sockets=yes
}

do_build() {
	cd ${wrksrc}/dbus-${version}
	make ${makejobs}
}
do_install() {
	cd ${wrksrc}/dbus-${version}
	make DESTDIR=${DESTDIR} install

	vsv dbus
}

dbus-devel_package() {
	depends="expat-devel dbus-libs>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove "usr/lib/dbus-*"
		vmove usr/lib/pkgconfig
		vmove "usr/lib/*.so"
		vmove usr/share/doc
	}
}
dbus-libs_package() {
	short_desc+=" - shared libraries"
	pkg_install() {
		vmove "usr/lib/*.so.*"
	}
}
dbus-x11_package() {
	replaces="dbus<1.4.16_2"
	short_desc+=" - X11 support"
	pkg_install() {
		vmove usr/bin/dbus-launch
		vmove usr/share/man/man1/dbus-launch.1
	}
}
