SUMMARY="A libretro port of Blargg's Game_Music_Emu music library"
DESCRIPTION="Game_Music_Emu emulates game music in several popular file \
formats: AY (ZX Spectrum, Amstrad CPC), GBS (Nintendo Game Boy), GYM (Sega \
Genesis, Mega Drive), HES (NEC TurboGrafx-16, PC Engine), KSS (MSX Home \
Computer, other Z80 systems (doesn't support FM sound)), NSF/NSFE (Nintendo \
NES, Famicom (with VRC 6, Namco 106, and FME-7 sound)), SAP (Atari systems \
using POKEY sound chip), SPC (Super Nintendo, Super Famicom), VGM/VGZ (Sega \
Master System, Mark III, Sega Genesis, Mega Drive, BBC Micro)"
HOMEPAGE="http://www.slack.net/~ant/libs/audio.html"
COPYRIGHT="2004-2020 Blargg, the libretro team"
LICENSE="GNU GPL v2
	GNU LGPL v2"
REVISION="1"
srcGitRev="42bff0eed05ce165c98b119bfd576d29982618e7"
SOURCE_URI="https://github.com/libretro/libretro-gme/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="582c023966669f956417efed7357da90cd27627135d2433208ecdad8ad257f5e"
SOURCE_FILENAME="libretro-gme-${portVersion/_/-}-$srcGitRev.tar.gz"
SOURCE_DIR="libretro-gme-$srcGitRev"
ADDITIONAL_FILES="gme_libretro.info.in"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	gme_libretro$secondaryArchSuffix = $portVersion
	addon:gme_libretro$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	retroarch$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	sed -e "s/@DISPLAY_VERSION@/v${portVersion/_/-}/" \
		$portDir/additional-files/gme_libretro.info.in \
		> gme_libretro.info
	make $jobArgs
}

INSTALL()
{
	install -m 0755 -d "$docDir"
	install -m 0644 -t "$docDir" LICENSE README.md
	install -m 0755 -d "$addOnsDir"/libretro
	install -m 0644 -t "$addOnsDir"/libretro \
		gme_libretro.info \
		gme_libretro.so
}
