# $Id: PKGBUILD 4449 2008-07-07 16:12:00Z eric $
# Maintainer: Eric Belanger <eric@archlinux.org>
# Contributor: John Proctor <jproctor@prium.net>

pkgname=pcre
pkgver=7.7
pkgrel=11
pkgdesc="A library that implements Perl 5-style regular expressions"
arch=('i686' 'x86_64') 
url="http://pcre.sourceforge.net"
license=('custom')
groups=('base')
depends=('gcc-libs')
options=('!libtool' '!makeflags')
source=(ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/${pkgname}-${pkgver}.tar.bz2 \
        libpcre-7.7-buffer-overflow.patch)
md5sums=('4b2e9cde1f7227448dddba59843efa0b' 'ea2204b6a0cbc83b3ca925ace06459a1')
sha1sums=('f1f54d3e13e6cb427de962e62eaaee32c74cba38' '5a69fb97f1fa547f9012082221a6b98d77b65277')

build() {
  cd ${srcdir}/${pkgname}-${pkgver}
  [ "${CARCH}" = "x86_64" ] && export CFLAGS="${CFLAGS} -fPIC"
  patch -p1 < ../libpcre-7.7-buffer-overflow.patch || return 1
  ./configure --prefix=/usr --enable-utf8 --enable-unicode-properties || return 1
  make || return 1
  make DESTDIR=${pkgdir} install || return 1
  # grep uses pcre, so we need the libs in /lib
  mkdir -p ${pkgdir}/lib
  mv ${pkgdir}/usr/lib/libpcre.so.* ${pkgdir}/lib/ || return 1
  ln -sf ../../lib/libpcre.so.0 ${pkgdir}/usr/lib/libpcre.so || return 1
  install -D -m644 LICENCE ${pkgdir}/usr/share/licenses/${pkgname}/license.txt || return 1
}