Files
haikuports/dev-python/cython/cython-3.0.10.recipe
Oscar Lesta 6e70a085c1 cython: drop Python 3.9 support.
All current on-tree users already target 3.10 only.
2025-09-19 22:53:14 -03:00

105 lines
2.6 KiB
Bash

SUMMARY="Optimising static compiler for Python"
DESCRIPTION="Cython is an optimising static compiler for both the Python \
programming language and the extended Cython programming language (based on \
Pyrex). It makes writing C extensions for Python as easy as Python itself."
HOMEPAGE="https://cython.org/"
COPYRIGHT="2007-2023 Stefan Behnel, Robert Bradshaw, et al."
LICENSE="Apache v2"
REVISION="2"
SOURCE_URI="https://github.com/cython/cython/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="00f97476cef9fcd9a89f9d2a49be3b518e1a74b91f377fe08c97fcb44bc0f7d7"
SOURCE_FILENAME="cython-$portVersion.tar.gz"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
$portName = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
"
PYTHON_VERSIONS=(3.10)
defaultVersion=3.10 # And treat this one as the default.
for pythonVersion in ${PYTHON_VERSIONS[@]}; do
pythonPackage=python${pythonVersion//.}
eval "PROVIDES_$pythonPackage=\"
${portName}_$pythonPackage = $portVersion
cmd:cygdb$pythonVersion
cmd:cython$pythonVersion
cmd:cythonize$pythonVersion
\""
eval "REQUIRES_$pythonPackage=\"
haiku
cmd:python$pythonVersion
\""
if [ "$targetArchitecture" = x86_gcc2 ]; then
eval "PROVIDES_${pythonPackage}+=\"
cython_$pythonPackage = $portVersion
\""
fi
# Provide non version-suffixed cmds for the default Python version
if [ $pythonVersion = $defaultVersion ]; then
eval "PROVIDES_${pythonPackage}+=\"
cmd:cygdb = $portVersion
cmd:cython = $portVersion
cmd:cythonize = $portVersion
\""
fi
BUILD_REQUIRES+="
setuptools_$pythonPackage
"
BUILD_PREREQUIRES+="
cmd:gcc$secondaryArchSuffix
cmd:make
cmd:python$pythonVersion
"
done
INSTALL()
{
for pythonVersion in ${PYTHON_VERSIONS[@]}; do
pythonPackage=python${pythonVersion//.}
python=python$pythonVersion
installLocation="$prefix"/lib/$python/vendor-packages/
export PYTHONPATH=$installLocation:$PYTHONPATH
mkdir -p "$installLocation"
rm -rf build
$python setup.py build install \
--root=/ --prefix="$prefix"
# Version suffix all the scripts
for file in cygdb cython cythonize; do
mv "$prefix"/bin/$file "$prefix"/bin/${file}$pythonVersion
done
# And provide suffix-less symlinks for the default version
if [ $pythonVersion = $defaultVersion ]; then
for command in $prefix/bin/*; do
ln -sr $command ${command%$pythonVersion}
done
fi
install -m 755 -d "$docDir"
install -m 644 -t "$docDir" README.rst
packageEntries $pythonPackage \
"$prefix"/lib/$python \
"$prefix"/bin \
"$docDir"
done
}