SUMMARY="NES/Famicom emulator"
DESCRIPTION="FCEUX is an emulator for the NES and Famicom, based on FCE Ultra \
which is based on FCE. It combines many different changes of FCE Ultra, like \
support for a lot of the different hardware of NES Cartridges, rerecording \
bult-in and a high level of portability."
HOMEPAGE="http://fceux.com/web/"
COPYRIGHT="1998-2014 tamentis & zamaz"
SOURCE_URI="http://sourceforge.net/projects/fceultra/files/Source%20Code/2.2.2%20src/fceux-2.2.2.src.tar.gz"
CHECKSUM_SHA256="804d11bdb4a195f3a580ce5d2d01be877582763378637e16186a22459f5fe5e1"
REVISION="1"
LICENSE="GNU GPL v2"

ARCHITECTURES="x86 ?x86_64"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
    # x86_gcc2 is fine as primary target architecture as long as we're building
    # for a different secondary architecture.
    ARCHITECTURES="$ARCHITECTURES x86_gcc2"
else
    ARCHITECTURES="$ARCHITECTURES !x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"

PATCHES="fceux-$portVersion.patch"

PROVIDES="
	fceux$secondaryArchSuffix = $portVersion
	cmd:fceux$secondaryArchSuffix = $portVersion
	"

REQUIRES="
	haiku$secondaryArchSuffix
	lib:libsdl$secondaryArchSuffix
	lib:libgl$secondaryArchSuffix
	glu$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	lib:libstdc++$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libsdl$secondaryArchSuffix
	devel:libgl${secondaryArchSuffix}
	glu${secondaryArchSuffix}_devel
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:scons
	cmd:g++$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	"

BUILD()
{
	scons OPENGL=1 GTK=0 LUA=0 $jobArgs
}

INSTALL()
{
	mkdir -p $binDir $manDir/man6
	cp bin/fceux $binDir
	cp documentation/fceux.6 $manDir/man6
}
