opencv: Build Python bindings
This commit is contained in:
parent
99654b9cb4
commit
4beb926c63
@ -2,9 +2,13 @@ TERMUX_PKG_HOMEPAGE=https://opencv.org/
|
|||||||
TERMUX_PKG_DESCRIPTION="Open Source Computer Vision Library"
|
TERMUX_PKG_DESCRIPTION="Open Source Computer Vision Library"
|
||||||
TERMUX_PKG_LICENSE="Apache-2.0"
|
TERMUX_PKG_LICENSE="Apache-2.0"
|
||||||
TERMUX_PKG_MAINTAINER="@termux"
|
TERMUX_PKG_MAINTAINER="@termux"
|
||||||
TERMUX_PKG_VERSION=4.5.5
|
TERMUX_PKG_VERSION=(4.5.5)
|
||||||
TERMUX_PKG_SRCURL=https://github.com/opencv/opencv/archive/${TERMUX_PKG_VERSION}.tar.gz
|
TERMUX_PKG_VERSION+=(1.22.3) # NumPy version
|
||||||
TERMUX_PKG_SHA256=a1cfdcf6619387ca9e232687504da996aaa9f7b5689986b8331ec02cb61d28ad
|
TERMUX_PKG_REVISION=1
|
||||||
|
TERMUX_PKG_SRCURL=(https://github.com/opencv/opencv/archive/${TERMUX_PKG_VERSION}.tar.gz
|
||||||
|
https://github.com/numpy/numpy/archive/refs/tags/v${TERMUX_PKG_VERSION[1]}.tar.gz)
|
||||||
|
TERMUX_PKG_SHA256=(a1cfdcf6619387ca9e232687504da996aaa9f7b5689986b8331ec02cb61d28ad
|
||||||
|
c8f3ec591e3f17b939220f2b9eabb4c5e2db330f8af62c0a3aeee8a4d1a6c0db)
|
||||||
TERMUX_PKG_DEPENDS="libc++, libjpeg-turbo, libpng, libprotobuf, libtiff, libwebp, openjpeg, openjpeg-tools, zlib"
|
TERMUX_PKG_DEPENDS="libc++, libjpeg-turbo, libpng, libprotobuf, libtiff, libwebp, openjpeg, openjpeg-tools, zlib"
|
||||||
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
|
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
|
||||||
-DANDROID_NO_TERMUX=OFF
|
-DANDROID_NO_TERMUX=OFF
|
||||||
@ -13,6 +17,10 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
|
|||||||
-DPROTOBUF_UPDATE_FILES=ON
|
-DPROTOBUF_UPDATE_FILES=ON
|
||||||
"
|
"
|
||||||
|
|
||||||
|
termux_step_post_get_source() {
|
||||||
|
mv numpy-${TERMUX_PKG_VERSION[1]} numpy
|
||||||
|
}
|
||||||
|
|
||||||
termux_step_pre_configure() {
|
termux_step_pre_configure() {
|
||||||
termux_setup_protobuf
|
termux_setup_protobuf
|
||||||
|
|
||||||
@ -35,6 +43,27 @@ termux_step_pre_configure() {
|
|||||||
_NEED_DUMMY_LIBRT_A=true
|
_NEED_DUMMY_LIBRT_A=true
|
||||||
echo '!<arch>' > $_LIBRT_A
|
echo '!<arch>' > $_LIBRT_A
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# For Python bindings
|
||||||
|
_PYTHON_VERSION=$(. $TERMUX_SCRIPTDIR/packages/python/build.sh; echo $_MAJOR_VERSION)
|
||||||
|
termux_setup_python_crossenv
|
||||||
|
pushd $TERMUX_PYTHON_CROSSENV_SRCDIR
|
||||||
|
_CROSSENV_PREFIX=$TERMUX_PKG_BUILDDIR/python-crossenv-prefix
|
||||||
|
python${_PYTHON_VERSION} -m crossenv \
|
||||||
|
$TERMUX_PREFIX/bin/python${_PYTHON_VERSION} \
|
||||||
|
${_CROSSENV_PREFIX}
|
||||||
|
popd
|
||||||
|
. ${_CROSSENV_PREFIX}/bin/activate
|
||||||
|
LDFLAGS+=" -lpython${_PYTHON_VERSION}"
|
||||||
|
export NPY_DISABLE_SVML=1
|
||||||
|
pushd $TERMUX_PKG_SRCDIR/numpy
|
||||||
|
pip install .
|
||||||
|
popd
|
||||||
|
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+="
|
||||||
|
-DPYTHON_DEFAULT_EXECUTABLE=python
|
||||||
|
-DPYTHON3_INCLUDE_PATH=$TERMUX_PREFIX/include/python${_PYTHON_VERSION}
|
||||||
|
-DPYTHON3_NUMPY_INCLUDE_DIRS=${_CROSSENV_PREFIX}/cross/lib/python${_PYTHON_VERSION}/site-packages/numpy/core/include
|
||||||
|
"
|
||||||
}
|
}
|
||||||
|
|
||||||
termux_step_post_make_install() {
|
termux_step_post_make_install() {
|
||||||
|
8
packages/opencv/opencv-python.subpackage.sh
Normal file
8
packages/opencv/opencv-python.subpackage.sh
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
TERMUX_SUBPKG_INCLUDE="lib/python*"
|
||||||
|
TERMUX_SUBPKG_DESCRIPTION="Python bindings for OpenCV"
|
||||||
|
TERMUX_SUBPKG_DEPENDS="python"
|
||||||
|
|
||||||
|
termux_step_create_subpkg_debscripts() {
|
||||||
|
echo "#!$TERMUX_PREFIX/bin/sh" > postinst
|
||||||
|
echo "pip3 install numpy" >> postinst
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user