# Maintainer: Nico Kruber <kruber at zib dot de>

pkgname=scalaris-bindings
pkgver=0.9.0
pkgrel=1
pkgdesc="Bindings and clients for Scalaris."
arch=('i686' 'x86_64')
url="http://scalaris.zib.de"
license=('Apache')
depends=('java-runtime>=1.6.0' 'python2>=2.6' 'python>=3.0' 'ruby>=1.8')
makedepends=('java-environment>=1.6.0' 'apache-ant' 'glib2' 'erlang>=R13B01')
optdepends=('java-runtime: Java API and client'
            'python2: Python2 API and client'
            'python: Python3 API and client'
            'ruby: Ruby API and client')
backup=('etc/scalaris/scalaris-java.conf' 'etc/scalaris/scalaris.properties')
source=(scalaris-$pkgver.tar.gz)
md5sums=('f188e12f4cf893022a87a1b29971aa81')

build() {
  # set JAVA_HOME for ant:
  source /etc/profile.d/jre.sh
  export JAVA_HOME=/usr/lib/jvm/default
  RUBY_SITELIB=$(ruby -rrbconfig -e 'puts RbConfig::CONFIG["sitelibdir"]')
  cd "$srcdir/scalaris-$pkgver"
  ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
    --with-ruby-sitelibdir=$RUBY_SITELIB
  ANT_OPTS="-Dfile.encoding=utf8 -Dant.build.javac.source=1.6 -Dant.build.javac.target=1.6" \
    make java
  make java-doc
  make python
  make python3
}

package() {
  cd "$srcdir/scalaris-$pkgver"
  make install-java DESTDIR="$pkgdir"
  make install-java-doc DESTDIR="$pkgdir"
  make install-python DESTDIR="$pkgdir"
  make install-python3 DESTDIR="$pkgdir"
  make install-ruby DESTDIR="$pkgdir"
  
  # put the LICENSE file to the licenses
  install -D -m644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
