# Template file for 'colord'
pkgname=colord
version=1.4.5
revision=2
build_style=meson
build_helper="gir"
# man pages fail to generate
configure_args="-Dsystemd=false -Dsane=true -Dargyllcms_sensor=false -Dman=false
 -Ddaemon_user=colord -Ddocs=false $(vopt_bool gir introspection)
 $(vopt_bool vala vapi)"
hostmakedepends="gettext glib-devel pkg-config $(vopt_if vala vala)"
makedepends="bash-completion lcms2-devel libgudev-devel libgusb-devel
 polkit-devel sane-devel sqlite-devel"
short_desc="System daemon for managing color devices"
maintainer="Enno Boland <gottox@voidlinux.org>"
license="GPL-2.0-only"
homepage="https://www.freedesktop.org/software/colord"
distfiles="${homepage}/releases/${pkgname}-${version}.tar.xz"
checksum=b774ea443d239f4a2ee1853bd678426e669ddeda413dcb71cea1638c4d6c5e17

system_accounts="colord"
colord_homedir="/var/lib/colord"
make_dirs="
 /var/lib/colord 0755 colord colord
 /var/lib/colord/icc 0755 colord colord"

if [ "$CROSS_BUILD" ]; then
	hostmakedepends+=" colord"
fi

# Package build options
build_options="gir vala"
build_options_default="gir vala"

do_check() {
	# assertion failed (cd_edid_get_vendor_name (edid) == "LG"): (NULL == "LG")
	:
}

libcolord_package() {
	short_desc+=" - runtime library"
	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 eudev-libudev-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
		fi
		if [ "$build_option_vala" ]; then
			vmove usr/share/vala
		fi
	}
}

post_install() {
	vsv colord
}
