Files
haikuports/dev-python/numpy/numpy-1.26.0.recipe
2025-01-07 17:46:35 +01:00

145 lines
3.9 KiB
Bash

SUMMARY="Array processing for numbers, strings, records, and objects"
DESCRIPTION="NumPy is a general-purpose array-processing package designed to \
efficiently manipulate large multi-dimensional arrays of arbitrary records \
without sacrificing too much speed for small multi-dimensional arrays.
NumPy is built on the Numeric code base and adds features introduced by \
numarray as well as an extended C-API and the ability to create arrays of \
arbitrary type which also makes NumPy suitable for interfacing with \
general-purpose data-base applications."
HOMEPAGE="https://www.numpy.org/"
COPYRIGHT="2005-2021 Travis E. Oliphant et al."
LICENSE="BSD (3-clause)"
REVISION="2"
SOURCE_URI="https://github.com/numpy/numpy/releases/download/v$portVersion/numpy-$portVersion.tar.gz"
CHECKSUM_SHA256="f93fc78fe8bf15afe2b8d6b6499f1c73953169fad1e9a8dd086cdff3190e7fdf"
SOURCE_DIR="numpy-$portVersion"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
$portName = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libblis$secondaryArchSuffix
lib:libexecinfo$secondaryArchSuffix
lib:liblapack$secondaryArchSuffix
lib:libopenblas$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libblis$secondaryArchSuffix
devel:libexecinfo$secondaryArchSuffix
devel:liblapack$secondaryArchSuffix
devel:libopenblas$secondaryArchSuffix
"
PYTHON_VERSIONS=(3.10)
defaultVersion=3.10
for i in "${!PYTHON_VERSIONS[@]}"; do
pythonVersion=${PYTHON_VERSIONS[$i]}
pythonPackage=python${pythonVersion//.}
eval "PROVIDES_${pythonPackage}=\"
${portName}_$pythonPackage = $portVersion
cmd:f2py_$pythonVersion
\""
if [ $targetArchitecture = "x86_gcc2" ]; then
eval "PROVIDES_${pythonPackage}+=\"
numpy_$pythonPackage = $portVersion
\""
fi
# Provide f2py/f2py3 only for the default version
if [ $pythonVersion = $defaultVersion ]; then
eval "PROVIDES_${pythonPackage}+=\"
cmd:f2py
cmd:f2py${pythonVersion%.*}
\""
fi
eval "REQUIRES_$pythonPackage=\"
haiku$secondaryArchSuffix
numpy$secondaryArchSuffix
cmd:cython$pythonVersion
cmd:python$pythonVersion
\""
BUILD_REQUIRES+="
pyproject_metadata_$pythonPackage
setuptools_$pythonPackage
tomli_$pythonPackage # for Pythonn < 3.11 only.
"
BUILD_PREREQUIRES+="
cmd:cython$pythonVersion
cmd:gcc$secondaryArchSuffix
cmd:gfortran$secondaryArchSuffix
cmd:python$pythonVersion
"
done
INSTALL()
{
# Check at every update in site.cfg.example!
cat > site.cfg << EOF
[ALL]
libraries = execinfo,lapack,openblas
library_dirs = /system/$relativeDevelopLibDir
include_dirs = /system/$relativeIncludeDir
runtime_library_dirs = /system/$relativeLibDir
[openblas]
libraries = openblas
library_dirs = /system/$relativeDevelopLibDir
include_dirs = /system/$relativeIncludeDir
runtime_library_dirs = /system/$relativeLibDir
[blis]
libraries = blis
library_dirs = /system/$relativeDevelopLibDir
include_dirs = /system/$relativeIncludeDir/blis
runtime_library_dirs = /system/$relativeLibDir
EOF
rm -rf doc/sphinxext/.git
for i in "${!PYTHON_VERSIONS[@]}"; do
pythonVersion=${PYTHON_VERSIONS[$i]}
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 the scripts, and provide suffixless versions for the default one.
mv $prefix/bin/f2py $prefix/bin/f2py-$pythonVersion
if [ $pythonVersion = $defaultVersion ]; then
ln -sr $prefix/bin/f2py-$pythonVersion $prefix/bin/f2py
ln -sr $prefix/bin/f2py-$pythonVersion $prefix/bin/f2py3
fi
packageEntries $pythonPackage \
$prefix/lib/python* \
$prefix/bin
done
}
TEST()
{
for i in "${!PYTHON_VERSIONS[@]}"; do
pythonVersion=${PYTHON_VERSIONS[$i]}
pythonPackage=python${pythonVersion//.}
python=python$pythonVersion
$python runtests.py
done
}