# Maintainer: Mattias Andrée <`base64 -d`(bWFhbmRyZWUK)@member.fsf.org>
pkgname=util-say-git
pkgver=20130405.2
pkgrel=1
pkgdesc="Tools for creating ponies for cowsay and cowsay-like programs"
arch=('any')
url="https://github.com/maandree/util-say"
license=('GPL3')
depends=('java-runtime>=6')
makedepends=('git' 'java-environment>=6' 'bash')
optdepends=('imagemagick: allows imgsrcrecovery to read frames in GIF files' 'perl: required for cowsay import support')
provides=('util-say')
conflicts=('util-say')

_gitroot=https://github.com/maandree/util-say.git
_gitname=util-say

build() {
  cd "$srcdir"
  msg "Connecting to GIT server...."

  if [[ -d "$_gitname" ]]; then
    cd "$_gitname" && git pull origin
    msg "The local files are updated."
  else
    git clone "$_gitroot" "$_gitname"
  fi

  msg "GIT checkout done or server timeout"
  msg "Starting build..."

  rm -rf "$srcdir/$_gitname-build"
  git clone "$srcdir/$_gitname" "$srcdir/$_gitname-build"
  cd "$srcdir/$_gitname-build"

  make -B DESTDIR="$pkgdir/"
}

package() {
  cd "$srcdir/$_gitname-build"
  make DESTDIR="$pkgdir/" install
}

