# $Id: PKGBUILD 96253 2010-10-19 15:06:00Z stephane $
# Maintainer: Allan McRae <allan@archlinux.org>
# Contributor: John Proctor <jproctor@prium.net>
# Contributor: Jeramy Rutley <jrutley@gmail.com>

pkgname=('ruby' 'ruby-docs')
pkgver=1.9.2_p0
_pkgver=1.9.2-p0
pkgrel=4
pkgdesc="An object-oriented language for quick and easy programming"
arch=('i686' 'x86_64')
url="http://www.ruby-lang.org/en/"
license=('custom')
makedepends=('gdbm' 'db' 'openssl' 'zlib' 'readline' 'tk' 'libffi'
             'doxygen' 'graphviz')
options=('!emptydirs')
source=("ftp://ftp.ruby-lang.org/pub/ruby/1.9/${pkgname}-${_pkgver}.tar.bz2")
md5sums=('d8a02cadf57d2571cd4250e248ea7e4b')
sha256sums=('e9710990ed8c2e794123aba509010471915fb13c27dae0118831d2001a9c8d3b')

build() {
  cd "${srcdir}/${pkgname}-${_pkgver}"
  ./configure --prefix=/usr \
      --enable-shared \
      --enable-pthread \
      --disable-rpath
  make
}

package_ruby()
{
  depends=('gdbm' 'db' 'openssl' 'zlib' 'readline' 'libffi')
  provides=('rubygems' 'rake')
  conflicts=('rubygems' 'rake')
  optdepends=('tk: for Ruby/TK')

  cd "${srcdir}/${pkgname}-${_pkgver}"
  make DESTDIR="${pkgdir}" install-nodoc
  install -Dm644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/COPYING"
}

package_ruby-docs()
{
  pkgdesc="Documentation files for ruby"
  #arch=('any')
  depends=('ruby')

  cd "${srcdir}/${pkgname}-${_pkgver}"
  make -j1 DESTDIR="${pkgdir}" install-doc install-capi
  install -Dm644 COPYING "${pkgdir}/usr/share/licenses/ruby-docs/COPYING"
}