APP=fceux
VERSION=2.2.3
BUILD=1sml
HOMEPAGE="https://github.com/TASEmulators/fceux"
DOWNLOAD="https://github.com/TASEmulators/fceux/archive/refs/tags/fceux-2.2.3.tar.gz"
DESC="An 8-bit NES emulator based on FCE Ultra"
REQUIRES="libgd gtk2"

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

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

  # cc/gcc should either be in /bin or /usr/bin else the SCostruct file in 
  # scons will fail with a stupid error that zlib.h was not found, even 
  # though zlib is there. 
  # g++ is needed in /bin or /usr/bin else midway compile will fail.

  patch -p1 < $SRCDIR/ioapi.patch
  patch -p1 < $SRCDIR/scons-python3.patch

  sed -i \
   -e "s|symbols', 1|symbols', 0|" \
   -e "s|release', 0|release', 1|" \
   SConstruct

  scons install -i --prefix=$PKG

  # Delete low res icon and replace below, also delete unneeded .dll files
  #rm -f $PKG/usr/share/pixmaps/fceux.png
  #rm -f $PKG/usr/share/$PRGNAME/*.dll

  cp COPYING $PKGDOCS/

  mkfinalpkg
}

SHA512SUMS="
cd8053f0cef3df30e3d009bf0a53ef59d9fa2b342d03300a75caafb0591e62a6bfbc6c12b3efe72e0aba050dc58e401daf54298328979e5b1b9552a91b1d1459  fceux-2.2.3.tar.lz
799b42272c637c90e7389b7907e9d36956a0640366d80ea71a4416237178461f4f39b863c230f878b0adfa7ceec4ed2379b58e07dcecd2c49269739e3e158c03  ioapi.patch
2c2cf6d7eac03a4cf7f66118e0f8af9562eb5497c2e3159952eced1edee5f38c983ede704536eade645f5c028635b8ff0ceca8769dcf0d50b3159a1666660ae0  scons-python3.patch
"
