commit:     e26835cc5ef9b5a5b0cd0362f168d7e215f8dcc2
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 30 10:51:14 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Mar 30 15:13:01 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e26835cc

dev-python/pypy-exe: Bump to 7.3.9

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/pypy-exe/Manifest              |   2 +
 dev-python/pypy-exe/pypy-exe-7.3.9.ebuild | 185 ++++++++++++++++++++++++++++++
 2 files changed, 187 insertions(+)

diff --git a/dev-python/pypy-exe/Manifest b/dev-python/pypy-exe/Manifest
index b22b36917ccc..c5323d318202 100644
--- a/dev-python/pypy-exe/Manifest
+++ b/dev-python/pypy-exe/Manifest
@@ -1,2 +1,4 @@
 DIST pypy2.7-gentoo-patches-7.3.8.tar.xz 7428 BLAKE2B 
5362c34929e2053fc9a806e9894f35cce02ba1ebfad66cc64acc200ade4317934ee50dbc072194d19e201dea2a678abd609001ffe7e39bd6890a3b26c9d6d00e
 SHA512 
6a7bfadac8f638e69419a6a1536af595a63bb2b4e3028da6423bd164d3df5399901b217468b1b374a5162ca8d2e5a61c4a19996f9e63109ed414a1aedcaac5d6
+DIST pypy2.7-gentoo-patches-7.3.9.tar.xz 7428 BLAKE2B 
0a42e3c04ac0e560d56ce7218db81fa55f74ad45a4a033ccda8c5fba34e3a0b1f06587b5b18e947170cc635bd44e5a7799daeec9319c6a09165a73b32554a4b6
 SHA512 
3a52d40ccf8d77f3493a763b51e4bf86a808f6478191ed4eeaa4f2c2ce8b75769c3880d07cbc7614d8af5573f3e8edfe694be41626b947f3d06c321cf4f59abd
 DIST pypy2.7-v7.3.8-src.tar.bz2 23279006 BLAKE2B 
7b2f5bfaffb99d3444f355039f743a21016dea22cc78cd5feca05eb12ce0e5ed39dafd22a8726994d0aff789e68b506197680e7181087313d2c5cd17b674ae4d
 SHA512 
6ff90fad998c25aec5823e61d65266c169e89cba2ee2e3b6d0864d34d69a6b9fe7ad4d591bc8b38a48c5c22ea3dd468d3188cd34e03746c258752eaa24ac3ae2
+DIST pypy2.7-v7.3.9-src.tar.bz2 23328628 BLAKE2B 
50d015439b6a6f15dd24eb4524726a2054f0d8e7ef209b54dc4eb9365b41b333f3dad525422316af3ff19e6ffb5866859db4455e05fc1529a81ce3b6e7c621db
 SHA512 
8d7513d4efe924f2456dd65a45a82dd16171f7962c81ba90f2a168c332cdad78ceffa3ed1af379c09e61082b39d5c2a8385cd77c89b698c47cc75e9df1bb4d2a

diff --git a/dev-python/pypy-exe/pypy-exe-7.3.9.ebuild 
b/dev-python/pypy-exe/pypy-exe-7.3.9.ebuild
new file mode 100644
index 000000000000..c502c75abbe3
--- /dev/null
+++ b/dev-python/pypy-exe/pypy-exe-7.3.9.ebuild
@@ -0,0 +1,185 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python2_7 )
+inherit check-reqs pax-utils python-any-r1 toolchain-funcs
+
+PYPY_PV=${PV%_p*}
+MY_P=pypy2.7-v${PYPY_PV/_}
+PATCHSET="pypy2.7-gentoo-patches-${PV/_}"
+
+DESCRIPTION="PyPy executable (build from source)"
+HOMEPAGE="https://www.pypy.org/";
+SRC_URI="
+       https://buildbot.pypy.org/pypy/${MY_P}-src.tar.bz2
+       https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz
+"
+S="${WORKDIR}/${MY_P}-src"
+
+LICENSE="MIT"
+SLOT="${PYPY_PV}"
+KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="bzip2 +jit low-memory ncurses cpu_flags_x86_sse2"
+
+RDEPEND="
+       >=sys-libs/zlib-1.1.3:0=
+       dev-libs/libffi:0=
+       virtual/libintl:0=
+       dev-libs/expat:0=
+       bzip2? ( app-arch/bzip2:0= )
+       ncurses? ( sys-libs/ncurses:0= )
+       !dev-python/pypy-exe-bin:${PYPY_PV}
+"
+# don't enforce the dep on pypy with USE=low-memory since it's going
+# to cause either collisions or circular dep on itself
+DEPEND="
+       ${RDEPEND}
+"
+BDEPEND="
+       !low-memory? (
+               || (
+                       dev-python/pypy
+                       dev-lang/python:2.7
+               )
+       )
+"
+
+check_env() {
+       if use low-memory; then
+               if ! has_version -b dev-python/pypy &&
+                               ! has_version -b dev-python/pypy-bin
+               then
+                       eerror "USE=low-memory requires a (possibly old) 
version of dev-python/pypy"
+                       eerror "being installed. Please install it using e.g.:"
+                       eerror
+                       eerror "  $ emerge -1v dev-python/pypy 
dev-python/pypy-exe-bin"
+                       eerror
+                       eerror "before attempting to build 
dev-python/pypy-exe[low-memory]."
+                       die "dev-python/pypy needs to be installed for 
USE=low-memory"
+               fi
+
+               CHECKREQS_MEMORY="1750M"
+               use amd64 && CHECKREQS_MEMORY="3500M"
+       else
+               CHECKREQS_MEMORY="3G"
+               use amd64 && CHECKREQS_MEMORY="6G"
+       fi
+
+       check-reqs_pkg_pretend
+}
+
+pkg_pretend() {
+       [[ ${MERGE_TYPE} != binary ]] && check_env
+}
+
+pkg_setup() {
+       if [[ ${MERGE_TYPE} != binary ]]; then
+               check_env
+
+               use low-memory && EPYTHON=
+               if [[ ! ${EPYTHON} || ${EPYTHON} == pypy ]] &&
+                               { has_version -b dev-python/pypy ||
+                               has_version -b dev-python/pypy-bin; }
+               then
+                       einfo "Using already-installed PyPy to perform the 
translation."
+                       EPYTHON=pypy
+               else
+                       einfo "Using ${EPYTHON} to perform the translation. 
Please note that upstream"
+                       einfo "recommends using PyPy for that. If you wish to 
do so, please unset"
+                       einfo "the EPYTHON variable."
+                       python-any-r1_pkg_setup
+               fi
+       fi
+}
+
+src_prepare() {
+       local PATCHES=(
+               "${WORKDIR}/${PATCHSET}"
+       )
+       default
+}
+
+src_configure() {
+       tc-export CC
+
+       local jit_backend
+       if use jit; then
+               jit_backend='--jit-backend='
+
+               # We only need the explicit sse2 switch for x86.
+               # On other arches we can rely on autodetection which uses
+               # compiler macros. Plus, --jit-backend= doesn't accept all
+               # the modern values...
+
+               if use x86; then
+                       if use cpu_flags_x86_sse2; then
+                               jit_backend+=x86
+                       else
+                               jit_backend+=x86-without-sse2
+                       fi
+               else
+                       jit_backend+=auto
+               fi
+       fi
+
+       local args=(
+               --no-shared
+               $(usex jit -Ojit -O2)
+
+               ${jit_backend}
+
+               pypy/goal/targetpypystandalone
+       )
+
+       # Avoid linking against libraries disabled by use flags
+       local opts=(
+               bzip2:bz2
+               ncurses:_minimal_curses
+       )
+
+       local opt
+       for opt in "${opts[@]}"; do
+               local flag=${opt%:*}
+               local mod=${opt#*:}
+
+               args+=(
+                       $(usex ${flag} --withmod --withoutmod)-${mod}
+               )
+       done
+
+       local interp=( "${EPYTHON}" )
+       if use low-memory; then
+               interp=( env PYPY_GC_MAX_DELTA=200MB
+                       "${EPYTHON}" --jit loop_longevity=300 )
+       fi
+
+       if [[ ${EPYTHON} != pypy ]]; then
+               # reuse bundled pycparser to avoid external dep
+               mkdir -p "${T}"/pymod/cffi || die
+               : > "${T}"/pymod/cffi/__init__.py || die
+               cp -r lib_pypy/cffi/_pycparser "${T}"/pymod/cffi/ || die
+               local -x PYTHONPATH=${T}/pymod:${PYTHONPATH}
+       fi
+
+       # translate into the C sources
+       # we're going to build them ourselves since otherwise pypy does not
+       # free up the unneeded memory before spawning the compiler
+       set -- "${interp[@]}" rpython/bin/rpython --batch --source "${args[@]}"
+       echo -e "\033[1m${@}\033[0m"
+       "${@}" || die "translation failed"
+}
+
+src_compile() {
+       emake -C "${T}"/usession*-0/testing_1
+}
+
+src_install() {
+       local dest=/usr/lib/pypy2.7
+       exeinto "${dest}"
+       newexe "${T}"/usession*-0/testing_1/pypy-c pypy-c-${PYPY_PV}
+       insinto "${dest}"/include/${PYPY_PV}
+       doins include/pypy_*
+       pax-mark m "${ED}${dest}/pypy-c-${PYPY_PV}"
+}

Reply via email to