SUMMARY="The original dbus implementation for Python"
DESCRIPTION="dbus-python is the original Python binding \
for dbus, the reference implementation of the D-Bus protocol."
HOMEPAGE="https://www.freedesktop.org/wiki/Software/DBusBindings/"
COPYRIGHT="2002-2010 Red Hat Inc.
	2003 David Zeuthen
	2002-2003 CodeFactory AB
	2003 James Willcox
	2004 Rob Taylor
	2004 Anders Carlsson
	2005 Colin Walters
	2006 Steve Frécinaux
	2009-2011 Nokia Corporation
	2010-2012 Mike Gorse
	2016 Simon McVittie
	2005-2019 Collabora Ltd."
LICENSE="MIT
	AFL v2.1
	GNU GPL v2"
REVISION="2"
SOURCE_URI="https://dbus.freedesktop.org/releases/dbus-python/dbus-python-$portVersion.tar.gz"
CHECKSUM_SHA256="b10206ba3dd641e4e46411ab91471c88e0eec1749860e4285193ee68df84ac31"
SOURCE_DIR="dbus-python-$portVersion"

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

PROVIDES="
	dbuspython$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libdbus_1$secondaryArchSuffix
	devel:libglib_2.0$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoreconf
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

PYTHON_PACKAGES=(python38)
PYTHON_VERSIONS=(3.8)
for i in "${!PYTHON_PACKAGES[@]}"; do
pythonPackage=${PYTHON_PACKAGES[i]}
pythonVersion=${PYTHON_VERSIONS[$i]}
eval "PROVIDES_${pythonPackage}=\"\
	${portName}_$pythonPackage = $portVersion\
	\"; \
REQUIRES_$pythonPackage=\"\
	haiku$secondaryArchSuffix\n\
	${portName} == $portVersion base\n\
	lib:libdbus_1$secondaryArchSuffix\n\
	lib:libglib_2.0$secondaryArchSuffix\n\
	cmd:python$pythonVersion\
	\""
BUILD_PREREQUIRES="$BUILD_PREREQUIRES
	cmd:python$pythonVersion"
done

BUILD()
{
	autoreconf -vfi

	for i in "${!PYTHON_PACKAGES[@]}"; do
		pythonPackage=${PYTHON_PACKAGES[i]}
		pythonVersion=${PYTHON_VERSIONS[$i]}
		python=python$pythonVersion

		cd "$sourceDir"
		mkdir build-$pythonPackage

		cd ./build-$pythonPackage

		runConfigure ../configure PYTHON_VERSION=$pythonVersion
		make "$jobArgs"
	done
}

INSTALL()
{
	for i in "${!PYTHON_PACKAGES[@]}"; do
		pythonPackage=${PYTHON_PACKAGES[i]}
		pythonVersion=${PYTHON_VERSIONS[$i]}
		python=python$pythonVersion
		installLocation=$prefix/lib/$python/vendor-packages/
		export PYTHONPATH=$installLocation:$PYTHONPATH

		make -C build-$pythonPackage install \
			pythondir=$installLocation \
			pyexecdir=$installLocation

		rm $installLocation/*.la

		packageEntries $pythonPackage \
			$prefix/lib/python*

	done
	fixPkgconfig
}
