SUMMARY="MIDI to WAVE converter library"
DESCRIPTION="This library is based on the TiMidity decoder from SDL_sound \
library.
Purpose to create this library is to avoid unnecessary dependences. \
SDL_sound requires SDL and some other libraries, that not needed to \
process MIDI files.
In addition libTiMidity provides more suitable API to work with MIDI songs, \
it enables to specify full path to the timidity configuration file, and have \
function to retrieve meta data from MIDI song."
HOMEPAGE="http://libtimidity.sourceforge.net"
COPYRIGHT="1995 Tuukka Toivonen
	2004 Konstantin Korikov
	2007-2021 Ozkan Sezer"
LICENSE="GNU LGPL v2.1"
REVISION="1"
SOURCE_URI="http://downloads.sf.net/project/libtimidity/libtimidity/$portVersion/libtimidity-$portVersion.tar.gz"
CHECKSUM_SHA256="26447cbc049fb262e26b640e42c063e8694133aa92ff145e0d0b15a03a352e6a"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

libVersion="2.0.1"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"

PROVIDES="
	libtimidity$secondaryArchSuffix = $portVersion
	lib:libtimidity$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libao$secondaryArchSuffix
	"

PROVIDES_devel="
	libtimidity${secondaryArchSuffix}_devel = $portVersion
	devel:libtimidity$secondaryArchSuffix = libVersionCompat
	"
REQUIRES_devel="
	libtimidity$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libao$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	autoreconf -fi
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

	rm $libDir/libtimidity.la

	prepareInstalledDevelLib libtimidity
	fixPkgconfig

	# devel package
	packageEntries devel \
		$developDir
}
