description="Lightweight X11 Display Manager based on Gtk"
url="http://wiki.lxde.org/en/LXDM"

maintainer="dgod dot osa at gmail dot com"
packager="tnut <tnut@nutyx.org>"

makedepends=(iso-codes librsvg xorg-libxinerama xorg-libxrandr
             xorg-libxcursor xorg-libxdamage gtk2 consolekit2
             xorg-xinit)
run=(consolekit2 librsvg xorg-xinit)

PKGMK_GROUPS=()

name=lxdm
version=0.5.3
release=26

source=(lxdm-$version-nutyx-1.patch login.png
	http://downloads.tuxfamily.org/nutyx/files/lxdm-nutyx-11.0.jpg
	http://downloads.sourceforge.net/$name/$name-$version.tar.xz)

build() {

cd $name-$version
patch -Np1 -i ../lxdm-$version-nutyx-1.patch
cat > pam/lxdm << "EOF"
# Begin /etc/pam.d/lxdm

auth     requisite      pam_nologin.so
auth     required       pam_env.so
auth     include        system-auth

account  include        system-account

password include        system-password

session  required       pam_limits.so
session  include        system-session

# End /etc/pam.d/lxdm
EOF

./configure --sysconfdir=/etc \
	--prefix=/usr \
	--with-pam \
	--with-systemdsystemunitdir=no

make
  
make DESTDIR=$PKG install
for i in login.png
do
   cp ../$i \
   $PKG/usr/share/lxdm/themes/Industrial/$i
done

cp ../lxdm-nutyx-11.0.jpg \
$PKG/usr/share/lxdm/themes/Industrial/nutyx.jpg

# lxdm.conf created in post if needed
# Let keep it as an example
mv $PKG/etc/lxdm/lxdm.conf{,.example}

#
# runit:
# TODO: need to find a more generic solution
# like a function in pkgmk script
#
SERVICEDIR=lib/init/services/${name}
mkdir -p $PKG/$SERVICEDIR

cat > $PKG/$SERVICEDIR/run << "EOF"
#!/bin/sh
exec chpst -P /usr/sbin/lxdm
EOF
chmod 755 $PKG/$SERVICEDIR/run
}
