APP=gnuchess
VERSION=6.2.6
JENGVER=11.2
XBOARDVER=4.9.1
BUILD=1sml
HOMEPAGE="https://www.gnu.org/software/chess/"
DOWNLOAD="http://ftp.gnu.org/gnu/chess/gnuchess-6.2.6.tar.gz"
DESC="GPL licensed chess engines and graphical frontends"
REQUIRES="gcc-libs gdbm gtk2 graphite2 libpng netbsd-curses gobject-introspection"

build() {
  mkandenterbuilddir
  rm -rf gnuchess-$VERSION

  tar xf $SRCDIR/gnuchess-$VERSION.tar.?z* 
  cd gnuchess-$VERSION 
  fixbuilddirpermissions

  ./configure \
    --prefix="" \
    --sysconfdir=/etc 

  make
  make install DESTDIR=$PKG 

  cp COPYING $PKGDOCS/COPYING.gnuchess

  mkandenterbuilddir
  rm -rf Sjeng-Free-$JENGVER

  tar xf $SRCDIR/Sjeng-Free-$JENGVER.tar.?z*
  cd Sjeng-Free-$JENGVER
  fixbuilddirpermissions

  ./configure \
    --prefix=""

  make
  make install DESTDIR=$PKG

  mkandenterbuilddir
  rm -rf xboard-$XBOARDVER
  tar xf $SRCDIR/xboard-$XBOARDVER.tar.?z*
  cd xboard-$XBOARDVER
  fixbuilddirpermissions

  patch -p1 < $SRCDIR/xboard.conf.diff

  ./configure \
    --prefix="" \
    --sysconfdir=/etc \
    --with-gtk \
    --enable-zippy

  make 
  make install DESTDIR=$PKG
  install -c cmail $PKG/bin/cmail
  install -Dm 644 $SRCDIR/chess.png $PKG/share/pixmaps/chess.png

  cp COPYING $PKGDOCS/COPYING.xboard
  cp COPYRIGHT $PKGDOCS/COPYRIGHT.xboard

  mv $PKG/etc/xboard.conf $PKG/etc/xboard.conf.new

  mkfinalpkg
}

SHA512SUMS="
2a42baee5c64a8083e587fa0c748beac5a08906e95d46c7343955b336124f1fb560e8284a36d595839a190e9f784fe1f9d1cf7e79601373bbec05c4433108471  Sjeng-Free-11.2.tar.lz
d6adb251eeea0f1f962955dee1f0125e3e76893f6a6c30e774bd496515334572c8e906ac8cad140e1950fcc40cfe88ac05fbae8b08595acd7b86722e486ebae9  gnuchess-6.2.6.tar.lz
0ef5a24e19693ea768c01ae5891f7fb3f37ae6bdbee853f002f1ed5f9a4141452b8d32c49dfef69d591bc95aff8ce9e6a718aae16ba9ce50da7b43752ff9fcbf  xboard-4.9.1.tar.lz
fe9435e56f549703127576f4c614a6ad7bda67f7e5f6542a61889ed364a2ab6529c6ec1a1dc6435f3937e97a5f201d672e87ac448a3cb7466ba23de07676473a  xboard.conf.diff
"
