#Maintainer: George Vlahavas <vlahavas~at~gmail~dot~com>

pkgname=syasokoban
pkgver=2.0.1
pkgrel=2gv
source=("http://grayskygames.com/sokoban/syasokoban-$pkgver.tar.gz" "syasokoban.desktop" "syasokoban-2.0.1-gcc4.3.patch")
docs=("readme.txt" "install" "copying" "changelog" "authors" "news" "todo")
url=http://grayskygames.com/sokoban.html

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"syasokoban (an implementation of the popular Sokoban puzzle game)"
"Still Yet Another Sokoban is an implementation of the popular Sokoban"
"puzzle game. The goal is to push the crates onto the designated"
"squares without getting stuck."
)


build() {
	cd $startdir/src/$pkgname-$pkgver

	patch -p1 < $startdir/src/syasokoban-2.0.1-gcc4.3.patch || exit 1
	sed -i -e "s,-ansi -Wall -I/usr/local/include,$CFLAGS -ansi -Wall -I/usr/include," Makefile || exit 1
	sed -i -e "s,data/sokoban/sokoban_icon.bmp,/usr/share/syasokoban/data/sokoban/sokoban_icon.bmp," src/Main.cpp || exit 1
	sed -i -e "s,data/,/usr/share/syasokoban/data/," src/djDesktop.cpp || exit 1

	make || return 1
	
        mkdir -p $startdir/pkg/usr/bin
	cp syasokoban $startdir/pkg/usr/bin/
	mkdir -p $startdir/pkg/usr/share/syasokoban
	cp -a data $startdir/pkg/usr/share/syasokoban/
	mkdir -p $startdir/pkg/usr/share/icons/hicolor/48x48/apps
	cp data/sokoban/SYASokoban.png $startdir/pkg/usr/share/icons/hicolor/48x48/apps/
	mkdir -p $startdir/pkg/usr/share/applications
	cp $startdir/src/syasokoban.desktop $startdir/pkg/usr/share/applications/
	chown -R root:root $startdir/pkg/usr/share/syasokoban
}