SUMMARY="SEGA Genesis/Mega Drive emulator"
DESCRIPTION="DGen is a free, open source and portable emulator for the Sega \
Genesis and Mega Drive systems. Features:
 * Game Genie/Hex codes support
 * PAL/NTSC, fullscreen modes
 * Joypad/joystick support
 * Mouse support
 * Highly configurable controls
 * Screenshots, demos recording and playback"
HOMEPAGE="http://dgen.sourceforge.net/"
COPYRIGHT="1998-2014 tamentis & zamaz"
SOURCE_URI="http://sourceforge.net/projects/dgen/files/dgen/$portVersion/dgen-sdl-$portVersion.tar.gz"
CHECKSUM_SHA256="99e2c06017c22873c77f88186ebcc09867244eb6e042c763bb094b02b8def61e"
SOURCE_DIR="dgen-sdl-$portVersion"
REVISION="1"
LICENSE="BSD (2-clause)"

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"

PROVIDES="
	dgen$secondaryArchSuffix = $portVersion
	cmd:dgen = $portVersion
	cmd:dgen_tobin = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libsdl_1.2$secondaryArchSuffix
	gcc_syslibs$secondaryArchSuffix
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libsdl_1.2$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:awk
	cmd:nasm
	cmd:make
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	"

BUILD()
{
	runConfigure --omit-dirs binDir ./configure --bindir=$prefix/bin
	make $jobArgs
}

INSTALL()
{
	make install
	addAppDeskbarSymlink $prefix/bin/dgen "DGen"
}
