# vim: set syn=sh:
# Packager: Phill Watkins <ubemail~at~ymail~dot~com>

pkgname=lxsession-edit
pkgver=0.1.1
pkgrel=3pw
#arch=noarch
source=("http://downloads.sourceforge.net/lxde/lxsession-edit-$pkgver.tar.gz" "preferences-system-session.svg.gz")
sourcetemplate=http://people.salixos.org/pwatk/packages/13.2/lxde/$pkgname
docs=("AUTHORS" "ChangeLog" "COPYING" "INSTALL" "NEWS" "README")
url=http://lxde.org/
options=('nosrcpack')

doinst() {
	if [ -x usr/bin/update-desktop-database ]; then
	  usr/bin/update-desktop-database > /dev/null 2>&1
	fi

	if [ -x usr/bin/gtk-update-icon-cache ]; then
	  usr/bin/gtk-update-icon-cache -f usr/share/icons/hicolor > /dev/null 2>&1
	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
	# fix build loop
	sed -e '/^stamp-it:/,/^$/s|^$|\ttouch $@\n|' -i po/Makefile.in.in
	./configure \
	  --prefix=/usr \
	  --sysconfdir=/etc \
	  --localstatedir=/var \
	  --mandir=/usr/man \
	  --infodir=/usr/info \
	  --docdir=/usr/doc/$pkgname-$pkgver \
	  --build=$arch-slackware-linux
	make -j $numjobs
	make install DESTDIR=$startdir/pkg

	# lets add some icons
	sed -e '/^Icon/s|=.*$|=lxsession-edit|' -i $startdir/pkg/usr/share/applications/lxsession-edit.desktop
	install -Dm 0644 $startdir/src/preferences-system-session.svg \
	  $startdir/pkg/usr/share/icons/hicolor/scalable/apps/lxsession-edit.svg
	for icon in 16 22 24 32 48 ;do
	  install -d $startdir/pkg/usr/share/icons/hicolor/${icon}x${icon}/apps
	  convert -resize ${icon}x${icon} -background none $startdir/src/preferences-system-session.svg \
	    $startdir/pkg/usr/share/icons/hicolor/${icon}x${icon}/apps/lxsession-edit.png
	done

	set +e
}