Files
haikuports/dev-python/cython/cython-3.0.10.recipe
2024-07-09 12:08:45 +02:00

107 lines
2.7 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="1"
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_PACKAGES=(python39 python310)
PYTHON_VERSIONS=(3.9 3.10)
defaultVersion=3.10 # And treat this one as the default.
for i in "${!PYTHON_PACKAGES[@]}"; do
pythonPackage=${PYTHON_PACKAGES[i]}
pythonVersion=${PYTHON_VERSIONS[$i]}
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 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"
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
}