SUMMARY="A Soviet Electronica BK computers emulator core for libretro"
DESCRIPTION="This core emulates the Soviet Electronica BK computers series, \
including the BK-0010, BK-0010.01 and BK-0011(M), as well as the Terak \
8510/a, which is a 1976 American PDP-11/03 platform that the Electronica BK \
series were designed after. The BK series computers were the first \
mass-produced, affordable personal computers in Russia in the 1980s and they \
had a tremendous effect on the development of the Russian-speaking software \
community, similar to the C64, ZX Spectrum and Atari 2600 communities \
elsewhere in the world. These computers will accept console commands in \
English but respond mostly in Russian, so this core is mostly of use to \
Russian-speaking users."
HOMEPAGE="http://www.mailcom.com/bk0010/index_en.shtml"
COPYRIGHT="1994-2021, Eric A. Edwards, Leonid A. Broukhis, the libretro team"
LICENSE="MIT"
REVISION="1"
srcGitRev="70f4a2d812379b8e3e3c7ed3025d08583dee98b1"
SOURCE_URI="https://github.com/libretro/bk-emulator/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="872f4dc1d74abde95b3b052e1fd6f4443e39ee4dd9a566732577163721ab4749"
SOURCE_FILENAME="bk-emulator-${portVersion/_/-}-$srcGitRev.tar.gz"
SOURCE_DIR="bk-emulator-$srcGitRev"
ADDITIONAL_FILES="bk_libretro.info.in"

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

PROVIDES="
	bk_libretro$secondaryArchSuffix = $portVersion
	addon:bk_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/bk_libretro.info.in \
		> bk_libretro.info
	make -f Makefile.libretro $jobArgs GIT_VERSION=${srcGitRev:0:7}
}

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