SUMMARY="Platform support library used by libCEC and binary add-ons for Kodi"
DESCRIPTION="This library provides platform specific support for other libraries"
HOMEPAGE="http://libcec.pulse-eight.com/"
COPYRIGHT="2011-2015 Pulse-Eight Limited"
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="https://github.com/Pulse-Eight/platform/archive/p8-platform-$portVersion.tar.gz"
CHECKSUM_SHA256="064f8d2c358895c7e0bea9ae956f8d46f3f057772cb97f2743a11d478a0f68a0"
SOURCE_DIR="platform-p8-platform-$portVersion"
PATCHES="libp8_platform-$portVersion.patchset"

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

libVersionCompat="2.1.0 compat >= 2"

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

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

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

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

INSTALL()
{
	cd build
	make install

	prepareInstalledDevelLib libp8-platform
	fixPkgconfig
	packageEntries devel $developDir
}
