# Maintainer: Maxime Gauduin <alucryd@archlinux.org>
# Contributor: Johnathan Jenkins <twodopeshaggy@gmail.com>
# Contributor: prettyvanilla <prettyvanilla@posteo.at>
# Contributor: almostalive <almostalive2003@gmail.com>

pkgname=libretro-genesis-plus-gx
pkgver=2306
pkgrel=1
pkgdesc='Sega MS/GG/MD/CD core'
arch=(x86_64)
url=https://github.com/libretro/Genesis-Plus-GX
license=(BSD LGPL2.1)
groups=(libretro)
depends=(
  libretro-core-info
  libvorbis
  zlib
)
makedepends=(
  clang
  git
)
_commit=65cd61cc262a8685d4f29ebcb7df2a40ed988e26
source=(libretro-genesis-plus-gx::git+https://github.com/libretro/Genesis-Plus-GX.git#commit=${_commit})
b2sums=('768dbb919571abb383501e2e768d1714029846acbde2f85d7c76b444bc8129f0fa0036bb8c3b07fc464b2220649128191a5d9b9e3ed4a9f5dc3204cd57904317')

pkgver() {
  cd libretro-genesis-plus-gx
  git rev-list --count HEAD
}

build() {
  export CC=clang # FS#71188 - [libretro-genesis-plus-gx] segfaults when compiled with -O2
  make \
    SHARED_LIBVORBIS=1 \
    SYSTEM_ZLIB=1 \
    -C libretro-genesis-plus-gx \
    -f Makefile.libretro
}

package() {
  install -Dm 644 libretro-genesis-plus-gx/genesis_plus_gx_libretro.so -t "${pkgdir}"/usr/lib/libretro/
  install -Dm 644 libretro-genesis-plus-gx/LICENSE.txt -t "${pkgdir}"/usr/share/licenses/libretro-genesis-plus-gx/
}

# vim: ts=2 sw=2 et:
