new package: pypy
This commit is contained in:
parent
dcf3a11758
commit
2894168dfa
7
packages/pypy/aarch64-cc.sh
Normal file
7
packages/pypy/aarch64-cc.sh
Normal file
@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
if [ "$1" != "-cc1" ]; then
|
||||
/host-rootfs/$TERMUX_STANDALONE_TOOLCHAIN/bin/clang --target=aarch64-linux-android24 "$@"
|
||||
else
|
||||
# Target is already an argument.
|
||||
/host-rootfs/$TERMUX_STANDALONE_TOOLCHAIN/bin/clang "$@"
|
||||
fi
|
79
packages/pypy/added.patch
Normal file
79
packages/pypy/added.patch
Normal file
@ -0,0 +1,79 @@
|
||||
diff -U 1 -Nr pypy2.7-v7.3.6-src/lib_pypy/_resource_build.py pypy2.7-v7.3.6-src.mod/lib_pypy/_resource_build.py
|
||||
--- pypy2.7-v7.3.6-src/lib_pypy/_resource_build.py 2021-10-03 14:36:11.000000000 +0800
|
||||
+++ pypy2.7-v7.3.6-src.mod/lib_pypy/_resource_build.py 2022-03-04 20:24:57.662406300 +0800
|
||||
@@ -75,2 +75,4 @@
|
||||
|
||||
+/* Termux addition: Add wait3() declaration used by busybox. Available in libc for 32-bit only. */
|
||||
+static pid_t wait3(int* status, int options, struct rusage* rusage) { return wait4(-1, status, options, rusage); }
|
||||
""".replace('$RLIMIT_CONSTS', ''.join(rlimit_consts)))
|
||||
|
||||
diff -uNr pypy2.7-v7.3.6-src/lib_pypy/_sysconfigdata.py pypy2.7-v7.3.6-src.mod/lib_pypy/_sysconfigdata.py
|
||||
--- pypy2.7-v7.3.6-src/lib_pypy/_sysconfigdata.py 2021-10-03 14:36:11.000000000 +0800
|
||||
+++ pypy2.7-v7.3.6-src.mod/lib_pypy/_sysconfigdata.py 2022-02-08 17:34:58.141093600 +0800
|
||||
@@ -3,3 +3,7 @@
|
||||
build_time_vars = {
|
||||
"SO": [s[0] for s in imp.get_suffixes() if s[2] == imp.C_EXTENSION][0]
|
||||
}
|
||||
+
|
||||
+# Termux Fix: Add ANDROID_API_LEVEL
|
||||
+build_time_vars["ANDROID_API_LEVEL"] = 24
|
||||
+
|
||||
|
||||
|
||||
|
||||
diff -uNr pypy2.7-v7.3.6-src/rpython/rlib/rsocket.py pypy2.7-v7.3.6-src.mod/rpython/rlib/rsocket.py
|
||||
--- pypy2.7-v7.3.6-src/rpython/rlib/rsocket.py 2021-10-03 14:36:11.000000000 +0800
|
||||
+++ pypy2.7-v7.3.6-src.mod/rpython/rlib/rsocket.py 2022-01-17 22:54:28.191684700 +0800
|
||||
@@ -1627,11 +1627,48 @@
|
||||
raise RSocketError("port/proto not found")
|
||||
return rffi.charp2str(servent.c_s_name)
|
||||
|
||||
+PROTOCOL_NAME_AND_NUMBER = {
|
||||
+ "ip": 0,
|
||||
+ "icmp": 1,
|
||||
+ "igmp": 2,
|
||||
+ "ggp": 3,
|
||||
+ "ipencap": 4,
|
||||
+ "st": 5,
|
||||
+ "tcp": 6,
|
||||
+ "egp": 8,
|
||||
+ "pup": 12,
|
||||
+ "udp": 17,
|
||||
+ "hmp": 20,
|
||||
+ "xns-idp": 22,
|
||||
+ "iso-tp4": 29,
|
||||
+ "xtp": 36,
|
||||
+ "ddp": 37,
|
||||
+ "idpr-cmtp": 38,
|
||||
+ "ipv6": 41,
|
||||
+ "ipv6-route": 43,
|
||||
+ "ipv6-frag": 44,
|
||||
+ "idrp": 45,
|
||||
+ "rsvp": 46,
|
||||
+ "gre": 47,
|
||||
+ "esp": 50,
|
||||
+ "ah": 51,
|
||||
+ "skip": 57,
|
||||
+ "ipv6-icmp": 58,
|
||||
+ "ipv6-nonxt": 59,
|
||||
+ "ipv6-opts": 60,
|
||||
+ "rspf": 73,
|
||||
+ "vmtp": 81,
|
||||
+ "ospf": 89,
|
||||
+ "ipip": 94,
|
||||
+ "encap": 98,
|
||||
+ "pim": 103,
|
||||
+ "raw": 255
|
||||
+}
|
||||
+
|
||||
def getprotobyname(name):
|
||||
- protoent = _c.getprotobyname(name)
|
||||
- if not protoent:
|
||||
+ proto = PROTOCOL_NAME_AND_NUMBER.get(name, -1)
|
||||
+ if proto == -1:
|
||||
raise RSocketError("protocol not found")
|
||||
- proto = protoent.c_p_proto
|
||||
return rffi.cast(lltype.Signed, proto)
|
||||
|
||||
def getnameinfo(address, flags):
|
||||
|
7
packages/pypy/arm-cc.sh
Normal file
7
packages/pypy/arm-cc.sh
Normal file
@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
if [ "$1" != "-cc1" ]; then
|
||||
/host-rootfs/$TERMUX_STANDALONE_TOOLCHAIN/bin/clang --target=armv7a-linux-androideabi24 "$@"
|
||||
else
|
||||
# Target is already an argument.
|
||||
/host-rootfs/$TERMUX_STANDALONE_TOOLCHAIN/bin/clang "$@"
|
||||
fi
|
277
packages/pypy/build.sh
Normal file
277
packages/pypy/build.sh
Normal file
@ -0,0 +1,277 @@
|
||||
TERMUX_PKG_HOMEPAGE=https://pypy.org
|
||||
TERMUX_PKG_DESCRIPTION="A fast, compliant alternative implementation of Python"
|
||||
TERMUX_PKG_LICENSE="MIT"
|
||||
TERMUX_PKG_MAINTAINER="@licy183"
|
||||
_MAJOR_VERSION=2.7
|
||||
TERMUX_PKG_VERSION=7.3.8
|
||||
TERMUX_PKG_SRCURL=https://downloads.python.org/pypy/pypy$_MAJOR_VERSION-v$TERMUX_PKG_VERSION-src.tar.bz2
|
||||
TERMUX_PKG_SHA256=0cdad270c62d3ccc53cc87eeb069a6dc46acaf95521b584624bcd6697d94fa1c
|
||||
TERMUX_PKG_DEPENDS="gdbm, libandroid-posix-semaphore, libandroid-support, libbz2, libcrypt, libexpat, libffi, liblzma, libsqlite, libxml2, ncurses, ncurses-ui-libs, openssl, readline, zlib"
|
||||
TERMUX_PKG_BUILD_DEPENDS="binutils, clang, dash, make, ndk-multilib, pkg-config, python2, tk, xorgproto"
|
||||
TERMUX_PKG_RECOMMENDS="clang, make, pkg-config"
|
||||
TERMUX_PKG_SUGGESTS="pypy-tkinter"
|
||||
TERMUX_PKG_BUILD_IN_SRC=true
|
||||
# `termux-docker` doesn't provide the docker image of arm architecture.
|
||||
# See https://github.com/termux/termux-docker#known-issues
|
||||
TERMUX_PKG_BLACKLISTED_ARCHES="arm"
|
||||
TERMUX_PKG_RM_AFTER_INSTALL="
|
||||
opt/pypy/lib-python/${_MAJOR_VERSION}/test
|
||||
opt/pypy/lib-python/${_MAJOR_VERSION}/*/test
|
||||
opt/pypy/lib-python/${_MAJOR_VERSION}/*/tests
|
||||
"
|
||||
|
||||
_docker_pull_url=https://raw.githubusercontent.com/NotGlop/docker-drag/5413165a2453aa0bc275d7dc14aeb64e814d5cc0/docker_pull.py
|
||||
_docker_pull_checksums=04e52b70c862884e75874b2fd229083fdf09a4bac35fc16fd7a0874ba20bd075
|
||||
_undocker_url=https://raw.githubusercontent.com/larsks/undocker/649f3fdeb0a9cf8aa794d90d6cc6a7c7698a25e6/undocker.py
|
||||
_undocker_checksums=32bc122c53153abeb27491e6d45122eb8cef4f047522835bedf9b4b87877a907
|
||||
_proot_url=https://github.com/proot-me/proot/releases/download/v5.3.0/proot-v5.3.0-x86_64-static
|
||||
_proot_checksums=d1eb20cb201e6df08d707023efb000623ff7c10d6574839d7bb42d0adba6b4da
|
||||
|
||||
# Skip due to we use proot to get dependencies
|
||||
termux_step_get_dependencies() {
|
||||
echo "Skip due to we use proot to get dependencies"
|
||||
}
|
||||
|
||||
termux_step_override_config_scripts() {
|
||||
:
|
||||
}
|
||||
|
||||
termux_step_pre_configure() {
|
||||
if $TERMUX_ON_DEVICE_BUILD; then
|
||||
termux_error_exit "Package '$TERMUX_PKG_NAME' is not safe for on-device builds."
|
||||
fi
|
||||
|
||||
DOCKER_PULL="python $TERMUX_PKG_CACHEDIR/docker_pull.py"
|
||||
UNDOCKER="python $TERMUX_PKG_CACHEDIR/undocker.py"
|
||||
PROOT="$TERMUX_PKG_CACHEDIR/proot"
|
||||
|
||||
# Get docker_pull.py
|
||||
termux_download \
|
||||
$_docker_pull_url \
|
||||
$TERMUX_PKG_CACHEDIR/docker_pull.py \
|
||||
$_docker_pull_checksums
|
||||
|
||||
# Get undocker.py
|
||||
termux_download \
|
||||
$_undocker_url \
|
||||
$TERMUX_PKG_CACHEDIR/undocker.py \
|
||||
$_undocker_checksums
|
||||
|
||||
# Get proot
|
||||
termux_download \
|
||||
$_proot_url \
|
||||
$PROOT \
|
||||
$_proot_checksums
|
||||
|
||||
chmod +x $PROOT
|
||||
|
||||
# Pick up host platform arch.
|
||||
HOST_ARCH=$TERMUX_ARCH
|
||||
if [ $TERMUX_ARCH = "arm" ]; then
|
||||
HOST_ARCH="i686"
|
||||
elif [ $TERMUX_ARCH = "aarch64" ]; then
|
||||
HOST_ARCH="x86_64"
|
||||
fi
|
||||
|
||||
# Get host platform rootfs tar if needed.
|
||||
if [ ! -f "$TERMUX_PKG_CACHEDIR/kcubeterm_termux_$HOST_ARCH.tar" ]; then
|
||||
(
|
||||
cd $TERMUX_PKG_CACHEDIR
|
||||
$DOCKER_PULL kcubeterm/termux:$HOST_ARCH
|
||||
mv kcubeterm_termux.tar kcubeterm_termux_$HOST_ARCH.tar
|
||||
)
|
||||
fi
|
||||
|
||||
# Get target platform rootfs tar if needed.
|
||||
if [ $HOST_ARCH != $TERMUX_ARCH ]; then
|
||||
# Check qemu version, must greater than 6.0.0, since qemu 4/5 cannot run python
|
||||
# inside the termux rootfs and will cause a segmentation fault.
|
||||
QEMU_VERSION=$(qemu-$TERMUX_ARCH-static --version | grep "version" | sed -E "s/.*?version (.*?)/\1/g")
|
||||
QEMU_MAJOR_VERSION=${QEMU_VERSION%%.*}
|
||||
if [ $QEMU_MAJOR_VERSION -lt '6' ]; then
|
||||
termux_error_exit "qemu-user-static's version must be greater than 6.0.0"
|
||||
fi
|
||||
if [ ! -f "$TERMUX_PKG_CACHEDIR/kcubeterm_termux_$TERMUX_ARCH.tar" ]; then
|
||||
(
|
||||
cd $TERMUX_PKG_CACHEDIR
|
||||
$DOCKER_PULL kcubeterm/termux:$TERMUX_ARCH
|
||||
mv kcubeterm_termux.tar kcubeterm_termux_$TERMUX_ARCH.tar
|
||||
)
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
termux_step_configure() {
|
||||
PYPY_USESSION_DIR=$TERMUX_ANDROID_HOME/tmp
|
||||
PYPY_SRC_DIR=$TERMUX_ANDROID_HOME/src
|
||||
|
||||
# Bootstrap a proot rootfs for the host platform
|
||||
HOST_ROOTFS_BASE=$TERMUX_PKG_TMPDIR/host-rootfs
|
||||
cat "$TERMUX_PKG_CACHEDIR/kcubeterm_termux_$HOST_ARCH.tar" | $UNDOCKER -o $HOST_ROOTFS_BASE
|
||||
|
||||
# Add build dependicies for pypy on the host platform rootfs
|
||||
# Build essential
|
||||
BUILD_DEP="binutils binutils-gold clang file patch pkg-config "
|
||||
# Build dependencies for pypy
|
||||
BUILD_DEP+=${TERMUX_PKG_DEPENDS//,/}
|
||||
BUILD_DEP+=" "
|
||||
BUILD_DEP+=${TERMUX_PKG_BUILD_DEPENDS//,/}
|
||||
|
||||
# Environment variables for termux
|
||||
TERMUX_RUNTIME_ENV_VARS="ANDROID_DATA=/data
|
||||
ANDROID_ROOT=/system
|
||||
HOME=$TERMUX_ANDROID_HOME
|
||||
LANG=en_US.UTF-8
|
||||
PATH=$TERMUX_PREFIX/bin:/usr/bin
|
||||
PREFIX=$TERMUX_PREFIX
|
||||
TMPDIR=$TERMUX_PREFIX/tmp
|
||||
TZ=UTC"
|
||||
ln -s $HOST_ROOTFS_BASE/$TERMUX_ANDROID_HOME/ $TERMUX_ANDROID_HOME
|
||||
ln -s $TERMUX_PKG_SRCDIR $PYPY_SRC_DIR
|
||||
PROOT_HOST="env -i PROOT_NO_SECCOMP=1
|
||||
$TERMUX_RUNTIME_ENV_VARS
|
||||
$PROOT
|
||||
-b /proc -b /dev -b /sys
|
||||
-b $HOME
|
||||
-b $TERMUX_ANDROID_HOME
|
||||
-w $TERMUX_ANDROID_HOME
|
||||
-r $HOST_ROOTFS_BASE/"
|
||||
# Get dependencies
|
||||
$PROOT_HOST update-static-dns
|
||||
$PROOT_HOST apt autoremove --purge -yq science-repo game-repo || :
|
||||
sed -i "s/deb/deb [trusted=yes]/g" $HOST_ROOTFS_BASE/$TERMUX_PREFIX/etc/apt/sources.list
|
||||
sed -i "s/packages.termux.org/packages-cf.termux.org/g" $HOST_ROOTFS_BASE/$TERMUX_PREFIX/etc/apt/sources.list
|
||||
$PROOT_HOST apt update
|
||||
$PROOT_HOST apt install -o Dpkg::Options::=--force-confnew -yq $BUILD_DEP
|
||||
$PROOT_HOST python2 -m pip install cffi pycparser
|
||||
|
||||
# Copy the statically-built proot
|
||||
cp $PROOT $HOST_ROOTFS_BASE/$TERMUX_PREFIX/bin/
|
||||
|
||||
# Extract the target platform rootfs to the host platform rootfs if needed.
|
||||
PROOT_TARGET="$PROOT_HOST"
|
||||
TARGET_ROOTFS_BASE=""
|
||||
if [ $HOST_ARCH != $TERMUX_ARCH ]; then
|
||||
cp /usr/bin/qemu-$TERMUX_ARCH-static $HOST_ROOTFS_BASE/$TERMUX_PREFIX/bin/
|
||||
TARGET_ROOTFS_BASE=$TERMUX_ANDROID_HOME/target-rootfs
|
||||
mkdir -p $HOST_ROOTFS_BASE/$TARGET_ROOTFS_BASE
|
||||
cat "$TERMUX_PKG_CACHEDIR/kcubeterm_termux_$TERMUX_ARCH.tar" | $UNDOCKER -o $HOST_ROOTFS_BASE/$TARGET_ROOTFS_BASE
|
||||
PROOT_TARGET="env -i PROOT_NO_SECCOMP=1
|
||||
$TERMUX_RUNTIME_ENV_VARS
|
||||
$PROOT
|
||||
-q qemu-$TERMUX_ARCH-static
|
||||
-b $HOME
|
||||
-b $TERMUX_ANDROID_HOME
|
||||
-b /proc -b /dev -b /sys
|
||||
-w $TERMUX_ANDROID_HOME
|
||||
-r $TARGET_ROOTFS_BASE"
|
||||
# Check if it can be run with or without $PROOT_HOST
|
||||
$PROOT_HOST $PROOT_TARGET uname -a
|
||||
$PROOT_TARGET uname -a
|
||||
# update-static-dns will use the arm busybox binary.
|
||||
${PROOT_TARGET/qemu-$TERMUX_ARCH-static/qemu-arm-static} update-static-dns
|
||||
$PROOT_TARGET apt autoremove --purge -yq science-repo game-repo || :
|
||||
# FIXME: If we don't add `[trusted=yes]`, apt-key will generate an error.
|
||||
# FIXME: The key(s) in the keyring XXX.gpg are ignored as the file is not readable by user '' executing apt-key.
|
||||
# FIXME: I have no idea why this error occurs in github action, neither
|
||||
# FIXME: can I reproduce it in my local docker container.
|
||||
sed -i "s/deb/deb [trusted=yes]/g" $HOST_ROOTFS_BASE/$TARGET_ROOTFS_BASE/$TERMUX_PREFIX/etc/apt/sources.list
|
||||
sed -i "s/packages.termux.org/packages-cf.termux.org/g" $HOST_ROOTFS_BASE/$TARGET_ROOTFS_BASE/$TERMUX_PREFIX/etc/apt/sources.list
|
||||
$PROOT_TARGET apt update
|
||||
$PROOT_TARGET apt install -o Dpkg::Options::=--force-confnew -yq dash
|
||||
# Use dash to provide /system/bin/sh, since /system/bin/sh is a symbolic link
|
||||
# to /system/bin/busybox which is a 32-bit binary. If we are using an aarch64
|
||||
# qemu, proot cannot execute it.
|
||||
rm -f $HOST_ROOTFS_BASE/$TARGET_ROOTFS_BASE/system/bin/sh
|
||||
$PROOT_TARGET ln -sf $TERMUX_PREFIX/bin/dash /system/bin/sh
|
||||
# Get dependencies
|
||||
$PROOT_TARGET apt install -o Dpkg::Options::=--force-confnew -yq $BUILD_DEP
|
||||
# Use the target rootfs providing $TERMUX_PREFIX
|
||||
mv $TERMUX_PREFIX $TERMUX_PREFIX.backup
|
||||
ln -s $HOST_ROOTFS_BASE/$TARGET_ROOTFS_BASE/$TERMUX_PREFIX $TERMUX_PREFIX
|
||||
# FIXME: Use the host cross compiler to provide $TERMUX_PREFIX/bin/cc
|
||||
# FIXME: because clang under qemu sometimes hangs.
|
||||
rm -f $HOST_ROOTFS_BASE/$TARGET_ROOTFS_BASE/$TERMUX_PREFIX/bin/cc
|
||||
$PROOT_TARGET cp $TERMUX_PKG_BUILDER_DIR/$TERMUX_ARCH-cc.sh $HOST_ROOTFS_BASE/$TARGET_ROOTFS_BASE/$TERMUX_PREFIX/bin/cc
|
||||
chmod +x $HOST_ROOTFS_BASE/$TARGET_ROOTFS_BASE/$TERMUX_PREFIX/bin/cc
|
||||
# Install cffi and pycparser
|
||||
$PROOT_TARGET env CC=cc TERMUX_STANDALONE_TOOLCHAIN=$TERMUX_STANDALONE_TOOLCHAIN python2 -m pip install cffi pycparser
|
||||
fi
|
||||
}
|
||||
|
||||
termux_step_make() {
|
||||
mkdir -p $HOST_ROOTFS_BASE/$PYPY_USESSION_DIR
|
||||
|
||||
# Translation
|
||||
$PROOT_HOST env -i \
|
||||
-C $PYPY_SRC_DIR/pypy/goal \
|
||||
$TERMUX_RUNTIME_ENV_VARS \
|
||||
PYPY_USESSION_DIR=$PYPY_USESSION_DIR \
|
||||
TARGET_ROOTFS_BASE=$TARGET_ROOTFS_BASE \
|
||||
PROOT_TARGET="$PROOT_TARGET" \
|
||||
$TERMUX_PREFIX/bin/python2 -u ../../rpython/bin/rpython \
|
||||
--platform=termux-$TERMUX_ARCH \
|
||||
--source --no-compile -Ojit \
|
||||
targetpypystandalone.py
|
||||
|
||||
# Build
|
||||
cd $PYPY_USESSION_DIR
|
||||
cd $(ls -C | awk '{print $1}')/testing_1
|
||||
$PROOT_HOST env -C $(pwd) make clean
|
||||
$PROOT_HOST env -C $(pwd) make -j$TERMUX_MAKE_PROCESSES
|
||||
|
||||
# Copy the built files
|
||||
cp ./pypy-c $PYPY_SRC_DIR/pypy/goal/pypy-c
|
||||
cp ./libpypy-c.so $PYPY_SRC_DIR/pypy/goal/libpypy-c.so
|
||||
|
||||
# Build cffi imports
|
||||
TARGET_CFLAGS="-I$TERMUX_PREFIX/include"
|
||||
TARGET_LDFLAGS="-L$TERMUX_PREFIX/lib -Wl,-rpath=$TERMUX_PREFIX/lib"
|
||||
$PROOT_TARGET env \
|
||||
TERMUX_STANDALONE_TOOLCHAIN=$TERMUX_STANDALONE_TOOLCHAIN \
|
||||
CFLAGS="$TARGET_CFLAGS" \
|
||||
LDFLAGS="$TARGET_LDFLAGS" \
|
||||
python2 $PYPY_SRC_DIR/pypy/tool/release/package.py \
|
||||
--archive-name=pypy$_MAJOR_VERSION-v$TERMUX_PKG_VERSION \
|
||||
--targetdir=$PYPY_SRC_DIR \
|
||||
--no-keep-debug
|
||||
}
|
||||
|
||||
termux_step_make_install() {
|
||||
# Recover $TERMUX_PREFIX
|
||||
if [ $HOST_ARCH != $TERMUX_ARCH ]; then
|
||||
rm -rf $TERMUX_PREFIX
|
||||
mv $TERMUX_PREFIX.backup $TERMUX_PREFIX
|
||||
fi
|
||||
rm -rf $TERMUX_PREFIX/opt/pypy
|
||||
unzip -d $TERMUX_PREFIX/opt/ pypy$_MAJOR_VERSION-v$TERMUX_PKG_VERSION.zip
|
||||
mv $TERMUX_PREFIX/opt/pypy$_MAJOR_VERSION-v$TERMUX_PKG_VERSION $TERMUX_PREFIX/opt/pypy
|
||||
ln -sfr $TERMUX_PREFIX/opt/pypy/bin/pypy $TERMUX_PREFIX/bin/
|
||||
ln -sfr $TERMUX_PREFIX/opt/pypy/bin/libpypy-c.so $TERMUX_PREFIX/lib/
|
||||
}
|
||||
|
||||
termux_step_create_debscripts() {
|
||||
# Pre-rm script to cleanup runtime-generated files.
|
||||
cat <<- PRERM_EOF > ./prerm
|
||||
#!$TERMUX_PREFIX/bin/sh
|
||||
|
||||
if [ "$TERMUX_PACKAGE_FORMAT" != "pacman" ] && [ "\$1" != "remove" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Deleting files from site-packages..."
|
||||
rm -Rf $TERMUX_PREFIX/opt/pypy/site-packages/*
|
||||
|
||||
echo "Deleting *.pyc..."
|
||||
find $TERMUX_PREFIX/opt/pypy/lib-python/ | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf
|
||||
find $TERMUX_PREFIX/opt/pypy/lib_pypy/ | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf
|
||||
|
||||
exit 0
|
||||
PRERM_EOF
|
||||
|
||||
chmod 0755 prerm
|
||||
}
|
||||
|
||||
termux_step_post_make_install() {
|
||||
rm -rf $TERMUX_ANDROID_HOME
|
||||
}
|
89
packages/pypy/fix-hardcoded-pathes.patch
Normal file
89
packages/pypy/fix-hardcoded-pathes.patch
Normal file
@ -0,0 +1,89 @@
|
||||
diff -uNr pypy2.7-v7.3.6-src/lib-python/2.7/aifc.py pypy2.7-v7.3.6-src.mod/lib-python/2.7/aifc.py
|
||||
--- pypy2.7-v7.3.6-src/lib-python/2.7/aifc.py 2021-10-03 14:36:11.000000000 +0800
|
||||
+++ pypy2.7-v7.3.6-src.mod/lib-python/2.7/aifc.py 2022-01-17 23:53:50.375397500 +0800
|
||||
@@ -971,7 +971,7 @@
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
if not sys.argv[1:]:
|
||||
- sys.argv.append('/usr/demos/data/audio/bach.aiff')
|
||||
+ sys.argv.append('@TERMUX_PREFIX@/demos/data/audio/bach.aiff')
|
||||
fn = sys.argv[1]
|
||||
f = open(fn, 'r')
|
||||
try:
|
||||
|
||||
diff -uNr pypy2.7-v7.3.6-src/lib-python/2.7/mailcap.py pypy2.7-v7.3.6-src.mod/lib-python/2.7/mailcap.py
|
||||
--- pypy2.7-v7.3.6-src/lib-python/2.7/mailcap.py 2021-10-03 14:36:11.000000000 +0800
|
||||
+++ pypy2.7-v7.3.6-src.mod/lib-python/2.7/mailcap.py 2022-01-17 23:57:37.136118200 +0800
|
||||
@@ -44,7 +44,8 @@
|
||||
# Don't bother with getpwuid()
|
||||
home = '.' # Last resort
|
||||
mailcaps = [home + '/.mailcap', '/etc/mailcap',
|
||||
- '/usr/etc/mailcap', '/usr/local/etc/mailcap']
|
||||
+ '/usr/etc/mailcap', '/usr/local/etc/mailcap',
|
||||
+ '@TERMUX_PREFIX@/etc/mailcap']
|
||||
return mailcaps
|
||||
|
||||
|
||||
|
||||
diff -uNr pypy2.7-v7.3.6-src/lib-python/2.7/mimetypes.py pypy2.7-v7.3.6-src.mod/lib-python/2.7/mimetypes.py
|
||||
--- pypy2.7-v7.3.6-src/lib-python/2.7/mimetypes.py 2021-10-03 14:36:11.000000000 +0800
|
||||
+++ pypy2.7-v7.3.6-src.mod/lib-python/2.7/mimetypes.py 2022-01-18 00:00:35.296584100 +0800
|
||||
@@ -47,6 +47,7 @@
|
||||
"/usr/local/lib/netscape/mime.types",
|
||||
"/usr/local/etc/httpd/conf/mime.types", # Apache 1.2
|
||||
"/usr/local/etc/mime.types", # Apache 1.3
|
||||
+ "@TERMUX_PREFIX@/etc/mime.types", # Termux
|
||||
]
|
||||
|
||||
inited = False
|
||||
|
||||
diff -uNr pypy2.7-v7.3.6-src/lib-python/2.7/subprocess.py pypy2.7-v7.3.6-src.mod/lib-python/2.7/subprocess.py
|
||||
--- pypy2.7-v7.3.6-src/lib-python/2.7/subprocess.py 2021-10-03 14:36:11.000000000 +0800
|
||||
+++ pypy2.7-v7.3.6-src.mod/lib-python/2.7/subprocess.py 2022-01-17 22:21:06.651605000 +0800
|
||||
@@ -941,7 +941,7 @@
|
||||
args = list(args)
|
||||
|
||||
if shell:
|
||||
- args = ["/bin/sh", "-c"] + args
|
||||
+ args = ["@TERMUX_PREFIX@/bin/sh", "-c"] + args
|
||||
if executable:
|
||||
args[0] = executable
|
||||
|
||||
diff -uNr pypy2.7-v7.3.6-src/lib-python/2.7/tempfile.py pypy2.7-v7.3.6-src.mod/lib-python/2.7/tempfile.py
|
||||
--- pypy2.7-v7.3.6-src/lib-python/2.7/tempfile.py 2021-10-03 14:36:11.000000000 +0800
|
||||
+++ pypy2.7-v7.3.6-src.mod/lib-python/2.7/tempfile.py 2022-01-17 22:41:01.258679000 +0800
|
||||
@@ -163,7 +163,7 @@
|
||||
elif _os.name == 'nt':
|
||||
dirlist.extend([ r'c:\temp', r'c:\tmp', r'\temp', r'\tmp' ])
|
||||
else:
|
||||
- dirlist.extend([ '/tmp', '/var/tmp', '/usr/tmp' ])
|
||||
+ dirlist.extend([ '@TERMUX_PREFIX@/tmp' ])
|
||||
|
||||
# As a last resort, the current directory.
|
||||
try:
|
||||
|
||||
diff -uNr pypy2.7-v7.3.6-src/lib-python/2.7/uuid.py pypy2.7-v7.3.6-src.mod/lib-python/2.7/uuid.py
|
||||
--- pypy2.7-v7.3.6-src/lib-python/2.7/uuid.py 2021-10-03 14:36:11.000000000 +0800
|
||||
+++ pypy2.7-v7.3.6-src.mod/lib-python/2.7/uuid.py 2022-01-18 00:06:31.330416000 +0800
|
||||
@@ -314,7 +314,7 @@
|
||||
def _popen(command, args):
|
||||
import os
|
||||
path = os.environ.get("PATH", os.defpath).split(os.pathsep)
|
||||
- path.extend(('/sbin', '/usr/sbin'))
|
||||
+ path.extend(('@TERMUX_PREFIX@/bin',))
|
||||
for dir in path:
|
||||
executable = os.path.join(dir, command)
|
||||
if (os.path.exists(executable) and
|
||||
|
||||
diff -uNr pypy2.7-v7.3.6-src/lib-python/2.7/posixpath.py pypy2.7-v7.3.6-src.mod/lib-python/2.7/posixpath.py
|
||||
--- pypy2.7-v7.3.6-src/lib-python/2.7/posixpath.py 2021-10-03 14:36:11.000000000 +0800
|
||||
+++ pypy2.7-v7.3.6-src.mod/lib-python/2.7/posixpath.py 2022-01-18 00:04:00.434242900 +0800
|
||||
@@ -32,7 +32,7 @@
|
||||
extsep = '.'
|
||||
sep = '/'
|
||||
pathsep = ':'
|
||||
-defpath = ':/bin:/usr/bin'
|
||||
+defpath = ':@TERMUX_PREFIX@/bin'
|
||||
altsep = None
|
||||
devnull = '/dev/null'
|
||||
|
105
packages/pypy/fix-loaded-libs.patch
Normal file
105
packages/pypy/fix-loaded-libs.patch
Normal file
@ -0,0 +1,105 @@
|
||||
diff -U 1 -Nr pypy2.7-v7.3.6-src/lib_pypy/_audioop_build.py pypy2.7-v7.3.6-src.mod/lib_pypy/_audioop_build.py
|
||||
--- pypy2.7-v7.3.6-src/lib_pypy/_audioop_build.py 2021-10-03 14:36:11.000000000 +0800
|
||||
+++ pypy2.7-v7.3.6-src.mod/lib_pypy/_audioop_build.py 2022-01-16 19:42:48.828092300 +0800
|
||||
@@ -629,3 +629,3 @@
|
||||
|
||||
-ffi.set_source("_audioop_cffi", C_SOURCE)
|
||||
+ffi.set_source("_audioop_cffi", C_SOURCE, libraries=["m"])
|
||||
|
||||
diff -U 1 -Nr pypy2.7-v7.3.6-src/lib_pypy/_syslog_build.py pypy2.7-v7.3.6-src.mod/lib_pypy/_syslog_build.py
|
||||
--- pypy3.7-v7.3.7-src/lib_pypy/_syslog_build.py 2021-10-24 22:07:11.000000000 +0800
|
||||
+++ pypy3.7-v7.3.7-src.mod/lib_pypy/_syslog_build.py 2022-01-18 13:15:23.250151600 +0800
|
||||
@@ -23,7 +23,7 @@
|
||||
#ifndef LOG_NEWS
|
||||
#define LOG_NEWS LOG_MAIL
|
||||
#endif
|
||||
-""")
|
||||
+""", libraries=['log'])
|
||||
|
||||
ffi.cdef("""
|
||||
/* mandatory constants */
|
||||
|
||||
diff -uNr pypy2.7-v7.3.6-src/lib_pypy/dbm.py pypy2.7-v7.3.6-src.mod/lib_pypy/dbm.py
|
||||
--- pypy2.7-v7.3.6-src/lib_pypy/dbm.py 2021-10-03 14:36:11.000000000 +0800
|
||||
+++ pypy2.7-v7.3.6-src.mod/lib_pypy/dbm.py 2022-02-09 09:35:04.548269800 +0800
|
||||
@@ -123,7 +123,9 @@
|
||||
func.restype = restype
|
||||
|
||||
if sys.platform != 'darwin':
|
||||
- libpath = ctypes.util.find_library('db')
|
||||
+ libpath = ctypes.util.find_library('gdbm_compat')
|
||||
+ if not libpath:
|
||||
+ libpath = ctype.util.find_library('db')
|
||||
if not libpath:
|
||||
# XXX this is hopeless...
|
||||
for c in ['5.3', '5.2', '5.1', '5.0', '4.9', '4.8', '4.7', '4.6', '4.5']:
|
||||
|
||||
diff -uNr pypy3.6-v7.3.2-src/pypy/module/_multiprocessing/interp_semaphore.py pypy3.6-v7.3.2-src.mod/pypy/module/_multiprocessing/interp_semaphore.py
|
||||
--- pypy3.6-v7.3.2-src/pypy/module/_multiprocessing/interp_semaphore.py 2020-09-23 15:02:22.000000000 +0800
|
||||
+++ pypy3.6-v7.3.2-src.mod/pypy/module/_multiprocessing/interp_semaphore.py 2021-11-08 05:33:39.436884700 +0800
|
||||
@@ -43,7 +43,7 @@
|
||||
if sys.platform == 'darwin':
|
||||
libraries = []
|
||||
else:
|
||||
- libraries = ['rt']
|
||||
+ libraries = ['android-posix-semaphore']
|
||||
|
||||
eci = ExternalCompilationInfo(
|
||||
includes = ['sys/time.h',
|
||||
|
||||
diff -uNr pypy3.7-v7.3.7-src/rpython/rlib/rposix.py pypy3.7-v7.3.7-src.mod/rpython/rlib/rposix.py
|
||||
--- pypy3.7-v7.3.7-src/rpython/rlib/rposix.py 2021-10-24 22:07:11.000000000 +0800
|
||||
+++ pypy3.7-v7.3.7-src.mod/rpython/rlib/rposix.py 2022-02-12 18:32:05.555262500 +0800
|
||||
@@ -212,7 +212,7 @@
|
||||
includes.append('sys/sysmacros.h')
|
||||
if sys.platform.startswith('freebsd') or sys.platform.startswith('openbsd'):
|
||||
includes.append('sys/ttycom.h')
|
||||
- libraries = ['util']
|
||||
+ libraries = ['c']
|
||||
|
||||
eci = ExternalCompilationInfo(
|
||||
includes=includes,
|
||||
|
||||
@@ -2094,6 +2094,8 @@
|
||||
locals()['HAVE_%s' % _name.upper()] = rffi_platform.Has(_name)
|
||||
cConfig = rffi_platform.configure(CConfig)
|
||||
globals().update(cConfig)
|
||||
+# Remove faccessat, linkat
|
||||
+HAVE_FACCESSAT = HAVE_LINKAT = False
|
||||
|
||||
if not _WIN32:
|
||||
class CConfig:
|
||||
|
||||
diff -uNr pypy3.6-v7.3.2-src/rpython/rlib/rtime.py pypy3.6-v7.3.2-src.mod/rpython/rlib/rtime.py
|
||||
--- pypy3.6-v7.3.2-src/rpython/rlib/rtime.py 2020-09-23 15:02:22.000000000 +0800
|
||||
+++ pypy3.6-v7.3.2-src.mod/rpython/rlib/rtime.py 2021-11-08 05:33:04.074015000 +0800
|
||||
@@ -29,10 +29,6 @@
|
||||
'sys/types.h', 'unistd.h',
|
||||
'sys/time.h', 'sys/resource.h']
|
||||
|
||||
- if not sys.platform.startswith("openbsd") and \
|
||||
- not sys.platform.startswith("freebsd"):
|
||||
- includes.append('sys/timeb.h')
|
||||
-
|
||||
need_rusage = True
|
||||
|
||||
|
||||
@@ -51,7 +47,7 @@
|
||||
if sys.platform.startswith('freebsd') or sys.platform.startswith('netbsd'):
|
||||
libraries = ['compat']
|
||||
elif sys.platform == 'linux2':
|
||||
- libraries = ['rt']
|
||||
+ libraries = ['c']
|
||||
else:
|
||||
libraries = []
|
||||
|
||||
@@ -198,7 +194,7 @@
|
||||
# do we need to add -lrt?
|
||||
eciclock = CConfigForClockGetTime._compilation_info_
|
||||
if not _NO_MISSING_RT:
|
||||
- eciclock = eciclock.merge(ExternalCompilationInfo(libraries=['rt']))
|
||||
+ eciclock = eciclock.merge(ExternalCompilationInfo(libraries=['c']))
|
||||
# the functions:
|
||||
c_clock_getres = external("clock_getres",
|
||||
[lltype.Signed, lltype.Ptr(TIMESPEC)],
|
||||
|
169
packages/pypy/fix-not-available-functions.patch
Normal file
169
packages/pypy/fix-not-available-functions.patch
Normal file
@ -0,0 +1,169 @@
|
||||
diff -uNr pypy3.6-v7.3.2-src/lib_pypy/_pwdgrp_build.py pypy3.6-v7.3.2-src.mod/lib_pypy/_pwdgrp_build.py
|
||||
--- pypy3.6-v7.3.2-src/lib_pypy/_pwdgrp_build.py 2020-09-23 15:02:22.000000000 +0800
|
||||
+++ pypy3.6-v7.3.2-src.mod/lib_pypy/_pwdgrp_build.py 2021-11-09 18:32:36.933096400 +0800
|
||||
@@ -35,9 +35,9 @@
|
||||
struct passwd *getpwuid(uid_t uid);
|
||||
struct passwd *getpwnam(const char *name);
|
||||
|
||||
-struct passwd *getpwent(void);
|
||||
-void setpwent(void);
|
||||
-void endpwent(void);
|
||||
+// struct passwd *getpwent(void);
|
||||
+// void setpwent(void);
|
||||
+// void endpwent(void);
|
||||
|
||||
struct group *getgrgid(gid_t gid);
|
||||
struct group *getgrnam(const char *name);
|
||||
|
||||
diff -uNr pypy2.7-v7.3.6-src/lib-python/2.7/smtpd.py pypy2.7-v7.3.6-src.mod/lib-python/2.7/smtpd.py
|
||||
--- pypy2.7-v7.3.6-src/lib-python/2.7/smtpd.py 2021-10-03 14:36:11.000000000 +0800
|
||||
+++ pypy2.7-v7.3.6-src.mod/lib-python/2.7/smtpd.py 2022-01-18 00:14:31.595513600 +0800
|
||||
@@ -9,7 +9,8 @@
|
||||
-n
|
||||
This program generally tries to setuid `nobody', unless this flag is
|
||||
set. The setuid call will fail if this program is not run as root (in
|
||||
- which case, use this flag).
|
||||
+ which case, use this flag). Ignored in Termux as no setuid done on this
|
||||
+ platform.
|
||||
|
||||
--version
|
||||
-V
|
||||
@@ -461,7 +462,7 @@
|
||||
|
||||
|
||||
class Options:
|
||||
- setuid = 1
|
||||
+ setuid = 0
|
||||
classname = 'PureProxy'
|
||||
|
||||
|
||||
diff -uNr pypy3.6-v7.3.2-src/pypy/module/pwd/interp_pwd.py pypy3.6-v7.3.2-src.mod/pypy/module/pwd/interp_pwd.py
|
||||
--- pypy3.6-v7.3.2-src/pypy/module/pwd/interp_pwd.py 2020-09-23 15:02:22.000000000 +0800
|
||||
+++ pypy3.6-v7.3.2-src.mod/pypy/module/pwd/interp_pwd.py 2022-01-09 05:13:04.669185900 +0800
|
||||
@@ -19,18 +19,25 @@
|
||||
uid_t = config['uid_t']
|
||||
gid_t = config['gid_t']
|
||||
|
||||
-class CConfig:
|
||||
- _compilation_info_ = eci
|
||||
+# Android bionic libc has a different define for passwd.
|
||||
+# On LP32, it defines pw_gecos to pw_passwd since they're both NULL.
|
||||
+DEFINED__LP64__ = rffi_platform.getdefined('__LP64__', '')
|
||||
|
||||
- passwd = rffi_platform.Struct(
|
||||
- 'struct passwd',
|
||||
- [('pw_name', rffi.CCHARP),
|
||||
+fields = [('pw_name', rffi.CCHARP),
|
||||
('pw_passwd', rffi.CCHARP),
|
||||
('pw_uid', uid_t),
|
||||
('pw_gid', gid_t),
|
||||
('pw_gecos', rffi.CCHARP),
|
||||
('pw_dir', rffi.CCHARP),
|
||||
- ('pw_shell', rffi.CCHARP)])
|
||||
+ ('pw_shell', rffi.CCHARP)]
|
||||
+
|
||||
+if not DEFINED__LP64__:
|
||||
+ fields.pop(4)
|
||||
+
|
||||
+class CConfig:
|
||||
+ _compilation_info_ = eci
|
||||
+
|
||||
+ passwd = rffi_platform.Struct('struct passwd', fields)
|
||||
|
||||
config = rffi_platform.configure(CConfig)
|
||||
|
||||
@@ -42,9 +49,10 @@
|
||||
|
||||
c_getpwuid = external("getpwuid", [uid_t], passwd_p)
|
||||
c_getpwnam = external("getpwnam", [rffi.CCHARP], passwd_p)
|
||||
-c_setpwent = external("setpwent", [], lltype.Void)
|
||||
-c_getpwent = external("getpwent", [], passwd_p)
|
||||
-c_endpwent = external("endpwent", [], lltype.Void)
|
||||
+# Android bionic libc doesn't have these functions until API 26, but termux compiles on API 23/24.
|
||||
+# c_setpwent = external("setpwent", [], lltype.Void)
|
||||
+# c_getpwent = external("getpwent", [], passwd_p)
|
||||
+# c_endpwent = external("endpwent", [], lltype.Void)
|
||||
|
||||
|
||||
def uid_converter(space, w_uid):
|
||||
@@ -80,7 +88,7 @@
|
||||
space.newtext(rffi.charp2str(pw.c_pw_passwd)),
|
||||
space.int(space.newint(pw.c_pw_uid)),
|
||||
space.int(space.newint(pw.c_pw_gid)),
|
||||
- space.newtext(rffi.charp2str(pw.c_pw_gecos)),
|
||||
+ space.newtext(rffi.charp2str(pw.c_pw_gecos if DEFINED__LP64__ else pw.c_pw_passwd)),
|
||||
space.newtext(rffi.charp2str(pw.c_pw_dir)),
|
||||
space.newtext(rffi.charp2str(pw.c_pw_shell)),
|
||||
])
|
||||
@@ -120,15 +128,15 @@
|
||||
raise oefmt(space.w_KeyError, "getpwnam(): name not found: %s", name)
|
||||
return make_struct_passwd(space, pw)
|
||||
|
||||
-def getpwall(space):
|
||||
- users_w = []
|
||||
- c_setpwent()
|
||||
- try:
|
||||
- while True:
|
||||
- pw = c_getpwent()
|
||||
- if not pw:
|
||||
- break
|
||||
- users_w.append(make_struct_passwd(space, pw))
|
||||
- finally:
|
||||
- c_endpwent()
|
||||
- return space.newlist(users_w)
|
||||
+# def getpwall(space):
|
||||
+# users_w = []
|
||||
+# c_setpwent()
|
||||
+# try:
|
||||
+# while True:
|
||||
+# pw = c_getpwent()
|
||||
+# if not pw:
|
||||
+# break
|
||||
+# users_w.append(make_struct_passwd(space, pw))
|
||||
+# finally:
|
||||
+# c_endpwent()
|
||||
+# return space.newlist(users_w)
|
||||
|
||||
diff -uNr pypy3.6-v7.3.2-src/pypy/module/pwd/moduledef.py pypy3.6-v7.3.2-src.mod/pypy/module/pwd/moduledef.py
|
||||
--- pypy3.6-v7.3.2-src/pypy/module/pwd/moduledef.py 2020-09-23 15:02:22.000000000 +0800
|
||||
+++ pypy3.6-v7.3.2-src.mod/pypy/module/pwd/moduledef.py 2021-11-09 18:31:05.132729100 +0800
|
||||
@@ -15,11 +15,11 @@
|
||||
interpleveldefs = {
|
||||
'getpwuid': 'interp_pwd.getpwuid',
|
||||
'getpwnam': 'interp_pwd.getpwnam',
|
||||
- 'getpwall': 'interp_pwd.getpwall',
|
||||
+ # 'getpwall': 'interp_pwd.getpwall',
|
||||
}
|
||||
|
||||
appleveldefs = {
|
||||
'struct_passwd': 'app_pwd.struct_passwd',
|
||||
- 'struct_pwent': 'app_pwd.struct_passwd',
|
||||
+ # 'struct_pwent': 'app_pwd.struct_passwd',
|
||||
}
|
||||
|
||||
diff -uNr pypy3.7-v7.3.7-src/rpython/rlib/rvmprof/cintf.py pypy3.7-v7.3.7-src.mod/rpython/rlib/rvmprof/cintf.py
|
||||
--- pypy3.7-v7.3.7-src/rpython/rlib/rvmprof/cintf.py 2022-01-02 01:09:08.909941000 +0800
|
||||
+++ pypy3.7-v7.3.7-src.mod/rpython/rlib/rvmprof/cintf.py 2022-01-02 01:10:11.909941000 +0800
|
||||
@@ -16,14 +16,14 @@
|
||||
class VMProfPlatformUnsupported(Exception):
|
||||
pass
|
||||
|
||||
-# vmprof works only on x86 for now
|
||||
+# vmprof cannot compile on termux due to no dlinfo on Bionic Libc
|
||||
IS_SUPPORTED = False
|
||||
-if sys.platform in ('darwin', 'linux', 'linux2') or sys.platform.startswith('freebsd'):
|
||||
- try:
|
||||
- proc = detect_cpu.autodetect()
|
||||
- IS_SUPPORTED = proc.startswith('x86') or proc == 'aarch64'
|
||||
- except detect_cpu.ProcessorAutodetectError:
|
||||
- print("PROCESSOR NOT DETECTED, SKIPPING VMPROF")
|
||||
+# if sys.platform in ('darwin', 'linux', 'linux2') or sys.platform.startswith('freebsd'):
|
||||
+# try:
|
||||
+# proc = detect_cpu.autodetect()
|
||||
+# IS_SUPPORTED = proc.startswith('x86') or proc == 'aarch64'
|
||||
+# except detect_cpu.ProcessorAutodetectError:
|
||||
+# print("PROCESSOR NOT DETECTED, SKIPPING VMPROF")
|
||||
|
||||
ROOT = py.path.local(rpythonroot).join('rpython', 'rlib', 'rvmprof')
|
||||
SRC = ROOT.join('src')
|
||||
|
11
packages/pypy/package-zip.patch
Normal file
11
packages/pypy/package-zip.patch
Normal file
@ -0,0 +1,11 @@
|
||||
diff -uNr pypy3.6-v7.3.2-src/pypy/tool/release/package.py pypy3.6-v7.3.2-src.mod/pypy/tool/release/package.py
|
||||
--- pypy3.6-v7.3.2-src/pypy/tool/release/package.py 2020-09-23 15:02:22.000000000 +0800
|
||||
+++ pypy3.6-v7.3.2-src.mod/pypy/tool/release/package.py 2021-12-30 23:25:59.068175100 +0800
|
||||
@@ -35,7 +35,7 @@
|
||||
ARCH = get_arch()
|
||||
|
||||
|
||||
-USE_ZIPFILE_MODULE = ARCH == 'win32'
|
||||
+USE_ZIPFILE_MODULE = True
|
||||
|
||||
STDLIB_VER = "3"
|
23
packages/pypy/pypy-tkinter.subpackage.sh
Normal file
23
packages/pypy/pypy-tkinter.subpackage.sh
Normal file
@ -0,0 +1,23 @@
|
||||
TERMUX_SUBPKG_DESCRIPTION="Tkinter support for PyPy"
|
||||
TERMUX_SUBPKG_DEPENDS="tk"
|
||||
TERMUX_SUBPKG_INCLUDE="
|
||||
opt/pypy/lib_pypy/_tkinter/*
|
||||
"
|
||||
|
||||
termux_step_create_subpkg_debscripts() {
|
||||
# Pre-rm script to cleanup runtime-generated files.
|
||||
cat <<- PRERM_EOF > ./prerm
|
||||
#!$TERMUX_PREFIX/bin/sh
|
||||
|
||||
if [ "$TERMUX_PACKAGE_FORMAT" != "pacman" ] && [ "\$1" != "remove" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Deleting *.pyc..."
|
||||
find $TERMUX_PREFIX/opt/pypy/lib_pypy/_tkinter/ | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf
|
||||
|
||||
exit 0
|
||||
PRERM_EOF
|
||||
|
||||
chmod 0755 prerm
|
||||
}
|
250
packages/pypy/termux-build.patch
Normal file
250
packages/pypy/termux-build.patch
Normal file
@ -0,0 +1,250 @@
|
||||
diff -uNr pypy2.7-v7.3.6-src/rpython/config/translationoption.py pypy2.7-v7.3.6-src.mod/rpython/config/translationoption.py
|
||||
--- pypy2.7-v7.3.6-src/rpython/config/translationoption.py 2021-10-03 14:36:11.000000000 +0800
|
||||
+++ pypy2.7-v7.3.6-src.mod/rpython/config/translationoption.py 2022-02-02 22:03:09.677990900 +0800
|
||||
@@ -40,6 +40,10 @@
|
||||
PLATFORMS = [
|
||||
'host',
|
||||
'arm',
|
||||
+ 'termux-aarch64',
|
||||
+ 'termux-arm',
|
||||
+ 'termux-x86_64',
|
||||
+ 'termux-i686',
|
||||
]
|
||||
|
||||
translation_optiondescription = OptionDescription(
|
||||
@@ -285,8 +289,17 @@
|
||||
ChoiceOption("platform",
|
||||
"target platform", ['host'] + PLATFORMS, default='host',
|
||||
cmdline='--platform',
|
||||
- suggests={"arm": [("translation.gcrootfinder", "shadowstack"),
|
||||
- ("translation.jit_backend", "arm")]}),
|
||||
+ suggests={ "arm": [("translation.gcrootfinder", "shadowstack"),
|
||||
+ ("translation.jit_backend", "arm")],
|
||||
+ "termux-aarch64": [("translation.gcrootfinder", "shadowstack"),
|
||||
+ ("translation.jit_backend", "auto")],
|
||||
+ "termux-arm": [("translation.gcrootfinder", "shadowstack"),
|
||||
+ ("translation.jit_backend", "arm")],
|
||||
+ "termux-x86_64": [("translation.gcrootfinder", "shadowstack"),
|
||||
+ ("translation.jit_backend", "auto")],
|
||||
+ "termux-i686": [("translation.gcrootfinder", "shadowstack"),
|
||||
+ ("translation.jit_backend", "auto")],
|
||||
+ }),
|
||||
|
||||
BoolOption("split_gc_address_space",
|
||||
"Ensure full separation of GC and non-GC pointers", default=False),
|
||||
|
||||
diff -uNr pypy2.7-v7.3.6-src/rpython/translator/platform/__init__.py pypy2.7-v7.3.6-src.mod/rpython/translator/platform/__init__.py
|
||||
--- pypy2.7-v7.3.6-src/rpython/translator/platform/__init__.py 2021-10-03 14:36:11.000000000 +0800
|
||||
+++ pypy2.7-v7.3.6-src.mod/rpython/translator/platform/__init__.py 2022-02-06 11:18:42.527715600 +0800
|
||||
@@ -332,6 +332,8 @@
|
||||
else:
|
||||
raise ValueError('unknown sys.platform "%s"', sys.platform)
|
||||
|
||||
+# Android always requires compiling with -fPIC
|
||||
+host_factory = LinuxPIC
|
||||
platform = host = host_factory()
|
||||
|
||||
def pick_platform(new_platform, cc):
|
||||
@@ -340,6 +342,18 @@
|
||||
elif new_platform == 'arm':
|
||||
from rpython.translator.platform.arm import ARM
|
||||
return ARM(cc)
|
||||
+ elif new_platform == 'termux-aarch64':
|
||||
+ from rpython.translator.platform.termux import Termux_AArch64
|
||||
+ return Termux_AArch64(cc)
|
||||
+ elif new_platform == 'termux-arm':
|
||||
+ from rpython.translator.platform.termux import Termux_ARM
|
||||
+ return Termux_ARM(cc)
|
||||
+ elif new_platform == 'termux-x86_64':
|
||||
+ from rpython.translator.platform.termux import Termux_AMD64
|
||||
+ return Termux_AMD64(cc)
|
||||
+ elif new_platform == 'termux-i686':
|
||||
+ from rpython.translator.platform.termux import Termux_IA32
|
||||
+ return Termux_IA32(cc)
|
||||
else:
|
||||
raise ValueError("platform = %s" % (new_platform,))
|
||||
|
||||
|
||||
|
||||
--- pypy3.7-v7.3.7-src/rpython/translator/platform/termux.py 1970-01-01 08:00:00.000000000 +0800
|
||||
+++ pypy3.7-v7.3.7-src.mod/rpython/translator/platform/termux.py 2022-03-10 16:49:35.071701000 +0800
|
||||
@@ -0,0 +1,179 @@
|
||||
+from rpython.translator.platform.linux import LinuxPIC
|
||||
+from rpython.translator.platform.posix import _run_subprocess, GnuMakefile
|
||||
+from rpython.translator.platform import ExecutionResult, log
|
||||
+import os
|
||||
+
|
||||
+PROOT_TARGET = os.getenv("PROOT_TARGET")
|
||||
+if PROOT_TARGET == None:
|
||||
+ log.Error("PROOT_TARGET: Must provide PROOT_TARGET.")
|
||||
+ assert 0
|
||||
+
|
||||
+PROOT_TARGET_ARGS = PROOT_TARGET.split()
|
||||
+
|
||||
+TARGET_ROOTFS_BASE = os.getenv("TARGET_ROOTFS_BASE")
|
||||
+if TARGET_ROOTFS_BASE == None:
|
||||
+ log.Error("TARGET_ROOTFS_BASE: Must provide TARGET_ROOTFS_BASE.")
|
||||
+ assert 0
|
||||
+
|
||||
+def _update_cflags_for_termux(cflags):
|
||||
+ assert isinstance(cflags, tuple)
|
||||
+ cflags += ("-fstack-protector-strong", "-fopenmp",
|
||||
+ "-DBIONIC_IOCTL_NO_SIGNEDNESS_OVERLOAD", )
|
||||
+ return cflags
|
||||
+
|
||||
+def _update_link_flags_for_termux(ldflags):
|
||||
+ assert isinstance(ldflags, tuple)
|
||||
+ ldflags += ("-fopenmp", "-static-openmp",
|
||||
+ "-Wl,--enable-new-dtags", "-Wl,--as-needed",
|
||||
+ "-Wl,-z,relro,-z,now", "-Wl,-rpath=@TERMUX_PREFIX@/lib", )
|
||||
+ return ldflags
|
||||
+
|
||||
+def _update_rpath_flags(rpath_flags):
|
||||
+ assert isinstance(rpath_flags, list)
|
||||
+ return ["-Wl,-rpath=@TERMUX_PREFIX@/lib"] + rpath_flags
|
||||
+
|
||||
+class BaseTermux(LinuxPIC):
|
||||
+ cflags = _update_cflags_for_termux(LinuxPIC.cflags)
|
||||
+ extra_libs = ()
|
||||
+ link_flags = _update_link_flags_for_termux(LinuxPIC.link_flags)
|
||||
+ rpath_flags = _update_rpath_flags(LinuxPIC.rpath_flags)
|
||||
+ available_includedirs = []
|
||||
+ available_librarydirs = []
|
||||
+
|
||||
+ @property
|
||||
+ def cc(self):
|
||||
+ return self._get_cross_compiler()
|
||||
+
|
||||
+ @cc.setter
|
||||
+ def cc(self, *args):
|
||||
+ pass
|
||||
+
|
||||
+ def _execute_c_compiler(self, cc, args, outname, cwd=None):
|
||||
+ # 'cc' can also contain some options for the C compiler;
|
||||
+ # e.g. it can be "gcc -m32". We handle it by splitting on ' '.
|
||||
+ cclist = cc.split()
|
||||
+ cc = cclist[0]
|
||||
+ args = cclist[1:] + args
|
||||
+ log.execute('Exec: ' + cc + ' ' + ' '.join(args))
|
||||
+ returncode, stdout, stderr = _run_subprocess(
|
||||
+ cc, args, self.c_environ, cwd)
|
||||
+ self._handle_error(returncode, bytes(stdout), bytes(stderr), outname)
|
||||
+
|
||||
+ def execute(self, executable, args=[], env=None, compilation_info=None):
|
||||
+ if self._is_same_platform_type():
|
||||
+ log.execute('Exec (' + self.name + '): ' +
|
||||
+ str(executable) + ' ' + ' '.join(args))
|
||||
+ return super(BaseTermux, self).execute(executable, args, env, compilation_info)
|
||||
+ if isinstance(args, str):
|
||||
+ args = ' ' + str(executable) + ' ' + args
|
||||
+ log.execute('Cross Exec (' + self.name + '): ' + args)
|
||||
+ else:
|
||||
+ args = [str(executable)] + args
|
||||
+ log.execute('Cross Exec (' + self.name + '): ' + ' '.join(args))
|
||||
+ proot_exec = PROOT_TARGET_ARGS[0]
|
||||
+ args = PROOT_TARGET_ARGS[1:] + args
|
||||
+ returncode, stdout, stderr = _run_subprocess(proot_exec, args, env)
|
||||
+ stdout = "" if stdout == None else stdout
|
||||
+ stderr = "" if stderr == None else stderr
|
||||
+ return ExecutionResult(returncode, stdout, stderr)
|
||||
+
|
||||
+ def include_dirs_for_libffi(self):
|
||||
+ return self.available_includedirs
|
||||
+
|
||||
+ def library_dirs_for_libffi(self):
|
||||
+ return self.available_librarydirs
|
||||
+
|
||||
+ def _preprocess_include_dirs(self, include_dirs):
|
||||
+ return list(include_dirs) + self.available_includedirs
|
||||
+
|
||||
+ def _preprocess_library_dirs(self, library_dirs):
|
||||
+ return list(library_dirs) + self.available_librarydirs
|
||||
+
|
||||
+ def execute_makefile(self, path_to_makefile, extra_opts=[]):
|
||||
+ raise NotImplementedError()
|
||||
+
|
||||
+ def get_multiarch(self):
|
||||
+ raise NotImplementedError("Needs to be overwritten")
|
||||
+
|
||||
+ def _get_cross_compiler(self):
|
||||
+ return "clang" if self._is_same_platform_type() else ("clang --target=" + self.get_multiarch())
|
||||
+
|
||||
+ def _get_build_platform_type(self):
|
||||
+ return "x86"
|
||||
+
|
||||
+ def _get_target_platform_type(self):
|
||||
+ raise NotImplementedError("Needs to be overwritten")
|
||||
+
|
||||
+ def _is_same_platform_type(self):
|
||||
+ return self._get_build_platform_type() == self._get_target_platform_type()
|
||||
+
|
||||
+def _update_cflags_for_termux_aarch64(cflags):
|
||||
+ return ('-I' + TARGET_ROOTFS_BASE + '@TERMUX_PREFIX@/include', ) + cflags
|
||||
+
|
||||
+def _update_link_flags_for_termux_aarch64(ldflags):
|
||||
+ return ('-L' + TARGET_ROOTFS_BASE + '@TERMUX_PREFIX@/lib', ) + ldflags
|
||||
+
|
||||
+class Termux_AArch64(BaseTermux):
|
||||
+ name = "termux-aarch64"
|
||||
+ cflags = _update_cflags_for_termux_aarch64(BaseTermux.cflags)
|
||||
+ link_flags = _update_link_flags_for_termux_aarch64(BaseTermux.link_flags)
|
||||
+
|
||||
+ def get_multiarch(self):
|
||||
+ return "aarch64-linux-android"
|
||||
+
|
||||
+ def _get_target_platform_type(self):
|
||||
+ return "arm"
|
||||
+
|
||||
+def _update_cflags_for_termux_arm(cflags):
|
||||
+ return ('-I' + TARGET_ROOTFS_BASE + '@TERMUX_PREFIX@/include',
|
||||
+ "-march=armv7-a", "-mfpu=neon",
|
||||
+ "-mfloat-abi=softfp", "-mthumb", ) + cflags
|
||||
+
|
||||
+def _update_link_flags_for_termux_arm(ldflags):
|
||||
+ return ("-march=armv7-a", '-L' + TARGET_ROOTFS_BASE + '@TERMUX_PREFIX@/lib', ) + ldflags
|
||||
+
|
||||
+class Termux_ARM(BaseTermux):
|
||||
+ name = "termux-arm"
|
||||
+ cflags = _update_cflags_for_termux_arm(BaseTermux.cflags)
|
||||
+ link_flags = _update_link_flags_for_termux_arm(BaseTermux.link_flags)
|
||||
+
|
||||
+ def get_multiarch(self):
|
||||
+ return "arm-linux-androideabi"
|
||||
+
|
||||
+ def _get_target_platform_type(self):
|
||||
+ return "arm"
|
||||
+
|
||||
+def _update_cflags_for_termux_x86_64(ldflags):
|
||||
+ return ('-I@TERMUX_PREFIX@/include', ) + ldflags
|
||||
+
|
||||
+def _update_link_flags_for_termux_x86_64(ldflags):
|
||||
+ return ('-L@TERMUX_PREFIX@/lib', ) + ldflags
|
||||
+
|
||||
+class Termux_AMD64(BaseTermux):
|
||||
+ name = "termux-x86_64"
|
||||
+ cflags = _update_cflags_for_termux_x86_64(BaseTermux.cflags)
|
||||
+ link_flags = _update_link_flags_for_termux_x86_64(BaseTermux.link_flags)
|
||||
+
|
||||
+ def get_multiarch(self):
|
||||
+ return "x86_64-linux-android"
|
||||
+
|
||||
+ def _get_target_platform_type(self):
|
||||
+ return "x86"
|
||||
+
|
||||
+def _update_cflags_for_termux_i686(cflags):
|
||||
+ return ('-I@TERMUX_PREFIX@/include', "-march=i686", "-msse3",
|
||||
+ "-mstackrealign", "-mfpmath=sse", "-fPIC", ) + cflags
|
||||
+
|
||||
+def _update_link_flags_for_termux_i686(ldflags):
|
||||
+ return ('-L@TERMUX_PREFIX@/lib', "-fPIC", ) + ldflags
|
||||
+
|
||||
+class Termux_IA32(BaseTermux):
|
||||
+ name = "termux-i686"
|
||||
+ cflags = _update_cflags_for_termux_i686(BaseTermux.cflags)
|
||||
+ link_flags = _update_link_flags_for_termux_i686(BaseTermux.link_flags)
|
||||
+
|
||||
+ def get_multiarch(self):
|
||||
+ return "i686-linux-android"
|
||||
+
|
||||
+ def _get_target_platform_type(self):
|
||||
+ return "x86"
|
@ -212,6 +212,9 @@ PACKAGES+=" python3-jsonschema"
|
||||
# Needed by proxmark3/proxmark3-git
|
||||
PACKAGES+=" gcc-arm-none-eabi"
|
||||
|
||||
# Needed by pypy
|
||||
PACKAGES+=" qemu-user-static"
|
||||
|
||||
# For opt, llvm-link, llc not shipped by NDK.
|
||||
# Required by picolisp (and maybe a few others in future)
|
||||
PACKAGES+=" llvm-12"
|
||||
|
Loading…
x
Reference in New Issue
Block a user