SUMMARY="Id3 library for C/C++"
DESCRIPTION="id3lib is a software library for reading, writing, \
and manipulating ID3v2 tags. Additionally it is possible to get \
some basic mp3 header information like bitrate etc."
HOMEPAGE="https://sourceforge.net/projects/id3lib/"
COPYRIGHT="2000-2004 Underbit Technologies, Inc."
LICENSE="GNU LGPL v2.1"
REVISION="1"
SOURCE_URI="https://sourceforge.net/projects/id3lib/files/id3lib/$portVersion/id3lib-$portVersion.tar.gz"
CHECKSUM_SHA256="2749cc3c0cd7280b299518b1ddf5a5bcfe2d1100614519b68702230e26c7d079"
PATCHES="id3lib-$portVersion.patchset"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

PROVIDES="
	id3lib$secondaryArchSuffix = $portVersion
	lib:libid3$secondaryArchSuffix = 3.0.0 compat >= 0
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	id3lib${secondaryArchSuffix}_devel = $portVersion
	devel:libid3$secondaryArchSuffix = 3.0.0 compat >= 0
	"
REQUIRES_devel="
	$portName == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libiconv$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	"

PATCH()
{
	sed -i "s/iomanip.h/iomanip/" configure.in
	sed -i "s/iomanip.h/iomanip/" configure
}

BUILD()
{
	libtoolize -fci
	aclocal --force --install -I acinclude
	autoconf
	./configure --prefix=$prefix \
		--bindir=$binDir \
		--sbindir=$binDir \
		--libdir=$libDir \
		--includedir=$includeDir \
		--datadir=$dataDir \
		--mandir=$manDir \
		--disable-dependency-tracking
	make
}

INSTALL()
{
	make install

	rm $libDir/libid3.la

	prepareInstalledDevelLib libid3
	fixPkgconfig

	packageEntries devel \
		$developDir
}

TEST()
{
	make check
}
