# $Id$
# Maintainer: Eric Belanger <eric@archlinux.org>
# Contributor: dorphell <dorphell@archlinux.org>

pkgname=libtiff
pkgver=3.8.2
pkgrel=5
pkgdesc="Library for manipulation of TIFF images"
arch=('i686' 'x86_64')
url="http://www.libtiff.org/"
license=('custom')
depends=('libjpeg>=7' 'zlib')
makedepends=('libgl' 'freeglut' 'libxmu' 'libxi')
optdepends=('freeglut: for using tiffgt')
options=('!libtool')
source=(ftp://ftp.remotesensing.org/pub/libtiff/tiff-${pkgver}.tar.gz \
	tiff2pdf-octal-printf.patch \
       	tiffsplit-fname-overflow.patch \
	CVE-2006-3459-3465.patch \
	tiff2pdf-compression.patch \
        tiff-3.8.2-CVE-2008-2327.patch)
md5sums=('fbb6f446ea4ed18955e2714934e5b698' 'd54368687d2645ffbbe6c2df384b11bf'\
         '323352fd60a7bd3ffac8724c3c031669' '624d3067e6a4c0680767eb62253ea980'\
         'b443ffca9d498bb3a88c17da0200025b' 'c2c2e22557d9c63011df5777dda6a86b')
sha1sums=('549e67b6a15b42bfcd72fe17cda7c9a198a393eb'
          'c79245249634a121bfaff6cfecb763f72fe7f8eb'
          'dc86bb68c7831ff70ff01d952d553be9f986be46'
          '85dc50a60a10025757e249d869dab7eb73ba6e3c'
          '508751f55131356ea8a7e7c4994ffbc9bd881769'
          '1da2ec6a47c0666cad9d07fb8427c1c75ca27b10')

build() {
  cd ${srcdir}/tiff-${pkgver}
  patch -Np1 -i ${srcdir}/tiff2pdf-octal-printf.patch || return 1
  patch -Np1 -i ${srcdir}/tiffsplit-fname-overflow.patch || return 1
  patch -Np1 -i ${srcdir}/CVE-2006-3459-3465.patch || return 1
  patch -Np1 -i ${srcdir}/tiff2pdf-compression.patch || return 1
  patch -Np1 -i ${srcdir}/tiff-3.8.2-CVE-2008-2327.patch || return 1
  ./configure --prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man || return 1
  make || return 1
  make DESTDIR=${pkgdir} install || return 1
  install -D -m644 COPYRIGHT ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE || return 1
}