# Maintainer: Luke R. <g4jc@openmailbox.org> GPG: rsa4096/3EAE8697

pkgname=kurso-de-esperanto
pkgver=4.1.2
pkgrel=1
pkgdesc="Kurso de Esperanto is a multimedia computer program for teaching yourself Esperanto."
arch=(i686 x86_64)
url="http://www.kurso.com.br/index.php?en"
license=('GPL3')
makedepends=('qt4' 'phonon' 'phonon-qt4-gstreamer' 'libxext' 'gcc')
source=("http://kurso.com.br/kurso4_source.tar.gz"
"http://kurso.com.br/kurso.amd64.tar.gz"
"https://www.gnu.org/licenses/gpl-3.0.txt")
sha512sums=('3c4b0d5ac87d30df4367da22c264c895f4c1f587ad07fa7fc174550944b3273d5bd2550662027404876c48ef7854663c1fa61cf1d3c361bc855503b86b57cea8'
            '078165e9b12735eb3d251108a3e3969aa91b64fd62c51d961cfbf7ae5b9557ea65f6f25cf406b5f015f4f38ef9d598f215a4b225f164957b9d205edbd222070a'
            '7633623b66b5e686bb94dd96a7cdb5a7e5ee00e87004fab416a5610d59c62badaf512a2e26e34e2455b7ed6b76690d2cd47464836d7d85d78b51d50f7e933d5c')

build() {
  cd $srcdir/kurso4
qmake-qt4
make PREFIX=/usr QMAKE=qmake-qt4 LRELEASE=lrelease-qt4 \
      DOC_PATH="\\\"/usr/share/doc/kurso4\\\"" \
      QMAKE_OPTS=DEFINES+=NO_DEBUG_ON_CONSOLE
}

package() {
  cd $srcdir/kurso4
  ## Install kurso binary into it's on folder + symlink ##
  install -D -m755 kurso4 "$pkgdir"/usr/bin/kurso-de-esperanto/kurso4
  ln -s "/usr/bin/kurso-de-esperanto/kurso4" "${pkgdir}/usr/bin/kurso4"
  ## Per http://uname.pingveno.net/blog/index.php/post/2013/06/23/How-to-compile-Kurso-de-Esperanto-from-source-with-Debian-and-Ubuntu ##
  ## We have to copy additional multimedia resources from the binary release, source archive is incomplete causing segfault. ##
  cd $srcdir/kurso-de-esperanto-4
  cp -r sonoj "$pkgdir"/usr/bin/kurso-de-esperanto/
  cp -r tradukoj "$pkgdir"/usr/bin/kurso-de-esperanto/
  cp -r video "$pkgdir"/usr/bin/kurso-de-esperanto/
  ## Install GPLv3 License
  echo "Per found source code references src/kurso4/ui_kurso.h:1620 and src/kurso4/kurso.ui:2397, we are installing GPLv3..."
  cd $srcdir
  install -D -m644 gpl-3.0.txt "$pkgdir"/usr/share/licenses/kurso
}
