1SUMMARY="Python bindings for the Haiku API"
2DESCRIPTION="This lets you build apps for Haiku using the Haiku API directly \
3from Python. \
4\
5For the most part, Haiku-PyAPI tries to copy the C++ API. There are some \
6places where we have had to deviate from the C++ API, however. \
7\
8Currently the library is unstable and has plenty of bugs."
9HOMEPAGE="https://github.com/coolcoder613eb/Haiku-PyAPI/"
10COPYRIGHT="2023-2024 Elozor Bruce
11	2023-2024 Zardshard
12	2023-2024 TmTFx
13	2023 OscarL"
14LICENSE="MIT"
15REVISION="1"
16SOURCE_URI="https://github.com/coolcoder613eb/Haiku-PyAPI/archive/refs/tags/v$portVersion.tar.gz"
17CHECKSUM_SHA256="a534151ba988a406da5e278db5af127fca257c6b260374be054a385335b779d2"
18SOURCE_DIR="Haiku-PyAPI-$portVersion"
19
20
21ARCHITECTURES="all !x86_gcc2"
22SECONDARY_ARCHITECTURES="x86"
23
24PROVIDES="
25	$portName = $portVersion
26	"
27REQUIRES="
28	haiku$secondaryArchSuffix
29	"
30BUILD_REQUIRES="
31	haiku${secondaryArchSuffix}_devel
32	"
33BUILD_PREREQUIRES="
34	cmd:gcc$secondaryArchSuffix
35	cmd:jam
36	"
37
38PYTHON_VERSIONS=(3.9 3.10)
39
40for i in "${!PYTHON_VERSIONS[@]}"; do
41	pythonVersion=${PYTHON_VERSIONS[$i]}
42	pythonPackage=python${pythonVersion//.}
43
44	eval "PROVIDES_${pythonPackage}=\"
45		${portName}_$pythonPackage = $portVersion
46		\""
47	if [ "$targetArchitecture" = x86_gcc2 ]; then
48		eval "PROVIDES_$pythonPackage+=\"
49			haiku_pyapi_$pythonPackage = $portVersion
50			\""
51	fi
52
53	eval "REQUIRES_$pythonPackage=\"
54		haiku$secondaryArchSuffix
55		cmd:python$pythonVersion
56		\""
57	BUILD_REQUIRES+="
58		pybind11${secondaryArchSuffix}_$pythonPackage
59		"
60	BUILD_PREREQUIRES+="
61		cmd:python$pythonVersion
62		"
63done
64
65
66INSTALL()
67{
68	for i in "${!PYTHON_VERSIONS[@]}"; do
69		pythonVersion=${PYTHON_VERSIONS[$i]}
70		pythonPackage=python${pythonVersion//.}
71
72		installLocation=$prefix/lib/python$pythonVersion/vendor-packages
73
74		jam -q $jobArgs -spython_version="$pythonVersion" \
75			-sinstall_location="$installLocation" install
76
77		packageEntries $pythonPackage \
78			$prefix/lib/python*
79	done
80}
81