SUMMARY="A cross-platform 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="https://liballeg.org/"
COPYRIGHT="1998-2019 Shawn Hargreaves et al."
LICENSE="Allegro"
REVISION="1"
SOURCE_URI="https://github.com/liballeg/allegro5/releases/download/$portVersion/allegro-$portVersion.tar.gz"
CHECKSUM_SHA256="ec19dbc9a021244582b4819b3583ee594b50141f9fcf6944a4ed8069cbf8d4d4"
PATCHES="allegro-$portVersion.patchset"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

libVersion="4.4.3"
libVersionCompat="$libVersion compat >= 4.4"

PROVIDES="
	allegro$secondaryArchSuffix = $portVersion
	lib:liballeg$secondaryArchSuffix = $libVersionCompat
	lib:liballeggl$secondaryArchSuffix = $libVersionCompat
	lib:libjpgalleg$secondaryArchSuffix = $libVersionCompat
	lib:libloadpng$secondaryArchSuffix = $libVersionCompat
	lib:liblogg$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libGLU$secondaryArchSuffix
	lib:libogg$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libvorbis$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	allegro${secondaryArchSuffix}_devel = $portVersion
	cmd:allegro_config$secondaryArchSuffix = $portVersion
	devel:liballeg$secondaryArchSuffix = $libVersionCompat
	devel:liballeggl$secondaryArchSuffix = $libVersionCompat
	devel:libjpgalleg$secondaryArchSuffix = $libVersionCompat
	devel:libloadpng$secondaryArchSuffix = $libVersionCompat
	devel:liblogg$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	allegro$secondaryArchSuffix == $portVersion base
	devel:libGL$secondaryArchSuffix
	devel:libGLU$secondaryArchSuffix
	devel:libogg$secondaryArchSuffix
	devel:libpng16$secondaryArchSuffix
	devel:libvorbis$secondaryArchSuffix
	devel:libvorbisfile$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"

PROVIDES_tools="
	allegro${secondaryArchSuffix}_tools
	cmd:colormap$secondaryArchSuffix = $portVersion
	cmd:dat$secondaryArchSuffix = $portVersion
	cmd:dat2c$secondaryArchSuffix = $portVersion
	cmd:dat2s$secondaryArchSuffix = $portVersion
	cmd:exedat$secondaryArchSuffix = $portVersion
	cmd:grabber$secondaryArchSuffix = $portVersion
	cmd:pack$secondaryArchSuffix = $portVersion
	cmd:pat2dat$secondaryArchSuffix = $portVersion
	cmd:rgbmap$secondaryArchSuffix = $portVersion
	cmd:textconv$secondaryArchSuffix = $portVersion
	"
REQUIRES_tools="
	haiku$secondaryArchSuffix
	allegro$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libGL$secondaryArchSuffix
	devel:libGLU$secondaryArchSuffix
	devel:libogg$secondaryArchSuffix
	devel:libpng16$secondaryArchSuffix
	devel:libvorbis$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

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

INSTALL()
{
	make install

	prepareInstalledDevelLibs liballeg liballeggl \
		libjpgalleg libloadpng liblogg
	fixPkgconfig

	packageEntries devel \
		$binDir/allegro-config \
		$developDir
	packageEntries tools \
		$binDir/
}
