SUMMARY="An X Color Management library"
DESCRIPTION="libXcm is a reference implementation of the X Color Management \
specification. This specification allows to attach colour regions to X windows \
to communicate with colour servers."
HOMEPAGE="http://www.oyranos.org/libxcm/"
COPYRIGHT="2008 Tomas Carnecky
	2008-2010 Kai-Uwe Behrmann"
LICENSE="MIT"
REVISION="2"
SOURCE_URI="https://github.com/oyranos-cms/libxcm/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="7d97f168be4f87a5118417d7be764e35a1eb94eac5020003c005f3a97a521cc1"
SOURCE_FILENAME="libxcm-$portVersion.tar.gz"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86"

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

PROVIDES="
	libxcm$secondaryArchSuffix = $portVersionCompat
	lib:libXcm$secondaryArchSuffix = libVersionCompat
	lib:libXcmDDC$secondaryArchSuffix = libVersionCompat
	lib:libXcmEDID$secondaryArchSuffix = libVersionCompat
	lib:libXcmX11$secondaryArchSuffix = libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libX11$secondaryArchSuffix
	lib:libXfixes$secondaryArchSuffix
	lib:libXmu$secondaryArchSuffix
	lib:libXt$secondaryArchSuffix
	"

PROVIDES_devel="
	libxcm${secondaryArchSuffix}_devel = $portVersionCompat
	devel:libXcm$secondaryArchSuffix = $libVersionCompat
	devel:libXcmDDC$secondaryArchSuffix = $libVersionCompat
	devel:libXcmEDID$secondaryArchSuffix = $libVersionCompat
	devel:libXcmX11$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	libxcm$secondaryArchSuffix == $portVersion base
	devel:libX11$secondaryArchSuffix
	devel:libXcmX11$secondaryArchSuffix
	devel:libXcmEDID$secondaryArchSuffix
	devel:xproto
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libX11$secondaryArchSuffix
	devel:libXfixes$secondaryArchSuffix
	devel:libXmu$secondaryArchSuffix
	devel:libXt$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage libxcm$secondaryArchSuffix \
	$libDir/libXcm.so.$libVersion \
	$libDir/libXcmDDC.so.$libVersion \
	$libDir/libXcmEDID.so.$libVersion \
	$libDir/libXcmX11.so.$libVersion

BUILD()
{
	autoreconf -vfi
	runConfigure --omit-dirs docDir ./configure --docdir=$developDocDir
	make $jobArgs
}

INSTALL()
{
	make install

	if [ -z "$secondaryArchSuffix" ]; then
		maybe_manDir="$manDir"
	else
		rm -rf "$manDir"
		rm -rf "$developDir/documentation"
		maybe_manDir=
	fi

	rm -f "$libDir"/libXcm*.la

	prepareInstalledDevelLibs libXcm libXcmDDC libXcmEDID libXcmX11
	fixPkgconfig

	mkdir -p "$dataDir"/cmake
	mv "$libDir"/cmake "$dataDir"/cmake/Modules

	# devel package
	packageEntries devel \
		"$dataDir"/cmake \
		"$developDir" \
		${maybe_manDir:+"$maybe_manDir"}
}
