Files
haikuports/dev-python/haiku-pyapi/haiku_pyapi-0.4.recipe
2026-01-20 17:29:01 +01:00

86 lines
2.2 KiB
Bash

SUMMARY="Python bindings for the Haiku API"
DESCRIPTION="This lets you build apps for Haiku using the Haiku API directly from Python.
Haiku-PyAPI follows the C++ API as closely as possible. We also provide \
variants of some of the functions that are more natural to use in Python.
Currently the library is unstable and has plenty of bugs."
HOMEPAGE="https://github.com/coolcoder613eb/Haiku-PyAPI/"
COPYRIGHT="2023-2025 Elozor Bruce
2023-2026 Zardshard
2023-2026 TmTFx
2023 OscarL"
LICENSE="MIT"
REVISION="3"
SOURCE_URI="https://github.com/coolcoder613eb/Haiku-PyAPI/archive/refs/tags/v$portVersion.tar.gz"
CHECKSUM_SHA256="fa1fd07a26a13057757de29d26d862b36a8da756983240b1f9b492fa35983590"
SOURCE_DIR="Haiku-PyAPI-$portVersion"
# Haiku-PyAPI needs smart_holder support from pybind11
pybindVersion="3.0.1"
SOURCE_URI_2="https://github.com/pybind/pybind11/archive/refs/tags/v$pybindVersion.tar.gz"
CHECKSUM_SHA256_2="741633da746b7c738bb71f1854f957b9da660bcd2dce68d71949037f0969d0ca"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
$portName = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
"
BUILD_PREREQUIRES="
cmd:gcc$secondaryArchSuffix
cmd:jam
"
PYTHON_VERSIONS=(3.10)
for i in "${!PYTHON_VERSIONS[@]}"; do
pythonVersion=${PYTHON_VERSIONS[$i]}
pythonPackage=python${pythonVersion//.}
eval "PROVIDES_${pythonPackage}=\"
${portName}_$pythonPackage = $portVersion
\""
if [ "$targetArchitecture" = x86_gcc2 ]; then
eval "PROVIDES_$pythonPackage+=\"
haiku_pyapi_$pythonPackage = $portVersion
\""
fi
eval "REQUIRES_$pythonPackage=\"
haiku$secondaryArchSuffix
cmd:python$pythonVersion
\""
BUILD_PREREQUIRES+="
cmd:python$pythonVersion
"
done
BUILD()
{
cp -rd $sourceDir2/pybind11-$pybindVersion/* \
./pybind11/
}
INSTALL()
{
for i in "${!PYTHON_VERSIONS[@]}"; do
pythonVersion=${PYTHON_VERSIONS[$i]}
pythonPackage=python${pythonVersion//.}
installLocation=$prefix/lib/python$pythonVersion/vendor-packages
jam -q $jobArgs -spython_version="$pythonVersion" \
-sinstall_location="$installLocation" install
packageEntries $pythonPackage \
$prefix/lib/python*
done
}