# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: David Demelier <markand@malikania.fr>
pkgname=libretro-mupen64plus
pkgver=0_git20230124
pkgrel=0
_commit="5a63aadedc29655254d8fc7b4da3a325472e198b"
arch="x86_64" # Seems to be broken on non 64-bit platforms
url="https://github.com/libretro/mupen64plus-libretro-nx"
pkgdesc="libretro port of Mupen64 Plus with GLideN64"
license="GPL-2.0-or-later"
makedepends="mesa-dev zlib-dev libpng-dev nasm"
source="$pkgname-$pkgver.tar.gz::https://github.com/libretro/mupen64plus-libretro-nx/archive/$_commit.tar.gz"
builddir="$srcdir/mupen64plus-libretro-nx-$_commit"
options="!check" # No tests

build() {
	case "$CARCH" in
		x86)
			WITH_DYNAREC=x86 make
			;;
		x86_64)
			WITH_DYNAREC=x86_64 make
			;;
		armhf|armv7|aarch64)
			WITH_DYNAREC=arm make
			;;
	esac
}

package() {
	install -Dm644 mupen64plus_next_libretro.so "$pkgdir"/usr/lib/libretro/mupen64plus_next_libretro.so
}

sha512sums="
987ace59cd2f7a5b45f15e96482ac7fd1101f75f5bde760a04db7d75ce0312d13a5c7ca0699d15342c81eb2998e453bde50020a5d68cd123aaf3c6750f7ef438  libretro-mupen64plus-0_git20230124.tar.gz
"
