# $Id$
# Maintainer: Ronald van Haren <ronald.archlinux.org>
# Contributor: Arjan Timmerman <arjan.archlinux.org>
# Contributor: Tom Newsom <Jeepster.gmx.co.uk>

pkgname=imlib2
pkgver=1.4.6
pkgrel=3
pkgdesc="Library that does image file loading and saving as well as rendering, manipulation, arbitrary polygon support"
url="http://sourceforge.net/projects/enlightenment/"
arch=('i686' 'x86_64')
license=('BSD')
depends=('libtiff' 'giflib' 'bzip2' 'freetype2' 'libxext' 'libpng' 'libid3tag' 'libjpeg-turbo')
source=(http://downloads.sourceforge.net/enlightenment/$pkgname-$pkgver.tar.bz2
        imlib2-giflib51.patch)
sha1sums=('20e111d822074593e8d657ecf8aafe504e9e2967'
          '3ee249142b4caecc4a38ac29a999708447f250c1')

prepare() {
  cd $pkgname-$pkgver
  patch -Np1 -i ../imlib2-giflib51.patch
  sed -i 's/@my_libs@//' imlib2-config.in
}

build() {
  cd $pkgname-$pkgver

  [ $CARCH = "i686" ] && EXTRAOPTS="--enable-mmx"
  [ $CARCH = "x86_64" ] && EXTRAOPTS="--enable-amd64"

  ./configure --prefix=/usr \
              --sysconfdir=/etc/imlib2 \
              --x-libraries=/usr/lib $EXTRAOPTS
  make
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install

  # Install License
  install -Dm644 COPYING "$pkgdir/usr/share/licenses/$pkgname/COPYING"
}