SUMMARY="An emulator for the Commodore64 computers"
DESCRIPTION="VICE is a program that runs on a Unix, MS-DOS, Win32, OS/2, \
BeOS, Haiku, QNX 4.x, QNX 6.x, Amiga, Syllable or Mac OS X machine and \
executes programs intended for the old 8-bit computers. The current version \
emulates the C64, the C64DTV, the C128, the VIC20, practically all PET \
models, the PLUS4 and the CBM-II (aka C610/C510). An extra emulator is \
provided for C64 expanded with the CMD SuperCPU."
HOMEPAGE="http://vice-emu.sourceforge.net/"
COPYRIGHT="1998-2012 Dag Lem
	1999-2012 Andreas Matthies
	1999-2012 Martin Pottendorfer
	2005-2018 Marco van den Heuvel
	2006-2012 Christian Vogelgsang
	2007-2018 Fabrizio Gennari
	2007-2012 Daniel Kahlin
	2009-2018 Groepaz
	2009-2012 Ingo Korb
	2009-2012 Errol Smith
	2010-2018 Olaf Seibert
	2011-2018 Marcus Sutton
	2011-2012 Ulrich Schulz
	2011-2012 Stefan Haubenthal
	2011-2012 Thomas Giesel
	2011-2018 Kajtar Zsolt
	2012-2012 Benjamin 'BeRo' Rosseaux
	2016-2018 AreaScout
	2016-2018 Bas Wissink
	2017-2018 Michael C. Martin
	2000-2011 Spiro Trikaliotis
	1998-2010 Tibor Biczo
	1998-2010 Andreas Boose
	2007-2010 M. Kiesel
	2007-2011 Hannu Nuotio
	1999-2007 Andreas Dehmel
	2003-2005 David Hansel
	2000-2004 Markus Brenner
	1999-2004 Thomas Bretz
	1997-2001 Daniel Sladic
	1996-1999 Ettore Perazzoli
	1996-1999 Andre Fachat
	1993-1994, 1997-1999 Teemu Rantanen
	1993-1996 Jouko Valta"
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="https://downloads.sourceforge.net/vice-emu/vice-$portVersion.tar.gz"
CHECKSUM_SHA256="28d99f5e110720c97ef16d8dd4219cf9a67661d58819835d19378143697ba523"
PATCHES="vice-$portVersion.patchset"

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

commandSuffix=$secondaryArchSuffix
commandBinDir=$binDir
if [ "$targetArchitecture" = x86_gcc2 ]; then
 	commandSuffix=
 	commandBinDir=$prefix/bin
fi

GLOBAL_WRITABLE_FILES="
	settings/VICE directory keep-old
	"

PROVIDES="
	vice$secondaryArchSuffix = $portVersion
	cmd:c1541$commandSuffix
	cmd:cartconv$commandSuffix
	cmd:vsid$commandSuffix
	cmd:x128$commandSuffix
	cmd:x64$commandSuffix
	cmd:x64dtv$commandSuffix
	cmd:x64sc$commandSuffix
	cmd:xcbm2$commandSuffix
	cmd:xcbm5x0$commandSuffix
	cmd:xpet$commandSuffix
	cmd:xplus4$commandSuffix
	cmd:xscpu64$commandSuffix
	cmd:xvic$commandSuffix
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libpng16$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:autoheader
	cmd:automake
	cmd:bison
	cmd:find
	cmd:flex
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:makeinfo
	cmd:pkg_config$secondaryArchSuffix
	cmd:xa
	"

BUILD()
{
	./autogen.sh
	runConfigure --omit-dirs sbinDir ./configure \
		--sbindir=$commandBinDir
	make $jobArgs
}

INSTALL()
{
	make bindist
	mkdir -p $settingsDir/VICE $commandBinDir
	mv $sourceDir/BeVICE-3.2.x86/x* \
		$sourceDir/BeVICE-3.2.x86/vsid \
		$sourceDir/BeVICE-3.2.x86/cartconv \
		$sourceDir/BeVICE-3.2.x86/c1541 \
		$commandBinDir/
	mv $sourceDir/BeVICE-3.2.x86/* $settingsDir/VICE
}
