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

pkgname=libretro-bsnes
pkgver=554
pkgrel=1
pkgdesc='Super Nintendo Entertainment System cores'
arch=(x86_64)
url='https://github.com/libretro/bsnes-libretro'
license=(GPL3)
groups=('libretro')
depends=(libretro-core-info)
makedepends=(git)
_commit='c6e90ddcdfdc5ca1b56319df662912b3c026d78f'
source=(
  libretro-bsnes::git+https://github.com/libretro/bsnes-libretro#commit=${_commit}
  libretro-bsnes-flags.patch
)
sha256sums=('SKIP'
            '3b1119c29373cf4bbbe4ea39bd4ad3c9bfea7501015b51b09caa95a02773058d')

pkgver() {
  cd libretro-bsnes

  git rev-list --count HEAD
}

prepare() {
  cd libretro-bsnes

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

build() {
  cd libretro-bsnes

  for p in accuracy balanced performance; do
    make profile=${p}
  done
}

package() {
  cd libretro-bsnes

  for p in accuracy balanced performance; do
    install -Dm 644 out/bsnes_${p}_libretro.so -t "${pkgdir}"/usr/lib/libretro/
  done
}

# vim: ts=2 sw=2 et:
