summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2022-07-24 16:01:58 +0200
committerMichał Górny <mgorny@gentoo.org>2022-07-24 20:18:06 +0200
commitefa383170b142553a174191408e6a7a672ed1709 (patch)
tree4e197e94fb99ea6869a10106e1fb74c50235ba1d /dev-python/pypy3-exe
parentdev-go/golicense: update EAPI 7 -> 8 (diff)
downloadgentoo-efa383170b142553a174191408e6a7a672ed1709.tar.gz
gentoo-efa383170b142553a174191408e6a7a672ed1709.tar.bz2
gentoo-efa383170b142553a174191408e6a7a672ed1709.zip
dev-python/pypy3-exe: Backport .pyc magic fix as 7.3.9_p3
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/pypy3-exe')
-rw-r--r--dev-python/pypy3-exe/Manifest1
-rw-r--r--dev-python/pypy3-exe/pypy3-exe-7.3.9_p3.ebuild172
2 files changed, 173 insertions, 0 deletions
diff --git a/dev-python/pypy3-exe/Manifest b/dev-python/pypy3-exe/Manifest
index c5caa42dac85..8b4f20659d4a 100644
--- a/dev-python/pypy3-exe/Manifest
+++ b/dev-python/pypy3-exe/Manifest
@@ -1,2 +1,3 @@
DIST pypy3.9-gentoo-patches-7.3.9.tar.xz 1564 BLAKE2B fe0875ef002842a78fb31589f6d0b255c3dea10f2bd014231ae9b17641f65f810ac84fe7961de1a4614249b0166f2127c3aa37947f7d1d4c85860a31b89110f1 SHA512 a1dc3ee36e908e29b2bbbb100a97b7910bd4325c5dc55c0455cdca450d6b272d1463708b383e0607e9499b1932da4442f97d2da57e47ed3a4ff8fd3c78a54732
+DIST pypy3.9-gentoo-patches-7.3.9_p3.tar.xz 5296 BLAKE2B 2422e7d74c563d7328e5bc5c131d13f0cb41f133e06a514e56ad89d2cc8e0b9c57d4379d0e8810486e5e34ec2807a74e9553768a493ffe54fc27d404977097d3 SHA512 3470efdd50ba10e2137b4661c940a3aa807b804ef582a5201507227573637171981bd597b3b40faa3606890f3f51fb8c43ff70628de924a67e2c1226beda9269
DIST pypy3.9-v7.3.9-src.tar.bz2 26976726 BLAKE2B bf1ed21c575901abac020120aaff07ab57f1404713211b19cbd1eb4d6ffc675b7933be8c6fffc2b69ab467963d6598534cd5aa90c02feddad596611d2a6b6581 SHA512 83f8a6a2da351c190d2d224242cbc35e35529c7a8e8d842eaf5c945cbce2e172b02a340f32af3d49df8d5288370d794d5bc95fc12dd4a13d817c925abf06198a
diff --git a/dev-python/pypy3-exe/pypy3-exe-7.3.9_p3.ebuild b/dev-python/pypy3-exe/pypy3-exe-7.3.9_p3.ebuild
new file mode 100644
index 000000000000..c5f53f463d20
--- /dev/null
+++ b/dev-python/pypy3-exe/pypy3-exe-7.3.9_p3.ebuild
@@ -0,0 +1,172 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# pypy3 needs to be built using python 2
+PYTHON_COMPAT=( python2_7 )
+inherit check-reqs pax-utils python-any-r1 toolchain-funcs
+
+PYPY_PV=${PV%_p*}
+MY_P=pypy3.9-v${PYPY_PV/_}
+PATCHSET="pypy3.9-gentoo-patches-${PV/_rc/rc}"
+
+DESCRIPTION="PyPy3 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="3.9-${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/pypy3-exe-bin:${SLOT}
+"
+DEPEND="
+ ${RDEPEND}
+"
+BDEPEND="
+ low-memory? ( dev-python/pypy )
+ !low-memory? (
+ || (
+ dev-python/pypy
+ dev-lang/python:2.7
+ )
+ )
+"
+
+check_env() {
+ if use low-memory; then
+ 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
+
+ # unset to allow forcing pypy below :)
+ use low-memory && EPYTHON=
+ if [[ ! ${EPYTHON} || ${EPYTHON} == pypy ]] &&
+ { has_version -b dev-python/pypy ||
+ has_version -b dev-python/pypy-bin; }
+ then
+ einfo "Using PyPy to perform the translation."
+ EPYTHON=pypy
+ else
+ einfo "Using ${EPYTHON:-python2} to perform the translation. Please note that upstream"
+ einfo "recommends using PyPy for that. If you wish to do so, please install"
+ einfo "dev-python/pypy and ensure that EPYTHON variable is unset."
+ 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 || die
+ cp -r lib_pypy/cffi/_pycparser "${T}"/pymod/pycparser || 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() {
+ cd "${T}"/usession*-0 || die
+ newbin testing_1/pypy3.9-c pypy3.9-c-${PYPY_PV}
+ insinto /usr/include/pypy3.9/${PYPY_PV}
+ doins *.h
+ pax-mark m "${ED}/usr/bin/pypy3.9-c-${PYPY_PV}"
+}