# Maintainer: Luke R. <g4jc@openmailbox.org> GPG: rsa4096/3EAE8697
# Contributor: bill-auger <bill-auger@programmer.net>


pkgname=kurso-de-esperanto
pkgver=4.1.3pre
pkgrel=1
pkgdesc="Kurso de Esperanto is a multimedia computer program for teaching yourself Esperanto"
arch=('armv7h' 'i686' 'x86_64')
url=http://www.kurso.com.br/
license=('GPL3')
depends=('qt5-multimedia')
source=(https://kurso.com.br/kurso_qt5_source.tar.gz \
        https://kurso.com.br/kurso4_only_qt.tar.gz   )
sha256sums=('166061290b71c823e90aa84ff250263bb05bca2c855994f180acf6f6814fba4d'  # pre-release source-ball
            'eea979391b016a630dc93bdf52f5d2075d4b5c55c7fda97e8f3372c66dea57d7') # pre-release binary assets

build()
{
  # cd "${srcdir}"/${pkgname}
  cd "${srcdir}"/KURSO_Qt5/ # pre-release source-ball

  qmake CONFIG+=release CONFIG+=force_debug_info
  make PREFIX=/usr
}

package()
{
  # cd "${srcdir}"/${pkgname}
  cd "${srcdir}"/KURSO_Qt5/ # pre-release source-ball

  _dest_dir="${pkgdir}"/usr/bin/${pkgname}

  # Install kurso binary into it's on folder + symlink
  install -D -m755 kurso4 ${_dest_dir}/kurso4
  ln -s /usr/bin/${pkgname}/kurso4 "${pkgdir}"/usr/bin/kurso4

  # Copy missing assets from the binary release, source archive is incomplete causing segfault
  cd "${srcdir}"/kurso4_only_qt/
  find sonoj/ tradukoj/ -type f -exec install -Dm644 {} ${_dest_dir}/{} \;
}
