description="System daemon for managing color devices"
url="http://www.freedesktop.org/software/colord/"
packager="tnut <tnut@nutyx.org>"
contributors="Pierre B"

name=colord
version=1.4.4
makedepends=(meson libgudev sqlite polkit lcms2 gobject-introspection libusb dbus vala libgusb)
source=(http://www.freedesktop.org/software/$name/releases/$name-$version.tar.xz)

prepare() {
SN="colord"
IDN="71"
if ! (getent group $SN > /dev/null); then
   groupadd -g $IDN $SN
fi
if ! (getent passwd $SN > /dev/null); then
   useradd -c "Color Daemon Owner" -d /var/lib/$SN \
   -u $IDN -g $SN -s /bin/false $SN
fi
}

build() {
cd $name-$version
mv po/fur.po po/ur.po
sed -i 's/fur/ur/' po/LINGUAS

mkdir build
cd    build
meson --prefix=/usr              \
	--sysconfdir=/etc        \
	--localstatedir=/var     \
	-Ddaemon_user=colord     \
        -Dvapi=true              \
	-Dsystemd=false          \
	-Dlibcolordcompat=true   \
	-Dargyllcms_sensor=false \
	-Dbash_completion=false  \
	-Ddocs=false             \
	-Dman=false ..
ninja
DESTDIR=$PKG ninja install
}
uptodate() {
local url ext
ext=".tar.xz"
url="https://www.freedesktop.org/software/$name/releases/"
lynx -read_timeout=20 -dump -listonly -nonumbers \
$url/?C=N\;O=D|grep $name-[0-9]|grep $ext$|head -1|sed "s@$url/$name-@@"|sed "s/$ext//"
}
