#Packager: Richard Lapointe <richard@laprjns.com>
#Former Packager(s): Name <email@address.com>
#Anything commented out is optional and can be deleted.

pkgname=putty	
pkgver=0.62
pkgrel=1rl
#arch=noarch
source=("ftp://ftp.chiark.greenend.org.uk/users/sgtatham/$pkgname-$pkgver/$pkgname-$pkgver.tar.gz" \
	"putty-gtk+.patch")
sourcetemplate=http://people.salixos.org/laprjns/$pkgname/$pkgver/
docs=("readme" "install" "copying" "changelog" "authors" "news" "todo")
url=http://www.chiark.greenend.org.uk/~sgtatham/putty/
#dotnew=()
#CFLAGS=
#CXXFLAGS=
#options=('noextract')

#doinst() {
#
#}

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"putty (A Free Telnet/SSH Client)"
"PuTTY is a free implementation of Telnet and SSH for Win32 and Unix"
"platforms, along with an xterm terminal emulator. It is written and"
"maintained primarily by Simon Tatham."
)


build() {
	cd $startdir/src/$pkgname-$pkgver/unix/
	patch -p2 <../../putty-gtk+.patch 
	./configure --prefix=/usr --libdir=/usr/lib${LIBDIRSUFFIX} --localstatedir=/var --sysconfdir=/etc --build=$arch-slackware-linux
	make -j $numjobs || return 1
	make install DESTDIR=$startdir/pkg
	
	cd $startdir/pkg/
	install -dm755 usr/share/icons/hicolor/{16x16,32x32,48x48}
	cd "${startdir}/src/${pkgname}-${pkgver}/windows"
	
	# lets deal with the icons
	for size in 16 32 48;do
	  convert -resize ${size}x${size} putty.ico putty.${size}.png
	  install -Dm644 putty.${size}-2.png ${startdir}/pkg/usr/share/icons/hicolor/${size}x${size}/apps/putty.png
	done
	
	# need a desktop file
	install -dm755 "$startdir"/pkg/usr/share/applications
	cat <<-_EOF_ > "$startdir"/pkg/usr/share/applications/putty.desktop
	[Desktop Entry]
	Name=Putty
	TryExec=putty
	Exec=putty %F
	Icon=putty
	Terminal=false
	Type=Application
	Categories=Application;Network
	GenericName=SSH/Telnet Client
	Comment=A terminal intergrated SSH/Telnet client
	_EOF_
}