SUMMARY="An Odyssey 2 / VideoPac emulator using the libretro API"
DESCRIPTION="This is the libretro port of O2EM, a Magnavox Odyssey 2 and \
Philips VideoPac emulator. These machines shared the same hardware and were \
rebranded depending on the market where they were sold."
HOMEPAGE="http://o2em.sourceforge.net/"
COPYRIGHT="1996-2018 Daniel Boris, the O2EM team, the libretro team"
LICENSE="Artistic"
REVISION="1"
srcGitRev="f1050243e0d5285e7769e94a882b0cf39d2b7370"
SOURCE_URI="https://github.com/libretro/libretro-o2em/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="a6347907481e044140daf4f7bb15fd59908258e00b0a28de43917140ebcf4be7"
SOURCE_FILENAME="libretro-o2em-${portVersion/_/-}-$srcGitRev.tar.gz"
SOURCE_DIR="libretro-o2em-$srcGitRev"
ADDITIONAL_FILES="o2em_libretro.info.in"

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

PROVIDES="
	o2em_libretro$secondaryArchSuffix = $portVersion
	addon:o2em_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/o2em_libretro.info.in \
		> o2em_libretro.info
	make $jobArgs
}

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