# $Id: PKGBUILD 69636 2012-04-20 21:36:55Z tdziedzic $
# Maintainer: Jaroslav Lichtblau <dragonlord@aur.archlinux.org>
# Contributor: Daniel J Griffiths <ghost1227@archlinux.us>
# Contributor: Ronald van Haren <ronald.archlinux.org>
# Contributor: Alessio 'mOLOk' Bolognino <themolok@gmail.com>
# Contributor: Pawel Rusinek <p.rusinek@gmail.com>

pkgname=griffith
pkgver=0.13
pkgrel=2
pkgdesc="Movie collection manager application"
arch=('any')
url="http://griffith.berlios.de"
license=('GPL2')
depends=('pygtk>=2.14.1' 'sqlite' 'python-pysqlite' \
         'python-reportlab>=2.3' 'pil' 'pyxml' 'python2-sqlalchemy')
optdepends=('python2-psycopg2: postgreSQL support'
            'mysql-python: MySQL support'
            'python2-chardet: encoding detection of imported CSV files'
            'gnome-python-extras: spell checking support'
            'griffith-extra-artwork: additional icons')
changelog=$pkgname.changelog
source=(http://launchpad.net/griffith/trunk/${pkgver}/+download/griffith-${pkgver}.tar.gz)
sha256sums=('60576d33aa855ab45d654288d7bf2ead8accecb72fd2acbc373656294ab8f242')

build() {
  cd griffith-${pkgver}

  # python2 fix
  sed -i 's_#!.*/usr/bin/env.*python_#!/usr/bin/env python2_' griffith

  # new bash_completion directory
  #sed -e 's,BASHCOMPDIR = $\(ETCDIR\)/bash_completion.d,BASHCOMPDIR = $\(PREFIX\)/share/bash-completion/completions,' -i Makefile
  sed -e 's,BASHCOMPDIR = $(ETCDIR)/bash_completion.d,BASHCOMPDIR = $(PREFIX)/share/bash-completion/completions,' -i Makefile
}

package() {
  cd griffith-${pkgver}

  make DESTDIR=${pkgdir} install

  # The program creates a wrong symlink so make a new one
  rm ${pkgdir}/usr/bin/griffith
  ln -s /usr/share/griffith/lib/griffith ${pkgdir}/usr/bin/griffith 
}
