diff --git a/tur-pypi-312/python3.12-polars/build.sh b/tur-pypi-312/python3.12-polars/build.sh index aa79c43..21c03a6 100644 --- a/tur-pypi-312/python3.12-polars/build.sh +++ b/tur-pypi-312/python3.12-polars/build.sh @@ -2,9 +2,9 @@ TERMUX_PKG_HOMEPAGE=https://github.com/pola-rs/polars TERMUX_PKG_DESCRIPTION="Dataframes powered by a multithreaded, vectorized query engine, written in Rust" TERMUX_PKG_LICENSE="MIT" TERMUX_PKG_MAINTAINER="@termux-user-repository" -TERMUX_PKG_VERSION="1.18.0" +TERMUX_PKG_VERSION="1.19.0" TERMUX_PKG_SRCURL=https://github.com/pola-rs/polars/releases/download/py-$TERMUX_PKG_VERSION/polars-$TERMUX_PKG_VERSION.tar.gz -TERMUX_PKG_SHA256=5c2f119555ae8d822a5322509c6abd91601a8931115d2e4c3fff13fadf39e877 +TERMUX_PKG_SHA256=b52ada5c43fcdadf64f282522198c5549ee4e46ea57d236a4d7e572643070d9d TERMUX_PKG_AUTO_UPDATE=true TERMUX_PKG_DEPENDS="libc++, python" TERMUX_PKG_PYTHON_COMMON_DEPS="wheel" @@ -52,62 +52,38 @@ termux_step_pre_configure() { : "${CARGO_HOME:=$HOME/.cargo}" export CARGO_HOME - - rm -rf $CARGO_HOME/registry/src/*/cmake-* - rm -rf $CARGO_HOME/registry/src/*/jemalloc-sys-* - rm -rf $CARGO_HOME/registry/src/*/arboard-* cargo fetch --target "${CARGO_TARGET_NAME}" - local p="cmake-0.1.50-src-lib.rs.diff" - local d - for d in $CARGO_HOME/registry/src/*/cmake-*; do - patch --silent -p1 -d ${d} \ - < "$TERMUX_PKG_BUILDER_DIR/${p}" - done - - p="jemalloc-sys-0.5.4+5.3.0-patched-src-lib.rs.diff" - for d in $CARGO_HOME/registry/src/*/jemalloc-sys-*; do - patch --silent -p1 -d ${d} < "$TERMUX_PKG_BUILDER_DIR/${p}" - done - - p="arboard-dummy-platform.diff" - for d in $CARGO_HOME/registry/src/*/arboard-*; do - patch --silent -p1 -d ${d} < "$TERMUX_PKG_BUILDER_DIR/${p}" - done - - local _CARGO_TARGET_LIBDIR="target/${CARGO_TARGET_NAME}/release/deps" - mkdir -p $_CARGO_TARGET_LIBDIR - - mv $TERMUX_PREFIX/lib/libz.so.1{,.tmp} - mv $TERMUX_PREFIX/lib/libz.so{,.tmp} - - ln -sfT $(readlink -f $TERMUX_PREFIX/lib/libz.so.1.tmp) \ - $_CARGO_TARGET_LIBDIR/libz.so.1 - ln -sfT $(readlink -f $TERMUX_PREFIX/lib/libz.so.tmp) \ - $_CARGO_TARGET_LIBDIR/libz.so - - LDFLAGS+=" -Wl,--no-as-needed -lpython${TERMUX_PYTHON_VERSION}" - - # XXX: Don't know why, this is needed for `cmake` in rust to work properly - local _rtarget _renv - for _rtarget in {aarch64,i686,x86_64}-linux-android armv7-linux-androideabi; do - _renv="CFLAGS_${_rtarget//-/_}" - export $_renv+=" --target=${CCTERMUX_HOST_PLATFORM}" - done + # Dummy CMake toolchain file to workaround build error: + # CMake Error at /home/builder/.termux-build/_cache/cmake-3.30.3/share/cmake-3.30/Modules/Platform/Android-Determine.cmake:218 (message): + # Android: Neither the NDK or a standalone toolchain was found. + export TARGET_CMAKE_TOOLCHAIN_FILE="${TERMUX_PKG_BUILDDIR}/android.toolchain.cmake" + touch "${TERMUX_PKG_BUILDDIR}/android.toolchain.cmake" + + cargo vendor + patch --silent -p1 \ + -d ./vendor/arboard/ \ + < "$TERMUX_PKG_BUILDER_DIR"/arboard-dummy-platform.diff + patch --silent -p1 \ + -d ./vendor/jemalloc-sys/ \ + < "$TERMUX_PKG_BUILDER_DIR"/jemalloc-sys-0.5.4+5.3.0-patched-src-lib.rs.diff + + patch --silent -p1 \ + -d "$TERMUX_PKG_SRCDIR" \ + < "$TERMUX_PKG_BUILDER_DIR"/patch-root-Cargo.diff + + LDFLAGS+=" -Wl,--no-as-needed,-lpython${TERMUX_PYTHON_VERSION},--as-needed" } termux_step_make() { - : -} - -termux_step_make_install() { export CARGO_BUILD_TARGET=${CARGO_TARGET_NAME} export PYO3_CROSS_LIB_DIR=$TERMUX_PREFIX/lib export PYTHONPATH=$TERMUX_PREFIX/lib/python${TERMUX_PYTHON_VERSION}/site-packages - build-python -m maturin build --release --skip-auditwheel --target $CARGO_BUILD_TARGET - - pip install --no-deps ./target/wheels/*.whl --prefix $TERMUX_PREFIX + build-python -m maturin build \ + --target $CARGO_BUILD_TARGET \ + --release --skip-auditwheel \ + --interpreter python${TERMUX_PYTHON_VERSION} # Fix wheel name, although it it built with tag `cp38-abi3`, but it is linked against `python3.x.so` # so it will not work on other pythons. @@ -116,16 +92,18 @@ termux_step_make_install() { ./target/wheels/polars-$TERMUX_PKG_VERSION-cp$_pyver-cp$_pyver-linux_$TERMUX_ARCH.whl } -termux_step_post_make_install() { - mv $TERMUX_PREFIX/lib/libz.so.1{.tmp,} - mv $TERMUX_PREFIX/lib/libz.so{.tmp,} +termux_step_make_install() { + pip install --no-deps ./target/wheels/*.whl --prefix $TERMUX_PREFIX +} +termux_step_post_make_install() { + # This is not necessary, and may cause file conflict rm -f $PYTHONPATH/rust-toolchain.toml + + # Remove the vendor sources to save space + rm -rf "$TERMUX_PKG_SRCDIR"/vendor } termux_step_post_massage() { - rm -f lib/libz.so.1 - rm -f lib/libz.so - tur_build_wheel } diff --git a/tur-pypi-312/python3.12-polars/cmake-0.1.50-src-lib.rs.diff b/tur-pypi-312/python3.12-polars/cmake-0.1.50-src-lib.rs.diff deleted file mode 100644 index e622286..0000000 --- a/tur-pypi-312/python3.12-polars/cmake-0.1.50-src-lib.rs.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- a/src/lib.rs -+++ b/src/lib.rs -@@ -440,7 +440,7 @@ - - // Some decisions later on are made if CMAKE_TOOLCHAIN_FILE is defined, - // so we need to read it from the environment variables from the beginning. -- if !self.defined("CMAKE_TOOLCHAIN_FILE") { -+ if false { - if let Some(s) = self.getenv_target_os("CMAKE_TOOLCHAIN_FILE") { - self.define("CMAKE_TOOLCHAIN_FILE", s); - } else { diff --git a/tur-pypi-312/python3.12-polars/patch-root-Cargo.diff b/tur-pypi-312/python3.12-polars/patch-root-Cargo.diff new file mode 100644 index 0000000..8da12c7 --- /dev/null +++ b/tur-pypi-312/python3.12-polars/patch-root-Cargo.diff @@ -0,0 +1,11 @@ +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -134,6 +134,8 @@ + # simd-json = { git = "https://github.com/ritchie46/simd-json", branch = "alignment" } + pyo3 = { git = "https://github.com/bschoenmaeckers/pyo3.git", branch = "release-0.23" } + pyo3-ffi = { git = "https://github.com/bschoenmaeckers/pyo3.git", branch = "release-0.23" } ++arboard = { path = "./vendor/arboard" } ++jemalloc-sys = { path = "./vendor/jemalloc-sys" } + + [profile.mindebug-dev] + inherits = "dev"