summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dev-python/pypy-exe')
-rw-r--r--dev-python/pypy-exe/Manifest2
-rw-r--r--dev-python/pypy-exe/pypy-exe-7.3.4.ebuild178
2 files changed, 180 insertions, 0 deletions
diff --git a/dev-python/pypy-exe/Manifest b/dev-python/pypy-exe/Manifest
index 7b6d2debce87..35edec23e66c 100644
--- a/dev-python/pypy-exe/Manifest
+++ b/dev-python/pypy-exe/Manifest
@@ -1,2 +1,4 @@
DIST pypy2.7-gentoo-patches-7.3.3_p2.tar.xz 11184 BLAKE2B b2b9b94478609372d616c65a87cbb12a07e217928beef9fac26c428f81c662ef390db3fd85bf368ffcc8c6fa3802e506412b7bebd14bdc453009008bc3459d25 SHA512 9ab8ed99b42b36e9c212683ef93f7f1fb99caecf056293ab9a5734f8b52eedec192860702baa121630558530cb5c4652f8542300ecaaaa282377ea6456618b95
+DIST pypy2.7-gentoo-patches-7.3.4.tar.xz 7844 BLAKE2B d06694fa085667e40ef8805c29f7ccf95b49f9de4e99e3ebfa3d69c4202a0ddcebb54c524d7d9f9ec67573a8d2ebe38fb7023d4d3ecef67afc907ecef5c16c02 SHA512 aa8ffefb5d30070ae86c1c14c55c277e39d3da66aea3a0951319158fb65e716e7fa7864e8bf5d26314d4b2a8030c766b63cad6a3663822d2875cd8cc1f3f2de5
DIST pypy2.7-v7.3.3-src.tar.bz2 20881821 BLAKE2B ce1ecdd1fffe40574c7662da6038b84d2bca47ab168939ef0c12be2c6348317f17a94a3026e7fa53c71601edc153aefd98f770bd148e7af07ca751c0a5fc1252 SHA512 c2b6c44fdcac5f9445fab01572f859228fc286891fd09a4ddb95d283683d805276c853ec8e61fcd04cb9ee811d0e959d19bb03fdd7442c044f28a773633122e7
+DIST pypy2.7-v7.3.4-src.tar.bz2 21571561 BLAKE2B d0ac56fadec63fe7e65728c36c2aaf96fc5f54919dddbca9571a24c42a9e3e21f672f84555a18a384c4715f0489bd7aef009c0a47b635de88c472a93e2ae8d71 SHA512 4c18c2dbfbf0cc1034bea773828204df77aec7ef82119fb94e5cb762ce1783e00ad70e99d1432b4948dc132e726bdc6015f4a5bf10a5b10415bcfe99da2ecd17
diff --git a/dev-python/pypy-exe/pypy-exe-7.3.4.ebuild b/dev-python/pypy-exe/pypy-exe-7.3.4.ebuild
new file mode 100644
index 000000000000..b76695a82c8b
--- /dev/null
+++ b/dev-python/pypy-exe/pypy-exe-7.3.4.ebuild
@@ -0,0 +1,178 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+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}"
+}