# $Id: PKGBUILD 84661 2010-07-03 04:01:39Z allan $
# Maintainer: Allan McRae <allan@archlinux.org>
# Contributor: Eric Belanger <eric@archlinux.org>
# Contributor: John Proctor <jproctor@prium.net>

pkgname=pcre
pkgver=8.10
pkgrel=1
pkgdesc="A library that implements Perl 5-style regular expressions"
arch=('i686' 'x86_64') 
url="http://www.pcre.org/"
license=('BSD')
depends=('gcc-libs')
options=('!libtool')
source=(ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/${pkgname}-${pkgver}.tar.bz2)
md5sums=('780867a700e9d4e4b9cb47aa5453e4b2')
sha1sums=('8b345da0f835b2caabff071b0b5bab40564652be')

build() {
  cd "${srcdir}"/${pkgname}-${pkgver}
  [ "${CARCH}" = "x86_64" ] && export CFLAGS="${CFLAGS} -fPIC"
  ./configure --prefix=/usr --enable-utf8 --enable-unicode-properties
  make
}

package() {
  cd "${srcdir}"/${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install
  
  # grep uses pcre, so we need the libs in /lib
  install -dm755 "${pkgdir}"/lib
  mv "${pkgdir}"/usr/lib/libpcre.so.* "${pkgdir}"/lib/
  ln -sf ../../lib/libpcre.so.0 "${pkgdir}"/usr/lib/libpcre.so
  
  install -Dm644 LICENCE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
}