1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
#!/bin/sh
# Determine the translation options and translate
set -e -u
usage() {
name=$(basename $0)
echo <<EOF
Usage: $name [options...]"
Options:
--python=PYTHON Use PYTHON to tranlate PyPy
EOF
}
PYTHON=python2
while [ $# -ge 1 ]; do
case "$1" in
--python)
PYTHON="$2"
shift
;;
--help|-h)
usage
exit 0
;;
*)
echo "Unkown option: $1" >&2
usage
exit 1
;;
esac
shift
done
RPYOPTS="--batch --source"
TARGETOPTS=""
OPT=3
if echo "$DEB_BUILD_OPTIONS" | egrep -q '\bnoopt\b'; then
OPT=0
elif dpkg-architecture -iany-i386; then
OPT=jit
#RPYOPTS="$RPYOPTS --jit-backend=x86-without-sse2"
elif dpkg-architecture -iany-amd64; then
# No JIT on x32
if ! dpkg-architecture -elinux-x32; then
OPT=jit
fi
elif dpkg-architecture -iany-arm; then
# No JIT support for ARMv5
if ! dpkg-architecture -elinux-armel; then
OPT=jit
fi
elif dpkg-architecture -iany-arm64; then
OPT=jit
elif dpkg-architecture -iany-ppc64el || dpkg-architecture -iany-ppc64; then
OPT=jit
elif dpkg-architecture -iany-riscv64; then
OPT=jit
elif dpkg-architecture -iany-s390x; then
OPT=jit
fi
RPYOPTS="$RPYOPTS --opt=$OPT --shared"
if [ $OPT = 3 ]; then
RPYOPTS="$RPYOPTS --no-profopt"
fi
CONTINUATION=0
if dpkg-architecture -iany-i386 \
|| dpkg-architecture -iany-amd64 \
|| dpkg-architecture -iany-arm \
|| dpkg-architecture -iany-arm64 \
|| dpkg-architecture -iany-mips64el \
|| dpkg-architecture -iany-ppc64 \
|| dpkg-architecture -iany-ppc64el \
|| dpkg-architecture -iany-riscv64 \
|| dpkg-architecture -iany-s390x; then
CONTINUATION=1
fi
if [ $CONTINUATION -eq 0 ]; then
TARGETOPTS="$TARGETOPTS --withoutmod-_continuation"
fi
if dpkg-architecture --is kfreebsd-any; then
# No support for F_GETPATH
TARGETOPTS="$TARGETOPTS --withoutmod-_vmprof"
fi
if dpkg-architecture -iany-s390x; then
# Override CPU auto-detection, target the distro baseline
if dpkg-vendor --derives-from Ubuntu; then
gcc_pkg_version=$(dpkg-query -f '${Version}' -W gcc)
if dpkg --compare-versions $gcc_pkg_version ge 4:9; then
# Targetted z13 since gcc-9 9.2.1-12
export CFLAGS="$CFLAGS -march=z13"
else
export CFLAGS="$CFLAGS -march=zEC12"
fi
else
export CFLAGS="$CFLAGS -march=z196"
fi
fi
if [ "$PYTHON" = "pypy" ]; then
if [ $(dpkg-architecture -q DEB_HOST_ARCH_BITS) -eq 32 ]; then
export PYPY_GC_MAX_DELTA=200MB
PYTHON="$PYTHON --jit loop_longevity=300"
fi
fi
CURDIR=$(pwd)
RPYTHON=$CURDIR/rpython/bin/rpython
TMPDIR=$CURDIR/build-tmp
PYPY_USESSION_BASENAME=debian
C_SRC_DIR=$TMPDIR/usession-$PYPY_USESSION_BASENAME-0/testing_1
SUB_MAKEFLAGS=$(echo ${DEB_BUILD_OPTIONS:-} | tr ' ' '\n' | sed -ne 's/parallel=/-j/p')
set -x
export TMPDIR PYPY_USESSION_BASENAME
rm -rf "$TMPDIR"
mkdir "$TMPDIR"
export PYPY_MULTIARCH=$DEB_HOST_MULTIARCH
cd pypy/goal
ln -s ../../lib_pypy/cffi/_pycparser/ pycparser
$PYTHON -u $RPYTHON $RPYOPTS targetpypystandalone $TARGETOPTS 2>&1
cd "$CURDIR"
# PyPy captures all make output, so we call it ourselves (--source), to save
# memory and avoid timeouts:
make -C $C_SRC_DIR $SUB_MAKEFLAGS
cp $C_SRC_DIR/pypy3.11-c $C_SRC_DIR/libpypy3.11-c.so pypy/goal
|