SUMMARY="TabLib Audio Meta-Data Library"
DESCRIPTION="
TagLib is a library for reading and editing the meta-data of several popular \
audio formats. Currently it supports both ID3v1 and ID3v2 for MP3 files, Ogg \
Vorbis comments and ID3 tags and Vorbis comments in FLAC, MPC, Speex, WavPack \
TrueAudio, WAV, AIFF, MP4 and ASF files."
HOMEPAGE="https://github.com/taglib"
COPYRIGHT="2002-2012 Scott Wheeler"
LICENSE="GNU LGPL v2
	MPL v1.1"
REVISION="3"
SOURCE_URI="http://taglib.github.io/releases/taglib-1.7.2.tar.gz"
CHECKSUM_SHA256="38f7e5283b594021b28426a61339cffbf2d503b450338b02f651fab1b0b42899"
PATCHES="taglib-$portVersion.patchset"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

PROVIDES="
	taglib$secondaryArchSuffix = $portVersion
	lib:libtag$secondaryArchSuffix = 1.7.2 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.7
	cmd:taglib_config$secondaryArchSuffix = $portVersion compat >= 1.7
	devel:libtag$secondaryArchSuffix = 1.7.2 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=$binDir \
			-DLIB_INSTALL_DIR=$developLibDir \
			-DLIB_SUFFIX="/${secondaryArchSuffix/_/}"
	make $jobArgs
}

INSTALL()
{
	make install

	mkdir -p $developDir/headers
	mv $prefix/include/taglib $developDir/headers
	rm -rf $prefix/include

	prepareInstalledDevelLibs \
			libtag \
			libtag_c

	fixPkgconfig

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

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