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

pkgname=snes9x-gtk
pkgver=1.52.79
pkgrel=1pw
#arch=noarch
source=("http://snes9x-gtk.googlecode.com/files/snes9x-1.52-src.tar.bz2")
#source=("http://snes9x-gtk.googlecode.com/files/snes9x-$(echo $pkgver | awk -F. '{ print $1"."$2"-src-gtk-"$3 }').tar.bz2")
sourcetemplate=http://people.salixos.org/pwatk/packages/13.2/games/$pkgname
docs=\
(
"readme_unix.html"
"LICENSE" "README"
"changes.txt" "control-inputs.txt" "controls.txt" "gpl-2.0.txt" "lgpl-2.1.txt" "porting.html" "snes9x-license.txt" "snapshots.txt" "snes9x.conf.default"
)
url=http://code.google.com/p/snes9x-gtk/

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------------------------------------------------------|
"snes9x-gtk (A GTK+ port of the Snes9x emulator)"
"Snes9x is a portable, freeware Super Nintendo Entertainment System"
"(SNES) emulator. It basically allows you to play most games designed"
"for the SNES and Super Famicom Nintendo game systems on your PC or"
"Workstation"
)

build() {
	set -e
	
	cd $startdir/src/snes9x-*-src/unix
	./configure \
	  --prefix=/usr \
	  --bindir=/usr/games \
	  --sysconfdir=/etc \
	  --localstatedir=/var \
	  --mandir=/usr/man \
	  --infodir=/usr/info \
	  --docdir=/usr/doc/$pkgname-$pkgver \
	  --build=$arch-slackware-linux \
	  --enable-netplay
	sed -i -e '/^CCFLAGS/s|-O3|-O2|' Makefile
	make -j $numjobs 
	install -Dm 0755 snes9x $startdir/pkg/usr/games/snes9x

	cd $startdir/src/snes9x-*-src/gtk
	./configure \
	  --prefix=/usr \
	  --bindir=/usr/games \
	  --sysconfdir=/etc \
	  --localstatedir=/var \
	  --mandir=/usr/man \
	  --infodir=/usr/info \
	  --docdir=/usr/doc/$pkgname-$pkgver \
	  --build=$arch-slackware-linux \
	  --with-netplay
	make -j $numjobs
	make install DESTDIR=$startdir/pkg

	set +e
}