Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxython committed Sep 28, 2024
1 parent 97d0505 commit d3594e3
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 54 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ jobs:
fetch-depth: 1000

- name: Set up QEMU
uses: docker/[email protected]
run: |
sudo apt update
yes | sudo apt install qemu-user qemu-user-static binfmt-support
sudo update-binfmts --enable qemu-aarch64
sudo update-binfmts --enable qemu-arm
docker run --rm --privileged tonistiigi/binfmt --install all
- name: Get files from termux-packages repository
run: ./get-build-package.sh
Expand Down
2 changes: 1 addition & 1 deletion get-build-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Script that installs build-package.sh to compile glibc packages

BRANCH="master"
BRANCH="termux_step_get_dependencies_python.sh"

git clone --depth 1 -b ${BRANCH} --single-branch https://github.com/termux/termux-packages.git

Expand Down
1 change: 1 addition & 0 deletions gpkg/gobject-introspection/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ TERMUX_PKG_SRCURL=https://download.gnome.org/sources/gobject-introspection/${TER
TERMUX_PKG_SHA256=a1df7c424e15bda1ab639c00e9051b9adf5cea1a9e512f8a603b53cd199bc6d8
TERMUX_PKG_DEPENDS="libgirepository-glibc, python-glibc"
TERMUX_PKG_BUILD_DEPENDS="coreutils-glibc"
TERMUX_PKG_PYTHON_COMMON_DEPS="setuptools"
TERMUX_PKG_MESON_NATIVE=true
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
-Dpython=$TERMUX_PREFIX/bin/python3
Expand Down
87 changes: 48 additions & 39 deletions gpkg/llvm/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,47 +25,56 @@ termux_step_post_get_source() {
done
}

termux_step_configure() {
termux_setup_cmake
termux_setup_ninja

CFLAGS=${CFLAGS/-g /-g1 }
CXXFLAGS=${CXXFLAGS/-g /-g1 }

local LLVM_TARGET_ARCH="X86"
if [ $TERMUX_ARCH = "arm" ]; then
LLVM_TARGET_ARCH="ARM"
elif [ $TERMUX_ARCH = "aarch64" ]; then
LLVM_TARGET_ARCH="AArch64"
fi
#termux_step_configure() {
# termux_setup_cmake
# termux_setup_ninja
#
# CFLAGS=${CFLAGS/-g /-g1 }
# CXXFLAGS=${CXXFLAGS/-g /-g1 }
#
# local LLVM_TARGET_ARCH="X86"
# if [ $TERMUX_ARCH = "arm" ]; then
# LLVM_TARGET_ARCH="ARM"
# elif [ $TERMUX_ARCH = "aarch64" ]; then
# LLVM_TARGET_ARCH="AArch64"
# fi
#
# cmake ${TERMUX_PKG_SRCDIR} \
# -G Ninja \
# -DCMAKE_BUILD_TYPE=Release \
# -DCMAKE_FIND_ROOT_PATH=$TERMUX_PREFIX \
# -DCMAKE_INSTALL_DOCDIR=share/doc \
# -DCMAKE_INSTALL_PREFIX=$TERMUX_PREFIX \
# -DCMAKE_SKIP_RPATH=ON \
# -DLLVM_BINUTILS_INCDIR=$TERMUX_PREFIX/include \
# -DLLVM_BUILD_DOCS=ON \
# -DLLVM_BUILD_LLVM_DYLIB=ON \
# -DLLVM_BUILD_TESTS=ON \
# -DLLVM_ENABLE_BINDINGS=OFF \
# -DLLVM_ENABLE_FFI=ON \
# -DLLVM_ENABLE_RTTI=ON \
# -DLLVM_ENABLE_SPHINX=ON \
# -DCMAKE_SYSTEM_NAME=Linux \
# -DLLVM_HOST_TRIPLE=$TERMUX_HOST_PLATFORM \
# -DCMAKE_LIBRARY_ARCHITECTURE=$TERMUX_HOST_PLATFORM \
# -DCMAKE_SYSTEM_PROCESSOR=$LLVM_TARGET_ARCH \
# -DCMAKE_C_COMPILER=$CC \
# -DCMAKE_CXX_COMPILER=$CXX \
# -DLLVM_INCLUDE_BENCHMARKS=OFF \
# -DLLVM_INSTALL_UTILS=ON \
# -DLLVM_LINK_LLVM_DYLIB=ON \
# -DLLVM_USE_PERF=ON \
# -DSPHINX_WARNINGS_AS_ERRORS=OFF
#}

cmake ${TERMUX_PKG_SRCDIR} \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_FIND_ROOT_PATH=$TERMUX_PREFIX \
-DCMAKE_INSTALL_DOCDIR=share/doc \
-DCMAKE_INSTALL_PREFIX=$TERMUX_PREFIX \
-DCMAKE_SKIP_RPATH=ON \
-DLLVM_BINUTILS_INCDIR=$TERMUX_PREFIX/include \
-DLLVM_BUILD_DOCS=ON \
-DLLVM_BUILD_LLVM_DYLIB=ON \
-DLLVM_BUILD_TESTS=ON \
-DLLVM_ENABLE_BINDINGS=OFF \
-DLLVM_ENABLE_FFI=ON \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_ENABLE_SPHINX=ON \
-DCMAKE_SYSTEM_NAME=Linux \
-DLLVM_HOST_TRIPLE=$TERMUX_HOST_PLATFORM \
-DCMAKE_LIBRARY_ARCHITECTURE=$TERMUX_HOST_PLATFORM \
-DCMAKE_SYSTEM_PROCESSOR=$LLVM_TARGET_ARCH \
-DCMAKE_C_COMPILER=$CC \
-DCMAKE_CXX_COMPILER=$CXX \
-DLLVM_INCLUDE_BENCHMARKS=OFF \
-DLLVM_INSTALL_UTILS=ON \
-DLLVM_LINK_LLVM_DYLIB=ON \
-DLLVM_USE_PERF=ON \
-DSPHINX_WARNINGS_AS_ERRORS=OFF
# =TEST=
termux_step_configure() {
echo "TESTING"
}
termux_step_make() {
echo "TESTING"
}
# ======

termux_step_post_make_install() {
(
Expand Down
17 changes: 4 additions & 13 deletions gpkg/python/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ TERMUX_PKG_LICENSE="custom"
TERMUX_PKG_LICENSE_FILE="LICENSE"
TERMUX_PKG_MAINTAINER="@termux-pacman"
TERMUX_PKG_VERSION=3.12.6
TERMUX_PKG_REVISION=1
_MAJOR_VERSION="${TERMUX_PKG_VERSION%.*}"
_SETUPTOOLS_VERSION=69.5.1
TERMUX_PKG_SRCURL=(https://www.python.org/ftp/python/${TERMUX_PKG_VERSION%rc*}/Python-${TERMUX_PKG_VERSION}.tar.xz
Expand All @@ -13,6 +14,7 @@ TERMUX_PKG_SHA256=(1999658298cf2fb837dffed8ff3c033ef0c98ef20cf73c5d5f66bed5ab896
TERMUX_PKG_DEPENDS="libbz2-glibc, libexpat-glibc, gdbm-glibc, libffi-glibc, libnsl-glibc, libxcrypt-glibc, openssl-glibc, zlib-glibc"
TERMUX_PKG_BUILD_DEPENDS="sqlite-glibc, mpdecimal-glibc, llvm-glibc"
TERMUX_PKG_PROVIDES="python3-glibc"
TERMUX_PKG_RM_AFTER_INSTALL="glibc/lib/python${_MAJOR_VERSION}/site-packages/*/"
TERMUX_PKG_BUILD_IN_SRC=true

termux_step_pre_configure() {
Expand Down Expand Up @@ -62,25 +64,14 @@ termux_step_make_install() {
}

termux_step_post_make_install() {
echo README.txt > ${TERMUX_PKG_SRCDIR}/setuptools-files
(
export TERMUX_PKG_SETUP_PYTHON=true
export TERMUX_SKIP_DEPCHECK=true
export SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES=0
termux_step_get_dependencies_python

cd ${TERMUX_PKG_SRCDIR}/setuptools-${_SETUPTOOLS_VERSION}
pip install --no-deps . --prefix $TERMUX_PREFIX

pip show -f setuptools | grep "^ " | sed 's/ //' \
| awk -F '/' '{printf $1 "\n"}' | uniq >> ${TERMUX_PKG_SRCDIR}/setuptools-files
pip install --no-deps . --target ${TERMUX_PKG_SRCDIR}/setuptools
cp -r ${TERMUX_PKG_SRCDIR}/setuptools/setuptools/_distutils ${TERMUX_PYTHON_HOME}/distutils
)
}

termux_step_post_massage() {
for i in glibc/lib/python${_MAJOR_VERSION}/site-packages/*; do
if ! grep -q "^${i##*/}$" ${TERMUX_PKG_SRCDIR}/setuptools-files; then
rm -fr $i
fi
done
}
55 changes: 55 additions & 0 deletions gpkg/python/initconfig.c.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
--- Python-3.12.6/Python/initconfig.c 2024-09-06 22:03:47.000000000 +0300
+++ Python-3.12.6/Python/initconfig.c.patch 2024-09-28 15:11:27.913324313 +0300
@@ -1454,11 +1454,40 @@
#endif
}

-
#define CONFIG_GET_ENV_DUP(CONFIG, DEST, WNAME, NAME) \
config_get_env_dup(CONFIG, DEST, WNAME, NAME, "cannot decode " NAME)


+static PyStatus
+config_get_env_dup_with_analog(PyConfig *config,
+ wchar_t **dest,
+ char *name1, char *name2,
+ const char *decode_err_msg)
+{
+ assert(*dest == NULL);
+ assert(config->use_environment >= 0);
+
+ if (!config->use_environment) {
+ *dest = NULL;
+ return _PyStatus_OK();
+ }
+
+ const char *var = getenv(name1);
+ if (!var)
+ var = getenv(name2);
+
+ if (!var || var[0] == '\0') {
+ *dest = NULL;
+ return _PyStatus_OK();
+ }
+
+ return config_set_bytes_string(config, dest, var, decode_err_msg);
+}
+
+#define CONFIG_GET_ENV_DUP2(CONFIG, DEST, NAME1, NAME2) \
+ config_get_env_dup_with_analog(CONFIG, DEST, NAME1, NAME2, "cannot decode " NAME2)
+
+
static void
config_get_global_vars(PyConfig *config)
{
@@ -1668,8 +1697,8 @@
}

if (config->pythonpath_env == NULL) {
- status = CONFIG_GET_ENV_DUP(config, &config->pythonpath_env,
- L"PYTHONPATH", "PYTHONPATH");
+ status = CONFIG_GET_ENV_DUP2(config, &config->pythonpath_env,
+ "PYTHONPATH_MAINHOST", "PYTHONPATH");
if (_PyStatus_EXCEPTION(status)) {
return status;
}

0 comments on commit d3594e3

Please sign in to comment.