SUMMARY="A C library for handling SMF files"
DESCRIPTION="LibSMF is a BSD-licensed C library for handling \
SMF (*.mid) files. It transparently handles conversions between time \
and pulses, tempo map handling etc. The only dependencies are C \
compiler and glib. Full API documentation and examples are included"
HOMEPAGE="https://sourceforge.net/projects/libsmf/"
COPYRIGHT="2007-2008 Edward Tomasz Napieraa
	2013 John Stumpo"
LICENSE="BSD (2-clause)"
REVISION="2"
SOURCE_URI="https://downloads.sourceforge.net/libsmf/libsmf-$portVersion.tar.gz"
CHECKSUM_SHA256="d3549f15de94ac8905ad365639ac6a2689cb1b51fdfa02d77fa6640001b18099"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

PROVIDES="
	libsmf$secondaryArchSuffix = $portVersion
	cmd:smfsh$secondaryArchSuffix = $portVersion
	lib:libsmf$secondaryArchSuffix = 0.0.0 compat >= 0
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libglib_2.0$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	"

PROVIDES_devel="
	libsmf${secondaryArchSuffix}_devel = $portVersion
	devel:libsmf$secondaryArchSuffix = 0.0.0 compat >= 0
	"
REQUIRES_devel="
	libsmf$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libglib_2.0$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	libtoolize --force --copy --install
	aclocal
	automake --add-missing
	runConfigure ./configure CPPFLAGS="-D_BSD_SOURCE"
	make $jobArgs
}

INSTALL()
{
	make install

	rm $libDir/libsmf.la

	prepareInstalledDevelLib libsmf
	fixPkgconfig

	if [ -n "$secondaryArchSuffix" ]; then
		rm -rf $manDir
	fi

	packageEntries devel \
		$developDir
}

TEST()
{
	make check
}
