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=(pam iso-codes xorg-libxinerama xorg-libxrandr
             xorg-libxcursor xorg-libxdamage gtk2)
run=(librsvg xorg-xinit)

PKGMK_GROUPS=()

name=lxdm
version=0.5.3
release=32

runyx_version=20201011
source=(lxdm-$version-nutyx-2.patch login.png
	https://downloads.tuxfamily.org/nutyx/files/runyx-${runyx_version}.tar.xz
	http://downloads.tuxfamily.org/nutyx/files/lxdm-nutyx-12-beta3.jpg
	http://downloads.sourceforge.net/$name/$name-$version.tar.xz)

build() {

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

auth     requisite      pam_nologin.so
auth     required       pam_env.so
auth     required       pam_succeed_if.so uid >= 1000 quiet
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=/lib/systemd/system

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

cp ../lxdm-nutyx-12-beta3.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}

# service
cd ../runyx-${runyx_version}
make DESTDIR=$PKG install-runyx-$name
sed -i '/agetty/d' $PKG/lib/init/services/lxdm/run
}
