SUMMARY="Library to handle the BD+ protection scheme on Blu-ray discs"
DESCRIPTION="This library is written for the purpose of playing Blu-ray \
movies. It is intended for software that want to support Blu-ray playback \
(such as VLC and MPlayer)."
HOMEPAGE="https://www.videolan.org/developers/libbdplus.html"
COPYRIGHT="2011-2015 VideoLAN"
LICENSE="GNU LGPL v2.1"
REVISION="5"
SOURCE_URI="https://download.videolan.org/pub/videolan/libbdplus/$portVersion/libbdplus-$portVersion.tar.bz2"
CHECKSUM_SHA256="a631cae3cd34bf054db040b64edbfc8430936e762eb433b1789358ac3d3dc80a"
PATCHES="libbdplus-0.1.2.patchset"

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

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

PROVIDES="
	libbdplus$secondaryArchSuffix = $portVersionCompat
	lib:libbdplus$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libgcrypt$secondaryArchSuffix
	lib:libgpg_error$secondaryArchSuffix
	"

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

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libgcrypt$secondaryArchSuffix
	devel:libgpg_error$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage libbdplus$secondaryArchSuffix \
	"$libDir"/libbdplus.so.$libVersion

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

INSTALL()
{
	make install

	rm $libDir/libbdplus.la

	prepareInstalledDevelLibs libbdplus
	fixPkgconfig

	# devel package
	packageEntries devel \
		$developDir
}
