# Maintainer: bill-auger <bill-auger@programmer.net>
# Contributor: DonVla <donvla@users.sourceforge.net>


pkgname=yeahconsole
pkgver=0.3.4
pkgrel=2
pkgdesc="Simple, lightweight, game-like drop-down terminal, embedding xterm or urxvt"
arch=(i686 x86_64 armv7h)
url=http://phrat.de/yeahtools.html
license=('GPL')
groups=('yeahtools')
depends=('libx11' 'xterm')
optdepends=('rxvt-unicode')
_release=${pkgname}-${pkgver}
source=(http://phrat.de/${_release}.tar.gz
        restart_hidden.patch)
sha256sums=('fcf3481f78a263a70f1cb5163630fc22e78bb0915013eb05689c6f4aeb0583ef'
            'd5dfe9143f7e81ad7ca4f9e7ca58d589193c6ece51c3d7ec39da64511497f855')


prepare()
{
  cd "${srcdir}/${_release}"

  # patch per: http://github.com/rduplain/yeahconsole/commit/22488002357cda40ddcc67df695f64f5b06a44a6 :
  # yeahconsole restarts on exit when yeahconsole*restart:1 in .Xdefaults
  # yeahconsole restarts hidden/rolled-up when yeahconsole*restartHidden:1 in .Xdefaults
  # attention is given to avoid focus stealing on restartHidden
  patch < "${srcdir}/restart_hidden.patch"
}

build()
{
  cd "${srcdir}/${_release}"

  make || return 1
}

package()
{
  cd "${srcdir}/${_release}"

  install -D -m 0755 "${srcdir}/${_release}/yeahconsole" "${pkgdir}/usr/bin/yeahconsole"
  install -D -m 0644 "${srcdir}/${_release}README"       "${pkgdir}/usr/share/yeahtools/yeahconsole.README"
  install -D -m 0644 "${srcdir}/${pkgname}.desktop"      "${pkgdir}/usr/share/applications/${pkgname}.desktop"
}
