SUMMARY="Seamless operability between C++11 and Python"
DESCRIPTION="pybind11 is a lightweight header-only library that exposes C++ \
types in Python and vice versa, mainly to create Python bindings of existing \
C++ code.
Its goals and syntax are similar to the excellent Boost.Python library by \
David Abrahams: to minimize boilerplate code in traditional extension modules \
by inferring type information using compile-time introspection."
HOMEPAGE="https://pypi.org/project/pybind11/"
COPYRIGHT="2015-2019 Wenzel Jakob"
LICENSE="BSD (2-clause)"
REVISION="1"
SOURCE_URI="https://github.com/pybind/pybind11/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="8ff2fff22df038f5cd02cea8af56622bc67f5b64534f1b83b9f133b8366acff2"
SOURCE_FILENAME="pybind11-v$portVersion.tar.gz"

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

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

PYTHON_PACKAGES=(python3 python38 python39)
PYTHON_VERSIONS=(3.7 3.8 3.9)
for i in "${!PYTHON_PACKAGES[@]}"; do
pythonPackage=${PYTHON_PACKAGES[i]}
pythonVersion=${PYTHON_VERSIONS[$i]}
eval "PROVIDES_${pythonPackage}=\"\
	${portName}_$pythonPackage = $portVersion\n\
	cmd:pybind11_config$pythonVersion\n\
	\"; \
REQUIRES_$pythonPackage=\"\
	haiku\n\
	cmd:python$pythonVersion\
	\""
BUILD_REQUIRES="$BUILD_REQUIRES
	haiku${secondaryArchSuffix}_devel
	setuptools_$pythonPackage
	devel:eigen$secondaryArchSuffix"
BUILD_PREREQUIRES="$BUILD_PREREQUIRES
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:make
	cmd:python$pythonVersion"
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
		mkdir -p $installLocation #$prefix/lib/cmake
		rm -rf build
		$python setup.py build install \
			--root=/ --prefix=$prefix
		mv $prefix/bin/pybind11-config $prefix/bin/pybind11-config$pythonVersion

#		Not sure we want to run cmake build
#		this will install the headers and cmake files double
#		cmake -B build $cmakeDirArgs \
#			-DCMAKE_BUILD_TYPE=None \
#			-DPYBIND11_PYTHON_VERSION=$pythonVersion \
#			-DPYBIND11_TEST=OFF \
#			-DUSE_PYTHON_INCLUDE_DIR=OFF
#		make -C build install

#		mv $dataDir/cmake/pybind11 $prefix/lib/cmake
#		rm -rf $dataDir

		packageEntries  $pythonPackage \
			$prefix/bin \
			$prefix/lib/python*
	done
}
