# Maintainer: Cedric Girard <girard.cedric@gmail.com>
# Contributor: David Campbell <davekong@archlinux.us>
pkgname=ruby-xapian-full
pkgver=1.2.3
pkgrel=2
pkgdesc="Xapian bindings for Ruby without dependency on system Xapian library"
arch=('i686' 'x86_64')
url="http://rubygems.org/gems/xapian-full"
license=('GPL')
depends=('ruby' 'util-linux')
makedepends=('rubygems')
provides=('xapian-ruby-bindings')
conflicts=('xapian-ruby-bindings')
source=("http://gems.rubyforge.org/gems/xapian-full-${pkgver}.gem" "Rakefile.patch")
noextract=("xapian-full-${pkgver}.gem")
md5sums=('772947e9b6a03f37a00c361ac7492ad6'
         '3c88149fb08d46bcd1e49148afdd1384')
options=('!makeflags' '!libtool')

build() {
  cd $srcdir
  local _gemdir="$(ruby -rubygems -e'puts Gem.default_dir')"

  #patch Rakefile
  echo "Patching Rakefile ..."
  gem unpack xapian-full-${pkgver}.gem
  rm xapian-full-${pkgver}.gem
  cd xapian-full-${pkgver}
  patch -p1 < ../Rakefile.patch
  
  echo "Building gem..."
  gem build xapian-full.gemspec
  mv xapian-full-${pkgver}.gem ..
  cd ..
  rm -rf xapian-full-${pkgver}
  
  echo "Installing gem..."
  gem install --ignore-dependencies --verbose -i "$pkgdir$_gemdir" xapian-full-$pkgver.gem \
  -n "$pkgdir/usr/bin"
}

# vim:set ts=2 sw=2 et: