# Maintainer (AUR): Michael Schubert <mschu.dev at gmail>
# Contributor (AUR): Ronald van Haren <ronald.archlinux.org>
# Contributor (AUR): Stefan Husmann <stefan-husmann@t-online.de>
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>

pkgname=qtoctave
pkgver=0.10.1
pkgrel=4
arch=('i686' 'x86_64')
pkgdesc="Qt4 frontend for octave"
url="https://forja.rediris.es/projects/csl-qtoctave/"
license=('GPL2')
depends=('qt4' 'octave')
makedepends=('cmake')
source=("http://forja.rediris.es/frs/download.php/2054/${pkgname}-${pkgver}.tar.gz"
        fix-return-type.patch)
sha256sums=('4abd367924964887ea691f93c2c8ec90dcc64eb22827893dfb506ae43331b732'
            '1404491b5c03ae8977441abd99c212922a5b48b0dfb410e79c4838af45979e59')
install="qtoctave.install"
options=('!libtool' '!emptydirs')

prepare() {
  cd "$srcdir/$pkgname-$pkgver"
  patch -Np1 -i "$srcdir"/fix-return-type.patch
}

build() {
  cd "$srcdir/$pkgname-$pkgver"
  sed -i "s/\"lrelease\"/\"lrelease-qt4\"/" qtoctave/src/CMakeLists.txt

  cmake -DQT_QMAKE_EXECUTABLE=qmake-qt4 -DCMAKE_INSTALL_PREFIX=/usr \
      -DCMAKE_SKIP_RPATH=ON -DCMAKE_BUILD_TYPE=RELEASE .
  make
}

package() {
  cd "$srcdir/$pkgname-$pkgver"
  make DESTDIR="$pkgdir" install
}
