SUMMARY="A library for creating MusicBrainz and freedb disc IDs from audio CDs"
DESCRIPTION="libdiscid is a C library for creating MusicBrainz and freedb \
disc IDs from audio CDs. It reads a CD's table of contents (TOC) and \
generates an identifier which can be used to lookup the CD at MusicBrainz. \
Additionally, it provides a submission URL for adding the disc ID to the \
database and gathers ISRCs and the MCN (=UPC/EAN) from disc."
HOMEPAGE="https://musicbrainz.org/doc/libdiscid"
COPYRIGHT="2006-2017 MetaBrainz Foundation"
LICENSE="GNU LGPL v2.1"
REVISION="4"
SOURCE_URI="http://ftp.musicbrainz.org/pub/musicbrainz/libdiscid/libdiscid-$portVersion.tar.gz"
CHECKSUM_SHA256="f9e443ac4c0dd4819c2841fcc82169a46fb9a626352cdb9c7f65dd3624cd31b9"
PATCHES="libdiscid-$portVersion.patchset"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86"

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

PROVIDES="
	libdiscid$secondaryArchSuffix = $portVersion
	lib:libdiscid$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

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

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:automake
	cmd:autoreconf
	cmd:awk
	cmd:cmp
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	"

defineDebugInfoPackage libdiscid$secondaryArchSuffix \
	$libDir/libdiscid.so.$libVersion

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

INSTALL()
{
	make install
	install -d $docDir
	install -t $docDir AUTHORS README

	rm $libDir/libdiscid.la

	prepareInstalledDevelLib libdiscid
	fixPkgconfig

	packageEntries devel \
		$developDir
}

TEST()
{
	make check
}
