# Maintainer: Maxime Gauduin <alucryd@archlinux.org>

pkgname=libretro-bsnes-hd
pkgver=55
pkgrel=1
pkgdesc='Super Nintendo Entertainment System core'
arch=(x86_64)
url=https://github.com/DerKoun/bsnes-hd
license=(GPL3)
groups=(libretro)
depends=(
  gcc-libs
  libretro-core-info
)
makedepends=(git)
_commit=0bb7b8645e22ea2476cabd58f32e987b14686601
source=(
  libretro-bsnes-hd::git+https://github.com/DerKoun/bsnes-hd.git#commit=${_commit}
  libretro-bsnes-hd-flags.patch
)
sha256sums=('e56a2feabe25ac9f1cf3edb587897100e148747a5c06ef7a80d1f3d3ea72ca43'
            '8108ce3da95d9a7fd9fae00d2db042f1053e60d19fe87813b7ddf0aa5313cdd8')

prepare() {
  cd libretro-bsnes-hd

  patch -Np1 -i ../libretro-bsnes-hd-flags.patch
}

pkgver() {
  cd libretro-bsnes-hd

  git rev-list --count HEAD
}

build() {
  make -C libretro-bsnes-hd/bsnes -f GNUmakefile target=libretro binary=library local=false platform=linux
}

package() {
  install -Dm 644 libretro-bsnes-hd/bsnes/out/bsnes_hd_beta_libretro.so -t "${pkgdir}"/usr/lib/libretro/
}

# vim: ts=2 sw=2 et:
