SUMMARY="The open-source IA-32 emulator"
DESCRIPTION="Bochs IA-32 Emulator provides a virtual PC that can run \
operating systems such as Windows, Linux, and BSD"
HOMEPAGE="http://bochs.sourceforge.net/"
COPYRIGHT="2001-2020 The Bochs Project"
LICENSE="GNU LGPL v2.1
	Bochs"
REVISION="1"
SOURCE_URI="https://downloads.sourceforge.net/bochs/bochs-$portVersion.tar.gz"
CHECKSUM_SHA256="63897b41fbbbdfb1c492d3c4dee1edb4224282a07bbdf442a4a68c19bcc18862"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	bochs$secondaryArchSuffix = $portVersion
	cmd:bochs$secondaryArchSuffix = $portVersion
	cmd:bximage$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libreadline$secondaryArchSuffix
	lib:libsdl$secondaryArchSuffix
	"
if [ "$effectiveTargetArchitecture" != x86_gcc2 ]; then
REQUIRES+="
	lib:libgfortran$secondaryArchSuffix
	"
fi

BUILD_REQUIRES="
	devel:libreadline$secondaryArchSuffix
	devel:libsdl$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
if [ "$effectiveTargetArchitecture" != x86_gcc2 ]; then
BUILD_REQUIRES+="
	devel:libgfortran$secondaryArchSuffix
	"
fi
BUILD_PREREQUIRES="
	haiku${secondaryArchSuffix}_devel
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:gzip
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:tar
	"
if [ "$effectiveTargetArchitecture" != x86_gcc2 ]; then
BUILD_PREREQUIRES+="
	cmd:gfortran$secondaryArchSuffix
	"
fi

defineDebugInfoPackage bochs$secondaryArchSuffix \
	"$binDir"/bochs \
	"$binDir"/bximage

BUILD()
{
	if [ $effectiveTargetArchitecture == x86_64 ]; then
		GCC5FLAGS="--enable-x86-64 --enable-smp"
	fi

	LIBS=-lnetwork runConfigure ./configure \
		--with-sdl \
		$GCC5FLAGS

	make $jobArgs
}

INSTALL()
{
	make install
}
