# Packager: Phill Watkins <ubemail~at~ymail~dot~com>

pkgname=lxsession-edit
pkgver=0.1.1
pkgrel=2pw
#arch=noarch
source=\
(
"http://downloads.sourceforge.net/lxde/lxsession-edit-0.1.1.tar.gz"
"http://people.salixos.org/pwatk/packages/xap/$pkgname/$pkgver/stampit.patch.gz"
"http://people.salixos.org/pwatk/packages/xap/$pkgname/icons.tar.gz"
)
sourcetemplate=http://people.salixos.org/pwatk/packages/xap/$pkgname/$pkgver
docs=("AUTHORS" "ChangeLog" "COPYING" "INSTALL" "NEWS" "README")
url=http://lxde.sourceforge.net/

doinst() {
if [ -x usr/bin/update-desktop-database ]; then
  usr/bin/update-desktop-database -q
fi

if [ -x usr/bin/gtk-update-icon-cache ]; then
  usr/bin/gtk-update-icon-cache -f usr/share/icons/hicolor
fi
}

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"lxsession-edit (LXDE session configurator)"
"LXSession Edit is the standard session edit manager used by LXDE."
"LXSession Lite suppports the autostart freedesktop.org specs. However,"
"autostart spec is a term for developers and it’s meaningless for end"
"users. Basically, it provides a way to automatically start some"
"applications after login. Now this can (partially) be configured"
"through a simple GUI - LXSession Edit."
)

build() {
    set -e

    cd $startdir/src/$pkgname-$pkgver

    # lxappearance and lxrandr build in infinite loop - ID: 2873585
    # ...and lxsession-edit it seams.
    patch -p1 --verbose < $startdir/src/stampit.patch
    
    sed -i -e "/^Icon/s|=.*$|=session-properties|" lxsession-edit.desktop.in

    ./configure \
      --prefix=/usr \
      --sysconfdir=/etc \
      --localstatedir=/var \
      --mandir=/usr/man \
      --infodir=/usr/info \
      --docdir=/usr/doc/$pkgname-$pkgver \
      --build=$arch-slackware-linux

    make --jobs=$(( $(getconf _NPROCESSORS_ONLN) + 1 ))
    make install DESTDIR=$startdir/pkg
    
    for icon in 16x16 22x22 24x24 32x32 scalable ;do
      install -Dm 0644 $startdir/src/icons/$icon $startdir/pkg/usr/share/icons/hicolor/$icon/apps/session-properties.png
    done
    mv $startdir/pkg/usr/share/icons/hicolor/scalable/apps/session-properties{.png,.svg}
      
    set +e
}