#Maintainer: Dimitris Jemos <djemos~at~slackel~dot~gr>

#Mandatory
pkgname=supertux2
pkgver=0.3.3
pkgrel=1dj
#source=("http://download.berlios.de/$pkgname/$pkgname-$pkgver.tar.bz2" "supertux.png")
source=("http://people.salixos.org/djemos/salix-current/$pkgname/$pkgname-$pkgver.tar.bz2" "supertux.png")

#Optional
docs=("README" "INSTALL" "COPYING" "WHATSNEW.TXT")
url=http://supertux.lethargik.org/index.html

slackdesc=\
(
 #|-----handy-ruler------------------------------------------------------|
 "SuperTux (classic 2D jump'n run sidescroller game)"
 "SuperTux is a classic 2D jump'n run sidescroller game in a style"
 "similar to the original SuperMario games."
 ""
 "Homepage: http://supertux.berlios.de/"
)

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

        mkdir build || return 1
        cd build  || return 1
        cmake .. -DCMAKE_INSTALL_PREFIX=/usr || return 1
        make || return 1
        make install DESTDIR=$startdir/pkg || return 1
      # create icons
    if [ -e "$startdir/pkg/usr/share/icons/hicolor/48x48/apps" ]; then
	    echo "perhaps icons already exists?"
		return 1
	fi
      mkdir -p $startdir/pkg/usr/share/icons/hicolor/48x48/apps || return 1
	  cp $startdir/src/supertux.png $startdir/pkg/usr/share/icons/hicolor/48x48/apps || return 1
      mkdir -p $startdir/pkg/usr/bin || return 1
            
    mkdir -p $startdir/pkg/usr/share/applications || return 1
	cp $startdir/src/$pkgname-$pkgver/supertux2.desktop $startdir/pkg/usr/share/applications/ || return 1
	sed -i "s/Categories=.*/Categories=Game;KidsGame;/" $startdir/pkg/usr/share/applications/supertux2.desktop || return 1
	sed -i "s/.png//" $startdir/pkg/usr/share/applications/supertux2.desktop || return 1
        
}