SUMMARY="An audio meta-data library"
DESCRIPTION="TagLib is a free library written in C++ for reading and editing \
metadata that has been embedded into audio files. It is able to read and \
edit all relevant metadata formats for audio files, including APEv2, ID3 and \
Vorbis. It can find tags in multiple formats such as .mp3 .wma .wav .m4a \
.flac etc. TagLib is platform independent."
HOMEPAGE="https://github.com/taglib"
COPYRIGHT="2002-2013 Scott Wheeler"
LICENSE="GNU LGPL v2
	MPL v1.1"
REVISION="3"
SOURCE_URI="http://taglib.github.io/releases/taglib-1.9.1.tar.gz"
CHECKSUM_SHA256="72d371cd1419a87ae200447a53bff2be219283071e80fd12337928cc967dc71a"
PATCHES="taglib-1.9.1.patchset"

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

PROVIDES="
	taglib$secondaryArchSuffix = $portVersion
	cmd:taglib_config$secondaryArchSuffix
	lib:libtag$secondaryArchSuffix = 1.14.0 compat >= 1
	lib:libtag_c$secondaryArchSuffix = 0.0.0 compat >= 0
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	taglib${secondaryArchSuffix}_devel = $portVersion compat >= 1.9
	cmd:taglib_config$secondaryArchSuffix = $portVersion compat >= 1.9
	devel:libtag$secondaryArchSuffix = 1.14.0 compat >= 1
	devel:libtag_c$secondaryArchSuffix = 0.0.0 compat >= 0
	"
REQUIRES_devel="
	taglib$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:grep
	cmd:make
	cmd:sed
	"

BUILD()
{
	cmake	-DCMAKE_INSTALL_PREFIX:PATH=$prefix \
			-DBIN_INSTALL_DIR:PATH=$binDir \
			-DLIB_INSTALL_DIR:PATH=$libDir \
			-DINCLUDE_INSTALL_DIR:PATH=$includeDir \
			.
	make
}

INSTALL()
{
	make install

	prepareInstalledDevelLibs \
			libtag \
			libtag_c

	fixPkgconfig

	fixDevelopLibDirReferences $binDir/taglib-config
	sed -i -e "s,\/.*/include,$includeDir," $binDir/taglib-config

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