SUMMARY="X C-language Bindings protocol headers"
DESCRIPTION="
The X C-language Bindings protocol headers.
"
HOMEPAGE="http://xcb.freedesktop.org/" 
SOURCE_URI="http://xcb.freedesktop.org/dist/xcb-proto-1.6.tar.gz"
CHECKSUM_SHA256="2c64602868f69409d9e14f43a17eb2faf7c1c48654e0eff6b6978034f304724d"
REVISION="2"
COPYRIGHT="2001-2006 Bart Massey, Jamey Sharp, and Josh Triplett."
LICENSE="MIT (no promotion)"

ARCHITECTURES="x86_gcc2 x86 x86_64"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

PROVIDES="
	xcb_proto$secondaryArchSuffix = $portVersion
	devel:xcb_proto$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:util_macros$secondaryArchSuffix
	"

BUILD_PREREQUIRES="
	cmd:autoconf
	cmd:libtool
	cmd:aclocal
	cmd:make
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:pkg_config$secondaryArchSuffix
	cmd:python$secondaryArchSuffix
	"

SOURCE_DIR="xcb-proto-$portVersion"

BUILD()
{
	libtoolize --force --copy --install
	autoreconf -i
	runConfigure ./configure
	# force python dirs as the autodected one is the non-packaged one.
	export PATH="$portPackageLinksDir/cmd~python/bin:$PATH"
	pythonVersion=$(python --version 2>&1 | sed 's/Python //' | head -c3)
	export pyexecdir=$prefix/lib/python$pythonVersion/vendor-packages
	export pythondir=$prefix/lib/python$pythonVersion/vendor-packages
	make pyexecdir=$pyexecdir pythondir=$pythondir
}

INSTALL()
{
	# force python dirs as the autodected one is the non-packaged one.
	export PATH="$portPackageLinksDir/cmd~python/bin:$PATH"
	pythonVersion=$(python --version 2>&1 | sed 's/Python //' | head -c3)
	export pyexecdir=$prefix/lib/python$pythonVersion/vendor-packages
	export pythondir=$prefix/lib/python$pythonVersion/vendor-packages
	# the .pc file doesn't get it anyway, force it
	sed -i "s,pythondir=.*/site-packages,pythondir=\${prefix}/lib/python$pythonVersion/vendor-packages," \
		xcb-proto.pc
	make install DESTDIR=/ pyexecdir=$pyexecdir pythondir=$pythondir
	fixPkgconfig
}
