SUMMARY="A Dynamic Universal Music Library"
DESCRIPTION="DUMB is an IT, XM, S3M and MOD player library"
HOMEPAGE="http://dumb.sourceforge.net/"
COPYRIGHT="2001-2005 Ben Davis, Robert J Ohannessian and Julien Cugniere
	2015-2018 kode54"
LICENSE="DUMB-0.9.3"
REVISION="1"
srcGitRev="396caa4d31859045ccb5ef943fd430ca4026cce8"
SOURCE_URI="https://github.com/kode54/dumb/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="7ac7d38ca63d2f211b2252bdd063a3170e505bb4bdacbc6357d2aa4c5f0e3420"
SOURCE_FILENAME="dumb2-$portVersion-$srcGitRev.tar.gz"
SOURCE_DIR="dumb-$srcGitRev"

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

PROVIDES="
	dumb2$secondaryArchSuffix = $portVersion
	lib:libaldmb$secondaryArchSuffix = 2.0 compat >= 2
	lib:libdumb$secondaryArchSuffix = 2.0 compat >= 2
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:liballeg$secondaryArchSuffix
	"

PROVIDES_devel="
	dumb2${secondaryArchSuffix}_devel = $portVersion
	devel:libaldmb$secondaryArchSuffix = 2.0 compat >= 2
	devel:libdumb$secondaryArchSuffix = 2.0 compat >= 2
	"
REQUIRES_devel="
	dumb2$secondaryArchSuffix == $portVersion base
	"

PROVIDES_tools="
	dumb2${secondaryArchSuffix}_tools = $portVersion
	cmd:dumbout$secondaryArchSuffix = $portVersion
	cmd:dumbplay$secondaryArchSuffix = $portVersion
	"
REQUIRES_tools="
	dumb2$secondaryArchSuffix == $portVersion base
	haiku$secondaryArchSuffix
	lib:libargtable2$secondaryArchSuffix
	lib:libSDL2_2.0$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:liballeg$secondaryArchSuffix
	devel:libargtable2$secondaryArchSuffix
	devel:libSDL2$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	mkdir -p build && cd build

	cmake .. $cmakeDirArgs \
		-DCMAKE_BUILD_TYPE=Release \
		-DBUILD_SHARED_LIBS:BOOL=ON
	make $jobArgs
}

INSTALL()
{
	cd build
	make install

	prepareInstalledDevelLibs libdumb libaldmb
	fixPkgconfig

	# devel package
	packageEntries devel \
		$developDir
	packageEntries tools \
		$binDir
}
