description="Lightweight X11 Display Manager based on Gtk"
url="https://en.wikipedia.org/wiki/LightDM"
packager="tnut <tnut@nutyx.org>"
contributors="Rems, Tnut, Daniel"

name=lightdm
version=1.30.0
nutyx_version=11.1

makedepends=(gtk3 libgcrypt pam pcre gobject-introspection xorg-libxklavier vala consolekit2)
run=(consolekit2)

source=(https://github.com/CanonicalLtd/$name/releases/download/$version/$name-$version.tar.xz
        http://downloads.tuxfamily.org/nutyx/files/nutyx-${nutyx_version}.tar.xz)

prepare() {
SN="lightdm"
IDN="65"
if ! (getent group $SN > /dev/null); then
   groupadd -g $IDN $SN
fi
if ! (getent passwd $SN > /dev/null); then
   useradd -c "Lightdm Daemon" -d /var/lib/$SN \
   -u $IDN -g $SN -s /bin/false $SN
fi
}
build() {
 
 cd $name-$version 
 
 ./configure \
     --prefix=/usr \
     --libexecdir=/usr/lib/lightdm \
     --localstatedir=/var \
     --sbindir=/usr/bin \
     --sysconfdir=/etc \
     --disable-static \
     --disable-tests \
     --with-greeter-user=$name \
     --with-greeter-session=lightdm-gtk-greeter \
     --docdir=/usr/share/doc/$name-$version

make
make DESTDIR=$PKG install

cp tests/src/lightdm-session $PKG/usr/bin

sed -i '1 s/sh/bash --login/' $PKG/usr/bin/lightdm-session

rm -rf $PKG/etc/init
install -v -dm755 -o lightdm -g lightdm $PKG/var/lib/lightdm
install -v -dm755 -o lightdm -g lightdm $PKG/var/lib/lightdm-data
install -v -dm755 -o lightdm -g lightdm $PKG/var/cache/lightdm
install -v -dm770 -o lightdm -g lightdm $PKG/var/log/lightdm

# Service
cd $SRC/nutyx-${nutyx_version}
make DESTDIR=$PKG install-lightdm

# Obsolets libs
rm $PKG/usr/lib/liblightdm-gobject-1.la
}
