Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pypy-exe/
Date: Wed, 30 Mar 2022 15:13:20
Message-Id: 1648653181.e26835cc5ef9b5a5b0cd0362f168d7e215f8dcc2.mgorny@gentoo
1 commit: e26835cc5ef9b5a5b0cd0362f168d7e215f8dcc2
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Wed Mar 30 10:51:14 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Wed Mar 30 15:13:01 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e26835cc
7
8 dev-python/pypy-exe: Bump to 7.3.9
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 dev-python/pypy-exe/Manifest | 2 +
13 dev-python/pypy-exe/pypy-exe-7.3.9.ebuild | 185 ++++++++++++++++++++++++++++++
14 2 files changed, 187 insertions(+)
15
16 diff --git a/dev-python/pypy-exe/Manifest b/dev-python/pypy-exe/Manifest
17 index b22b36917ccc..c5323d318202 100644
18 --- a/dev-python/pypy-exe/Manifest
19 +++ b/dev-python/pypy-exe/Manifest
20 @@ -1,2 +1,4 @@
21 DIST pypy2.7-gentoo-patches-7.3.8.tar.xz 7428 BLAKE2B 5362c34929e2053fc9a806e9894f35cce02ba1ebfad66cc64acc200ade4317934ee50dbc072194d19e201dea2a678abd609001ffe7e39bd6890a3b26c9d6d00e SHA512 6a7bfadac8f638e69419a6a1536af595a63bb2b4e3028da6423bd164d3df5399901b217468b1b374a5162ca8d2e5a61c4a19996f9e63109ed414a1aedcaac5d6
22 +DIST pypy2.7-gentoo-patches-7.3.9.tar.xz 7428 BLAKE2B 0a42e3c04ac0e560d56ce7218db81fa55f74ad45a4a033ccda8c5fba34e3a0b1f06587b5b18e947170cc635bd44e5a7799daeec9319c6a09165a73b32554a4b6 SHA512 3a52d40ccf8d77f3493a763b51e4bf86a808f6478191ed4eeaa4f2c2ce8b75769c3880d07cbc7614d8af5573f3e8edfe694be41626b947f3d06c321cf4f59abd
23 DIST pypy2.7-v7.3.8-src.tar.bz2 23279006 BLAKE2B 7b2f5bfaffb99d3444f355039f743a21016dea22cc78cd5feca05eb12ce0e5ed39dafd22a8726994d0aff789e68b506197680e7181087313d2c5cd17b674ae4d SHA512 6ff90fad998c25aec5823e61d65266c169e89cba2ee2e3b6d0864d34d69a6b9fe7ad4d591bc8b38a48c5c22ea3dd468d3188cd34e03746c258752eaa24ac3ae2
24 +DIST pypy2.7-v7.3.9-src.tar.bz2 23328628 BLAKE2B 50d015439b6a6f15dd24eb4524726a2054f0d8e7ef209b54dc4eb9365b41b333f3dad525422316af3ff19e6ffb5866859db4455e05fc1529a81ce3b6e7c621db SHA512 8d7513d4efe924f2456dd65a45a82dd16171f7962c81ba90f2a168c332cdad78ceffa3ed1af379c09e61082b39d5c2a8385cd77c89b698c47cc75e9df1bb4d2a
25
26 diff --git a/dev-python/pypy-exe/pypy-exe-7.3.9.ebuild b/dev-python/pypy-exe/pypy-exe-7.3.9.ebuild
27 new file mode 100644
28 index 000000000000..c502c75abbe3
29 --- /dev/null
30 +++ b/dev-python/pypy-exe/pypy-exe-7.3.9.ebuild
31 @@ -0,0 +1,185 @@
32 +# Copyright 1999-2022 Gentoo Authors
33 +# Distributed under the terms of the GNU General Public License v2
34 +
35 +EAPI=8
36 +
37 +PYTHON_COMPAT=( python2_7 )
38 +inherit check-reqs pax-utils python-any-r1 toolchain-funcs
39 +
40 +PYPY_PV=${PV%_p*}
41 +MY_P=pypy2.7-v${PYPY_PV/_}
42 +PATCHSET="pypy2.7-gentoo-patches-${PV/_}"
43 +
44 +DESCRIPTION="PyPy executable (build from source)"
45 +HOMEPAGE="https://www.pypy.org/"
46 +SRC_URI="
47 + https://buildbot.pypy.org/pypy/${MY_P}-src.tar.bz2
48 + https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz
49 +"
50 +S="${WORKDIR}/${MY_P}-src"
51 +
52 +LICENSE="MIT"
53 +SLOT="${PYPY_PV}"
54 +KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86 ~amd64-linux ~x86-linux"
55 +IUSE="bzip2 +jit low-memory ncurses cpu_flags_x86_sse2"
56 +
57 +RDEPEND="
58 + >=sys-libs/zlib-1.1.3:0=
59 + dev-libs/libffi:0=
60 + virtual/libintl:0=
61 + dev-libs/expat:0=
62 + bzip2? ( app-arch/bzip2:0= )
63 + ncurses? ( sys-libs/ncurses:0= )
64 + !dev-python/pypy-exe-bin:${PYPY_PV}
65 +"
66 +# don't enforce the dep on pypy with USE=low-memory since it's going
67 +# to cause either collisions or circular dep on itself
68 +DEPEND="
69 + ${RDEPEND}
70 +"
71 +BDEPEND="
72 + !low-memory? (
73 + || (
74 + dev-python/pypy
75 + dev-lang/python:2.7
76 + )
77 + )
78 +"
79 +
80 +check_env() {
81 + if use low-memory; then
82 + if ! has_version -b dev-python/pypy &&
83 + ! has_version -b dev-python/pypy-bin
84 + then
85 + eerror "USE=low-memory requires a (possibly old) version of dev-python/pypy"
86 + eerror "being installed. Please install it using e.g.:"
87 + eerror
88 + eerror " $ emerge -1v dev-python/pypy dev-python/pypy-exe-bin"
89 + eerror
90 + eerror "before attempting to build dev-python/pypy-exe[low-memory]."
91 + die "dev-python/pypy needs to be installed for USE=low-memory"
92 + fi
93 +
94 + CHECKREQS_MEMORY="1750M"
95 + use amd64 && CHECKREQS_MEMORY="3500M"
96 + else
97 + CHECKREQS_MEMORY="3G"
98 + use amd64 && CHECKREQS_MEMORY="6G"
99 + fi
100 +
101 + check-reqs_pkg_pretend
102 +}
103 +
104 +pkg_pretend() {
105 + [[ ${MERGE_TYPE} != binary ]] && check_env
106 +}
107 +
108 +pkg_setup() {
109 + if [[ ${MERGE_TYPE} != binary ]]; then
110 + check_env
111 +
112 + use low-memory && EPYTHON=
113 + if [[ ! ${EPYTHON} || ${EPYTHON} == pypy ]] &&
114 + { has_version -b dev-python/pypy ||
115 + has_version -b dev-python/pypy-bin; }
116 + then
117 + einfo "Using already-installed PyPy to perform the translation."
118 + EPYTHON=pypy
119 + else
120 + einfo "Using ${EPYTHON} to perform the translation. Please note that upstream"
121 + einfo "recommends using PyPy for that. If you wish to do so, please unset"
122 + einfo "the EPYTHON variable."
123 + python-any-r1_pkg_setup
124 + fi
125 + fi
126 +}
127 +
128 +src_prepare() {
129 + local PATCHES=(
130 + "${WORKDIR}/${PATCHSET}"
131 + )
132 + default
133 +}
134 +
135 +src_configure() {
136 + tc-export CC
137 +
138 + local jit_backend
139 + if use jit; then
140 + jit_backend='--jit-backend='
141 +
142 + # We only need the explicit sse2 switch for x86.
143 + # On other arches we can rely on autodetection which uses
144 + # compiler macros. Plus, --jit-backend= doesn't accept all
145 + # the modern values...
146 +
147 + if use x86; then
148 + if use cpu_flags_x86_sse2; then
149 + jit_backend+=x86
150 + else
151 + jit_backend+=x86-without-sse2
152 + fi
153 + else
154 + jit_backend+=auto
155 + fi
156 + fi
157 +
158 + local args=(
159 + --no-shared
160 + $(usex jit -Ojit -O2)
161 +
162 + ${jit_backend}
163 +
164 + pypy/goal/targetpypystandalone
165 + )
166 +
167 + # Avoid linking against libraries disabled by use flags
168 + local opts=(
169 + bzip2:bz2
170 + ncurses:_minimal_curses
171 + )
172 +
173 + local opt
174 + for opt in "${opts[@]}"; do
175 + local flag=${opt%:*}
176 + local mod=${opt#*:}
177 +
178 + args+=(
179 + $(usex ${flag} --withmod --withoutmod)-${mod}
180 + )
181 + done
182 +
183 + local interp=( "${EPYTHON}" )
184 + if use low-memory; then
185 + interp=( env PYPY_GC_MAX_DELTA=200MB
186 + "${EPYTHON}" --jit loop_longevity=300 )
187 + fi
188 +
189 + if [[ ${EPYTHON} != pypy ]]; then
190 + # reuse bundled pycparser to avoid external dep
191 + mkdir -p "${T}"/pymod/cffi || die
192 + : > "${T}"/pymod/cffi/__init__.py || die
193 + cp -r lib_pypy/cffi/_pycparser "${T}"/pymod/cffi/ || die
194 + local -x PYTHONPATH=${T}/pymod:${PYTHONPATH}
195 + fi
196 +
197 + # translate into the C sources
198 + # we're going to build them ourselves since otherwise pypy does not
199 + # free up the unneeded memory before spawning the compiler
200 + set -- "${interp[@]}" rpython/bin/rpython --batch --source "${args[@]}"
201 + echo -e "\033[1m${@}\033[0m"
202 + "${@}" || die "translation failed"
203 +}
204 +
205 +src_compile() {
206 + emake -C "${T}"/usession*-0/testing_1
207 +}
208 +
209 +src_install() {
210 + local dest=/usr/lib/pypy2.7
211 + exeinto "${dest}"
212 + newexe "${T}"/usession*-0/testing_1/pypy-c pypy-c-${PYPY_PV}
213 + insinto "${dest}"/include/${PYPY_PV}
214 + doins include/pypy_*
215 + pax-mark m "${ED}${dest}/pypy-c-${PYPY_PV}"
216 +}