SUMMARY="Library for handling cover art for audio files"
DESCRIPTION="
Development library geared towards developers who wish to add cover art \
capabilites to their applications."
HOMEPAGE="http://musicbrainz.org/doc/libcoverart"
COPYRIGHT="2012 Andrew Hawkins"
LICENSE="GNU LGPL v2.1"
REVISION="1"
srcGitRev="fe08928991c9a1aba86fdafc9057658b549dc2fb"
SOURCE_URI="https://github.com/metabrainz/libcoverart/archive/$srcGitRev.zip"
CHECKSUM_SHA256="1c72c7ae8a910632e501a29ce03ce58d688d2bf0148a6cdb385fd13086592623"
SOURCE_FILENAME="libcoverart-$srcGitRev.zip"
SOURCE_DIR="libcoverart-$srcGitRev"
PATCHES="libcoverart-$portVersion.patchset"

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

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

PROVIDES="
	libcoverart$secondaryArchSuffix = $portVersion
	lib:libcoverart$secondaryArchSuffix = $libVersionCompat
	lib:libcoverartcc$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libjansson$secondaryArchSuffix
	lib:libneon$secondaryArchSuffix
	lib:libxml2$secondaryArchSuffix
	"

PROVIDES_devel="
	libcoverart${secondaryArchSuffix}_devel = $portVersion
	devel:libcoverart$secondaryArchSuffix = $libVersionCompat
	devel:libcoverartcc$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	libcoverart$secondaryArchSuffix == $portVersion base
	devel:libjansson$secondaryArchSuffix
	devel:libneon$secondaryArchSuffix
	devel:libxml2$secondaryArchSuffix
	"

BUILD_REQUIRES="
	devel:libjansson$secondaryArchSuffix
	devel:libneon$secondaryArchSuffix
	devel:libxml2$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	haiku${secondaryArchSuffix}_devel
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage libcoverart$secondaryArchSuffix \
	"$libDir"/libcoverart.so.$libVersion \
	"$libDir"/libcoverartcc.so.$libVersion

BUILD()
{
	mkdir -p build && cd build
	cmake .. -DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=$prefix \
		-DCMAKE_INSTALL_BINDIR=$binDir \
		-DCMAKE_INSTALL_LIBDIR=$libDir \
		-DCMAKE_INSTALL_INCLUDEDIR=$includeDir -L
	make $jobArgs
}

INSTALL()
{
	cd build
	make install

	prepareInstalledDevelLibs libcoverart libcoverartcc
	fixPkgconfig

	packageEntries devel \
			$developDir
}

TEST()
{
	cd build/tests
	./ctest
	./cctest
}
