Files
termux-packages/packages/python-numpy/build.sh
termux-pacman-bot 9c67005bc6 bump(main/python-numpy): 2.1.1 and update revdeps
Update to numpy 2, and update reverse dependencies:

- matplotlib from 3.9.1 to 3.9.2
- python-contourpy from 1.2.1 to 1.3.0
- python-numpy from 1.26.5 to 2.1.1
- python-onnxruntime from 1.19.0 to 1.19.2
- python-scipy from 1.14.0 to 1.14.1
- python-torch from 2.1.2 to 2.4.1
- python-torchaudio from 2.0.1 to 2.4.1
- python-torchvision from 0.15.1 to `0.19.1
- Revbump: python-pyarrow, inkscape and opencv

Some of these packages does not currently build before this PR. Getting these updated and buildable is a nice step to prepare for [python 3.12](https://github.com/termux/termux-packages/pull/18078).

Fixes #21059, #21110, #21194 and #21284.

Co-authored-by: Chongyun Lee <45286352+licy183@users.noreply.github.com>
2024-10-04 19:08:43 +00:00

77 lines
2.4 KiB
Bash

TERMUX_PKG_HOMEPAGE=https://numpy.org/
TERMUX_PKG_DESCRIPTION="The fundamental package for scientific computing with Python"
TERMUX_PKG_LICENSE="BSD 3-Clause"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION="2.1.1"
TERMUX_PKG_SRCURL=git+https://github.com/numpy/numpy
TERMUX_PKG_DEPENDS="libc++, libopenblas, python"
TERMUX_PKG_AUTO_UPDATE=true
TERMUX_PKG_UPDATE_TAG_TYPE="latest-release-tag"
TERMUX_PKG_PYTHON_COMMON_DEPS="wheel, 'Cython>=0.29.34,<3.1', 'meson-python>=0.15.0,<0.16.0', build"
TERMUX_MESON_WHEEL_CROSSFILE="$TERMUX_PKG_TMPDIR/wheel-cross-file.txt"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
--cross-file $TERMUX_MESON_WHEEL_CROSSFILE
"
TERMUX_PKG_RM_AFTER_INSTALL="
bin/
"
termux_step_pre_configure() {
if $TERMUX_ON_DEVICE_BUILD; then
termux_error_exit "Package '$TERMUX_PKG_NAME' is not available for on-device builds."
fi
LDFLAGS+=" -lm"
}
termux_step_configure() {
termux_setup_meson
cp -f $TERMUX_MESON_CROSSFILE $TERMUX_MESON_WHEEL_CROSSFILE
sed -i 's|^\(\[binaries\]\)$|\1\npython = '\'$(command -v python)\''|g' \
$TERMUX_MESON_WHEEL_CROSSFILE
sed -i 's|^\(\[properties\]\)$|\1\nnumpy-include-dir = '\'$PYTHON_SITE_PKG/numpy/_core/include\''|g' \
$TERMUX_MESON_WHEEL_CROSSFILE
local _longdouble_format=""
if [ $TERMUX_ARCH_BITS = 32 ]; then
_longdouble_format="IEEE_DOUBLE_LE"
else
_longdouble_format="IEEE_QUAD_LE"
fi
sed -i 's|^\(\[properties\]\)$|\1\nlongdouble_format = '\'$_longdouble_format\''|g' \
$TERMUX_MESON_WHEEL_CROSSFILE
local _meson_buildtype="minsize"
local _meson_stripflag="--strip"
if [ "$TERMUX_DEBUG_BUILD" = "true" ]; then
_meson_buildtype="debug"
_meson_stripflag=
fi
local _custom_meson="build-python $TERMUX_PKG_SRCDIR/vendored-meson/meson/meson.py"
CC=gcc CXX=g++ CFLAGS= CXXFLAGS= CPPFLAGS= LDFLAGS= $_custom_meson \
$TERMUX_PKG_SRCDIR \
$TERMUX_PKG_BUILDDIR \
--cross-file $TERMUX_MESON_CROSSFILE \
--prefix $TERMUX_PREFIX \
--libdir lib \
--buildtype ${_meson_buildtype} \
${_meson_stripflag} \
$TERMUX_PKG_EXTRA_CONFIGURE_ARGS
}
termux_step_make() {
pushd $TERMUX_PKG_SRCDIR
python -m build -w -n -x --config-setting builddir=$TERMUX_PKG_BUILDDIR .
popd
}
termux_step_make_install() {
local _pyv="${TERMUX_PYTHON_VERSION/./}"
local _whl="numpy-$TERMUX_PKG_VERSION-cp$_pyv-cp$_pyv-linux_$TERMUX_ARCH.whl"
pip install --no-deps --prefix=$TERMUX_PREFIX --force-reinstall $TERMUX_PKG_SRCDIR/dist/$_whl
}