# $Id: PKGBUILD,v 1.13 2007/06/19 02:12:51 Snowman Exp $
# Maintainer: Eric Belanger <eric@archlinux.org>
# Contributor: Alexander Baldeck <alexander@archlinux.org>
# Contributor: Marcel Wysocki <maci@satgnu.net>

pkgbase=snes9x
pkgname=('snes9x' 'snes9x-gtk')
pkgver=1.52
pkgrel=2
arch=('i686' 'x86_64')
url="http://www.snes9x.com"
license=('custom')
depends=('zlib' 'libpng' 'sdl' 'alsa-lib' 'libglade' 'libxv')
makedepends=('intltool' 'nasm' 'mesa')
source=(http://snes9x-gtk.googlecode.com/files/${pkgbase}-${pkgver}-src.tar.bz2)
md5sums=('813bd3a0f99732ee0238a2c8ab417725')
sha1sums=('fb3957b68fcede882518516094a73ec5bbed76cf')

build() {
  cd "${srcdir}/${pkgbase}-${pkgver}-src/unix"
  ./configure --prefix=/usr --with-sdd1-decomp --enable-netplay || return 1
  make || return 1

  cd "${srcdir}/${pkgbase}-${pkgver}-src/gtk"
  ./configure --prefix=/usr --with-sdd1-decomp --with-netplay --with-opengl || return 1
  make || return 1
}

package_snes9x() {
  pkgdesc="A portable Emulator for the Super Nintento Entertainment System"
  depends=('zlib' 'gcc-libs' 'libpng' 'libxext' 'libsm')

  cd "${srcdir}/${pkgbase}-${pkgver}-src/unix"
  install -D -m755 snes9x "${pkgdir}/usr/bin/snes9x" || return 1
  install -D -m644 "${srcdir}/${pkgbase}-${pkgver}-src/docs/snes9x-license.txt" \
    "${pkgdir}/usr/share/licenses/snes9x/LICENSE"
}

package_snes9x-gtk() {
  pkgdesc="A portable Emulator for the Super Nintento Entertainment System - GTK version"
  license=('custom' 'LGPL')
  depends=('sdl' 'libgl' 'alsa-lib' 'libglade' 'libxv')
  install=snes9x-gtk.install

  cd "${srcdir}/${pkgbase}-${pkgver}-src/gtk"
  make DESTDIR="${pkgdir}" install || return 1
  install -D -m644 "${srcdir}/${pkgbase}-${pkgver}-src/docs/snes9x-license.txt" \
    "${pkgdir}/usr/share/licenses/snes9x-gtk/LICENSE"
}