SUMMARY="Allegro game programming library"
DESCRIPTION="
Allegro 4 and Allegro 5 are cross-platform, libraries mainly aimed at video \
game and multimedia programming. They handle common, low-level tasks such as \
creating windows, accepting user input, loading data, drawing images, playing \
sounds, etc. and generally abstracting away the underlying platform. However, \
Allegro is not a game engine: you are free to design and structure your \
program as you like.

According to the Oxford Companion to Music, Allegro is the Italian for «quick, \
lively, bright». It is also a recursive acronym which stands for «Allegro Low \
LEvel Game ROutines». Allegro was started by Shawn Hargreaves in the mid-90's \
but has since received contributions from hundreds of people over the net.
"
HOMEPAGE="http://alleg.sourceforge.net/" 
SOURCE_URI="http://sourceforge.net/projects/alleg/files/allegro/4.4.2/allegro-4.4.2.tar.gz/download"
CHECKSUM_SHA256="1b21e7577dbfada02d85ca4510bd22fedaa6ce76fde7f4838c7c1276eb840fdc"
LICENSE="Allegro"
COPYRIGHT="1998-2010 Shawn Hargreaves et al."

REVISION="1"

ARCHITECTURES="x86_gcc2 x86 ?x86_64"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

PROVIDES="
	allegro$secondaryArchSuffix = $portVersion
	lib:liballeg$secondaryArchSuffix = $portVersion
	"

REQUIRES="
	haiku$secondaryArchSuffix
	lib:libpng$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	lib:libogg$secondaryArchSuffix
	lib:libvorbis$secondaryArchSuffix
	lib:libstdc++$secondaryArchSuffix
	"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	REQUIRES+="
		lib:libgcc_s$secondaryArchSuffix
	"
fi

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libpng$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	devel:libogg$secondaryArchSuffix
	devel:libvorbis$secondaryArchSuffix
	"

BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:cmake
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

PATCHES="allegro-4.4.2.patchset"

BUILD()
{
	cmake . -DCMAKE_INSTALL_PREFIX=$prefix -DDOCDIR=$docDir -DMANDIR=$manDir \
		-DLIB_SUFFIX=$secondaryArchSubDir
	make $jobArgs
}

INSTALL()
{
	make install

	prepareInstalledDevelLibs liballeg libjpgalleg libloadpng liblogg

	packageEntries devel $developDir $binDir
}

PROVIDES_devel="
	allegro${secondaryArchSuffix}_devel = $portVersion compat >= 4.4
	devel:liballeg$secondaryArchSuffix = $portVersion compat >= 4.4
	cmd:allegro_config$secondaryArchSuffix = $portVersion compat >= 4.4
	cmd:colormap$secondaryArchSuffix = $portVersion compat >= 4.4
	cmd:dat$secondaryArchSuffix = $portVersion compat >= 4.4
	cmd:dat2c$secondaryArchSuffix = $portVersion compat >= 4.4
	cmd:dat2s$secondaryArchSuffix = $portVersion compat >= 4.4
	cmd:exedat$secondaryArchSuffix = $portVersion compat >= 4.4
	cmd:grabber$secondaryArchSuffix = $portVersion compat >= 4.4
	cmd:pack$secondaryArchSuffix = $portVersion compat >= 4.4
	cmd:pat2dat$secondaryArchSuffix = $portVersion compat >= 4.4
	cmd:rgbmap$secondaryArchSuffix = $portVersion compat >= 4.4
	cmd:textconv$secondaryArchSuffix = $portVersion compat >= 4.4
	devel:libjpgalleg$secondaryArchSuffix = $portVersion compat >= 4.4
	devel:liblogg$secondaryArchSuffix = $portVersion compat >= 4.4
	devel:libloadpng$secondaryArchSuffix = $portVersion compat >= 4.4
	"

REQUIRES_devel="
	haiku$secondaryArchSuffix
	allegro$secondaryArchSuffix == $portVersion base
	"
