python-numpy: Use pip install

This commit is contained in:
Tee KOBAYASHI 2022-10-28 00:28:29 +09:00 committed by xtkoba
parent d5e2aeab8d
commit 9389668df1
1 changed files with 4 additions and 53 deletions

View File

@ -3,6 +3,7 @@ TERMUX_PKG_DESCRIPTION="The fundamental package for scientific computing with Py
TERMUX_PKG_LICENSE="BSD 3-Clause"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION="1.23.4"
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://github.com/numpy/numpy.git
TERMUX_PKG_DEPENDS="libc++, libopenblas, python"
TERMUX_PKG_BUILD_IN_SRC=true
@ -29,62 +30,12 @@ termux_step_configure() {
popd
. ${_CROSSENV_PREFIX}/bin/activate
LDFLAGS+=" -lpython${_PYTHON_VERSION}"
}
LDFLAGS+=" -lpython${_PYTHON_VERSION} -lm"
termux_step_make() {
build-pip install pybind11 Cython pythran wheel
DEVICE_STIE=$TERMUX_PREFIX/lib/python${_PYTHON_VERSION}/site-packages
MATHLIB="m" python setup.py install --force
}
termux_step_make_install() {
export PYTHONPATH="$DEVICE_STIE"
MATHLIB="m" python setup.py install --force --prefix $TERMUX_PREFIX
pushd $DEVICE_STIE
_NUMPY_EGGDIR=
for f in numpy-${TERMUX_PKG_VERSION}-py${_PYTHON_VERSION}-linux-*.egg; do
if [ -d "$f" ]; then
_NUMPY_EGGDIR="$f"
break
fi
done
test -n "${_NUMPY_EGGDIR}"
# XXX: Fix the EXT_SUFFIX. More investigation is needed to find the underlying cause.
pushd "${_NUMPY_EGGDIR}"
local old_suffix=".cpython-310-$TERMUX_HOST_PLATFORM.so"
local new_suffix=".cpython-310.so"
find . \
-name '*'"$old_suffix" \
-exec sh -c '_f="{}"; mv -- "$_f" "${_f%'"$old_suffix"'}'"$new_suffix"'"' \;
popd
popd
}
termux_step_post_make_install() {
# Delete the easy-install related files, since we use postinst/prerm to handle it.
pushd $TERMUX_PREFIX
rm -rf lib/python${_PYTHON_VERSION}/site-packages/__pycache__
rm -rf lib/python${_PYTHON_VERSION}/site-packages/easy-install.pth
rm -rf lib/python${_PYTHON_VERSION}/site-packages/site.py
popd
}
termux_step_create_debscripts() {
cat <<- EOF > ./postinst
#!$TERMUX_PREFIX/bin/sh
echo "Installing numpy..."
echo "./${_NUMPY_EGGDIR}" >> $TERMUX_PREFIX/lib/python${_PYTHON_VERSION}/site-packages/easy-install.pth
EOF
cat <<- EOF > ./prerm
#!$TERMUX_PREFIX/bin/sh
echo "Removing numpy..."
find $TERMUX_PREFIX/lib/python${_PYTHON_VERSION}/site-packages/$_NUMPY_EGGDIR | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf
sed -i "/\.\/${_NUMPY_EGGDIR//./\\.}/d" $TERMUX_PREFIX/lib/python${_PYTHON_VERSION}/site-packages/easy-install.pth
EOF
export PYTHONPATH=$TERMUX_PREFIX/lib/python${_PYTHON_VERSION}/site-packages
MATHLIB="m" pip install --no-deps . --prefix $TERMUX_PREFIX
}