# Template file for 'colord'
pkgname=colord
version=1.0.6
revision=2
build_style=gnu-configure
configure_args="--disable-static --disable-schemas-compile
 --with-systemdsystemunitdir=/usr/lib/systemd/system --enable-vala
 --with-udevrulesdir=/usr/lib/udev/rules.d --disable-bash-completion
 --enable-polkit --enable-volume-search --with-daemon-user=colord"
hostmakedepends="pkg-config intltool docbook2x"
makedepends="vala-devel>=0.20 libgudev-devel polkit-devel lcms2-devel dbus-devel
 libusb-devel libgusb-devel>=0.1.6 systemd-devel sqlite-devel shared-color-profiles"
depends="shared-color-profiles shadow"
conf_files="/etc/colord.conf"
lib32disabled=yes
system_accounts="colord"
colord_homedir="/var/lib/colord"
make_dirs="
	/var/lib/colord 0755 colord colord
	/var/lib/colord/icc 0755 colord colord"
short_desc="System daemon for managing color devices"
maintainer="Juan RP <xtraeme@gmail.com>"
homepage="http://www.freedesktop.org/software/colord"
license="GPL-2"
distfiles="$homepage/releases/$pkgname-$version.tar.xz"
checksum=a40bbceaa3d3b1d6fd2777b181bf641b4eb49ad249796823585136c146ad7e8e

if [ "$CROSS_BUILD" ]; then
	hostmakedepends+=" libtool glib-devel colord"
fi

# Package build options
build_options="gir"
desc_option_gir="Enable support for building gobject introspection data"

# Disable gir for cross builds.
if [ -z "$CROSS_BUILD" ]; then
	build_options_default="gir"
fi

if [ "$build_option_gir" ]; then
	configure_args+=" --enable-introspection"
	hostmakedepends+=" gobject-introspection"
else
	configure_args+=" --disable-introspection"
fi

pre_configure() {
	if [ "$CROSS_BUILD" ]; then
		# Use host cd-create-profile instead.
		sed -e 's,$(top_builddir)/client/cd-create-profile,cd-create-profile,g' -i data/profiles/Makefile.in
		libtoolize -f
	fi
}

libcolord_package() {
	short_desc+=" - runtime library"
	replaces="colord<1.0.6"
	pkg_install() {
		if [ "$build_option_gir" ]; then
			vmove usr/lib/girepository-1.0
		fi
		vmove "usr/lib/*.so.*"
	}
}

colord-devel_package() {
	depends="dbus-devel libglib-devel lcms2-devel libcolord>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/pkgconfig
		vmove "usr/lib/*.so"
		if [ "$build_option_gir" ]; then
			vmove usr/share/gir-1.0
			vmove usr/share/vala
		fi
	}
}
