SUMMARY="Emulator for classic PCs"
DESCRIPTION="PCem is an emulator for classic PCs, from the IBM PC to AMI \
WinBIOS. It also emulates a wide variety of graphics cards, including various \
3dFX Voodoo, ATI VGA, and IBM VGA."
HOMEPAGE="http://pcem-emulator.co.uk"
COPYRIGHT="2007-2015 Tom Walker"
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="http://pcem-emulator.co.uk/files/PCemV${portVersion}Linux.tar.gz"
CHECKSUM_SHA256="7d4e713b8198d95e7f629ae611dc8389bac8dcb370ab135272eafc5646435be8"
SOURCE_DIR=""

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

PROVIDES="
	pcem$secondaryArchSuffix = $portVersion
	app:pcem$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:liballeg$secondaryArchSuffix
	lib:libalut$secondaryArchSuffix
	lib:libopenal$secondaryArchSuffix
	"

BUILD_REQUIRES="
	devel:liballeg$secondaryArchSuffix
	devel:libalut$secondaryArchSuffix
	devel:libopenal$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	haiku${secondaryArchSuffix}_devel
	cmd:autoconf
	cmd:automake
	cmd:cp
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:sed
	"

PATCH()
{
	sed -i "s/\[pthread\]/\[root\]/g" configure.ac
}

BUILD()
{
	autoconf
	runConfigure ./configure
	sed -i s/aclocal-1.11/echo/g Makefile
	sed -i s/automake-1.11/echo/g Makefile
	sed -i s/autoconf-1.11/echo/g Makefile
	sed -i "s/-DHAVE_LIBROOT=1/-DHAVE_LIBPTHREAD=1 -D__unix/g" src/Makefile

	rm depcomp
	cp /system/data/automake-*/depcomp .
	make $jobArgs
}

INSTALL()
{
	make install
}
