SUMMARY="Alternative to vendor specific OpenCL ICD loaders"
DESCRIPTION="OpenCL implementations are provided as ICD (Installable Client \
Driver). An OpenCL program can use several ICD thanks to the use of an ICD \
Loader as provided by this project. This free ICD Loader can load any (free \
or non free) ICD."
HOMEPAGE="https://forge.imag.fr/projects/ocl-icd/"
COPYRIGHT="2012-2015 Brice Videau
	2012-2015 Vincent Danjean"
LICENSE="BSD (2-clause)"
REVISION="1"
SOURCE_URI="https://forge.imag.fr/frs/download.php/836/ocl-icd-$portVersion.tar.gz"
CHECKSUM_SHA256="7665f368354e3d2b7787ba4a23c6f061db1181195ba1914dd1cdcd462eca4df4"
SOURCE_DIR="ocl-icd-$portVersion"

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

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

PROVIDES="
	ocl_icd$secondaryArchSuffix = $portVersion
	lib:libopencl$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

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

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:awk
	cmd:diff
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:ruby
	"

TEST_REQUIRES="
 	cmd:find
 	"

defineDebugInfoPackage ocl_icd$secondaryArchSuffix \
	"$libDir"/libOpenCL.so.$libVersion

BUILD()
{
	runConfigure ./configure

	make $jobArgs
}

INSTALL()
{
	make install

	# Cleanup
	mkdir -p $developDocDir
	mv $docDir/* $developDocDir
	rmdir $docDir

	# prepare develop/lib
	prepareInstalledDevelLibs libOpenCL
	fixPkgconfig

	# devel package
	packageEntries devel \
		"$developDir"
}

TEST()
{
	make check
}
