# Contributor: Damian Kurek <starfire24680@gmail.com>
# Maintainer: Damian Kurek <starfire24680@gmail.com>
pkgname=kodi-game-libretro-theodore
pkgver=0.0.1.32
_realname=Nexus
pkgrel=0
pkgdesc="Libretro core for Thomson MO/TO emulation"
options="!check" # no test suite
url="https://github.com/kodi-game/game.libretro.theodore"
arch="x86_64 aarch64 armv7" # kodi is available only on these architectures
license="GPL-3.0-only"
makedepends="cmake kodi-dev samurai"
depends="kodi-game-libretro libretro-theodore"
source="$pkgname-$pkgver-$_realname.tar.gz::https://github.com/kodi-game/game.libretro.theodore/archive/$pkgver-$_realname.tar.gz"
builddir="$srcdir/game.libretro.theodore-$pkgver-$_realname"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_MODULE_PATH=/usr/lib/cmake/kodi
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
	rm -r "$pkgdir"/usr/share/kodi/addons/game.libretro.theodore/resources/icon.png \
		"$pkgdir"/usr/share/kodi/addons/game.libretro.theodore/resources/screenshot* \
		"$pkgdir"/usr/lib/kodi/addons/game.libretro.theodore/game.libretro.theodore.so
	ln -s /usr/lib/libretro/theodore_libretro.so \
		"$pkgdir"/usr/lib/kodi/addons/game.libretro.theodore/game.libretro.theodore.so
	sed -i '/<assets>/,/<\/assets>/d' "$pkgdir"/usr/share/kodi/addons/game.libretro.theodore/addon.xml
}

sha512sums="
c24c015361cd8c35152fe8f651aa31044c7f33836942f0d6696e4fe670f9d5dfcd39d49a5cd803e91518ddedcfa59bf14a8cabc06219dafdf16d4d6860145844  kodi-game-libretro-theodore-0.0.1.32-Nexus.tar.gz
"
